MYHOSPITALNOW.COM

Find Trusted Doctors & Hospitals

Discover healthcare providers, compare hospitals, and explore treatment options worldwide.

Free Treatment Quotes • Doctor Search • Hospital Comparison

Find Healthcare Options

www.myhospitalnow.com

Maven 1 vs Maven 2: Architecture, Lifecycle, and Migration Differences

Maven 2 was a major redesign of Maven 1. This guide focuses on the differences that mattered to build engineers: compatibility, repository configuration, lifecycle behavior, and multi-project execution.

Originally published on 2010-04-14; fully revised and updated.

Maven 1 and Maven 2 differences

Maven 1 vs Maven 2 at a glance

According to the original Maven documentation and migration notes, Maven 2 was a complete rewrite of Maven 1 and not backward-compatible with Maven 1 plugins. It also shifted teams toward a stronger POM-and-lifecycle model.

AspectMaven 1Maven 2Why it matters
Core implementationOriginal Maven codebaseComplete rewriteDifferent internals and behavior
Plugin compatibilityMaven 1 pluginsCannot execute Maven 1 pluginsMigration may require plugin replacement
Build customizationCommonly used scripting patterns (for example maven.xml)Plugin-centric extension modelLess ad-hoc scripting, more structured plugins
Configuration styleHeavier properties-file usageProject config in pom.xml; private/user settings in settings.xmlCleaner separation of project and environment concerns
Multi-project handlingSupported via pluginNative parent/child multi-project supportBetter large-project orchestration

Repository configuration differences

The original post showed two different repository approaches: Maven 1 via properties, and Maven 2 via repository definitions with a legacy layout.

Maven 1 style (project.properties or build.properties)

maven.repo.remote=http://download.java.net/maven/1/,http://www.ibiblio.org/maven/Code language: JavaScript (javascript)

Maven 2 style (pom.xml repository with legacy layout)

<repositories>
  <repository>
    <id>java.net</id>
    <url>http://download.java.net/maven/1</url>
    <layout>legacy</layout>
  </repository>
</repositories>Code language: HTML, XML (xml)

The source also notes that Maven 2 introduced settings.xml for environment-specific and private configuration (such as credentials), while project behavior belongs in pom.xml.

Maven 2 lifecycle workflow

A key change in Maven 2 was the stronger lifecycle model. Running a later phase triggers earlier phases in sequence.

flowchart TD
    A[mvn clean install] --> B[Clean output directory]
    B --> C[Compile source]
    C --> D[Run unit tests]
    D --> E[Package artifact]
    E --> F[Install in local repository]
    F --> G{Run mvn deploy?}
    G -- yes --> H[Publish to remote repository]
    G -- no --> I[Build complete]
  • compile: compile source code
  • test: run unit tests
  • package: create distributable artifact (for example JAR or WAR)
  • integration-test: execute integration testing workflow
  • install: install artifact in local repository
  • deploy: publish artifact to remote repository
# Common Maven 2 era usage
mvn clean install
mvn deploy

# Historical syntax seen in early Maven 2 docs
m2 clean:clean installCode language: PHP (php)

Multi-project support and project layout

The source emphasizes Maven 2’s native multi-project execution with parent descriptors. Invoking a lifecycle from the parent can orchestrate child modules as part of one build.

root/
  pom.xml
  src/
    main/
      java/
        com/daviddewolf/maven/example/App.java
    test/
      java/
        com/daviddewolf/maven/example/TestApp.java

The original article used the following project bootstrap command:

m2 archetype:create -DgroupId=com.daviddewolf.maven -DartifactId=example

Legacy Maven 2 goals frequently referenced

These goals were listed in the original post as commonly useful in Maven 2 workflows.

GoalPurposeTypical use
clean:cleanRemove generated build filesReset workspace before rebuild
eclipse:eclipseGenerate Eclipse project filesIDE setup
idea:ideaGenerate IntelliJ IDEA project filesIDE setup
javadoc:javadocGenerate API docsDocumentation builds
antrun:runRun an Ant target from MavenBridge legacy Ant tasks
checkstyle:checkstyleRun style checksCode quality reporting
site:siteGenerate project site and reportsProject documentation/reporting

Migration guidance from Maven 1 to Maven 2

  • Inventory all Maven 1 plugins used in CI/CD pipelines.
  • Replace Maven 1-specific plugins with Maven 2-compatible equivalents.
  • Move project build logic into pom.xml and avoid script-heavy customization patterns.
  • Move user/private values (credentials, mirrors, local environment config) into settings.xml.
  • If building multiple artifacts, define a parent project and child modules to use native multiproject execution.

Common pitfalls

  • Assuming Maven 1 plugins will run in Maven 2 without change.
  • Mixing project configuration and private environment settings in the wrong file.
  • Following old repository endpoints without validating availability.
  • Treating historical commands and goals as current defaults without checking present-day plugin status.

References and original sources

Find Trusted Cardiac Hospitals

Compare heart hospitals by city and services — all in one place.

Explore Hospitals
I'm Rajesh Kumar, a DevOps, SRE, DevSecOps, Cloud, and Platform Engineering expert passionate about sharing practical knowledge, real-world experiences, and industry best practices. I have worked at Cotocus and regularly write about technology, travel, investing, health, product reviews, and digital marketing through my various platforms. I publish technical articles at DevOps School, travel stories at Holiday Landmark, stock market insights at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at TrueReviewNow, and SEO and digital marketing strategies at Wizbrand.

Related Posts

Public Package Repositories by Programming Language

Public Package Repositories by Programming Language Public package repositories (also known as package registries, artifact repositories or dependency repositories) allow developers to publish, discover, download and manage…

Read More

Major programming languages, the common package tool(s), and the central community package repository.

Most programming languages pair a command-line package tool with a public registry it downloads dependencies from. Examples are cargo with crates.io, pip with PyPI, Maven with Maven…

Read More

Develocity: The Complete Beginner-to-Advanced Tutorial

A practical self-study course covering Developer Productivity Engineering, Build Scan, Build Cache, build acceleration, test optimization, architecture, deployment, integrations, security, and enterprise operations. 28 chapters | Beginner…

Read More

Jenkins Build and Release Training Blueprint: Git/SVN with Maven and Ant

This revised guide turns a legacy training announcement into a practical learning blueprint for build-and-release engineering. It maps the Jenkins workflow, compares core tools, and includes realistic command and pipeline examples.

Read More

Maven Release Plugin vs Maven Git Flow Plugin for Artifact Releases

Learn how Maven Release Plugin and Maven Git Flow Plugin automate Java artifact releases. Compare workflows, commands, and selection criteria for your branching strategy.

Read More

Sonatype Nexus Repository Manager: A Practical DevOps Introduction

Sonatype Nexus helps teams centralize dependency downloads and internal artifact publishing. This guide shows how Nexus fits into CI/CD, when to use hosted/proxy/group repos, and how to configure common build clients.

Read More
Subscribe
Notify of
guest
1 Comment
Newest
Oldest Most Voted
Puja kushwaha
Puja kushwaha
1 month ago

Understanding the differences between Maven 1 and Maven 2 helps explain how Java build tools have evolved. Maven 2 introduced a more structured project model and a clearer way to manage dependencies. When working with older projects, it is useful to check the Maven version before changing build settings. This can prevent confusion when commands or configuration files behave differently. Knowing the history also makes it easier to understand why modern Maven projects follow today’s conventions.

1
0
Would love your thoughts, please comment.x
()
x