...
Maven 1.x | Maven 2.x | Description |
---|---|---|
<project> | <project xmlns="http://maven.apache.org/POM/4.0.0" | Keep more extended version of project, so you can visit the schema and validate document |
<pomVersion>3.0.0</pomVersion> | <modelVersion>4.0.0</modelVersion> | Differentiates between different versions of POM objects |
<groupId> | <groupId> | Stays the same |
<artifactId> | <artifactId> | Stays the same |
<currentVersion> | <version> | Same meaning |
<shortDescription> | <description> | Same meaning |
<package> | Not used, JavaDoc is done differently in Maven 2 | The Java package name of the project. This value is used when generating JavaDoc. |
<siteAddress> | Not used, hostname is part of the corresponding <url> element | The hostname of the web server that hosts the project's web site. This is used when the web site is deployed. |
<siteDirectory> | Not used, directory part of the corresponding <url> element | The directory on the web server where the public web site for this project resides |
<repository> | Should be nested inside <repositories> element | Specifies various Maven and SCM repositories |
<developerConnection> | Should be moved to <scm> element | Defines connection to SCM (Source Control Management) for developers. |
<reports> | <reports> <reporting> (and <report>*) Delete, it is deprecated in Maven 2. | This element includes the specification of reports to be included in a Maven-generated site. |
<properties> | If used inside <dependency> delete the element and use <scope>, <version>,<type> as described in http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html | Dependency properties |
<url> | If used inside <dependency>, delete it. | Different URLs nested inside other elements |
<sourceDirectory> | <sourceDirectory> | Used inside <build>, no need to specify, if the default src directory is used. |
<issueManagementUrl> | <issueManagement> | url of Jira server |
|
|
|
3. File after substitutions:
...
Code Block | ||
---|---|---|
| ||
<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <!-- every project POM must include GLAST parent POM --> <parent> <groupId>glast</groupId> <artifactId>maven-parent</artifactId> <version>1.0</version> </parent> <modelVersion>4.0.0</modelVersion> <groupId>glast</groupId> <artifactId>sample-maven-webapp</artifactId> <packaging>war</packaging> <version>1.0-SNAPSHOT</version> <name>Sample Maven Webapp</name> <url>http://glast-ground.slac.stanford.edu</url> <dependencies> <!-- enter project specific POM --> </dependencies> <build> <finalName>sampleMavenWebapp</finalName> </build> </project> |
Note | ||
---|---|---|
| ||
In order for you to see what happens during the inheritance process, you will need to use the handy You will notice that the POM that you see when using the mvn help:effective-pom is bigger than you expected. Remember that |
Deploying your project in GLAST Maven 2 repository:
...
When you are migrating from Maven 1.x to Maven 2.x you will first be trying to convert your build and to make this easier we have provided a way for you to use your existing Maven 1.x repository so that you don't have to convert your repository before trying to migrate your projects. To use a Maven 1.x repository with your Maven 2.x project you need to specify this in your POM as follows:<project>
...
<repositories>
<repository>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>my-m1-repository</id>
<name>Maven 1.x Repository</name>
<url>http://repostory.mycompany.com/maven1</url>
<layout>legacy</layout>
</repository>
</repositories>
...
...