Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Wiki Markup
This page contains advice to ensure smooth transition to maven 3 from maven 2 :

...



h3. A set of maven-enforcer-plugin rule

...



* Check that plugin versions are defined

...


* TODO: Ensure that plugin defs appear only once

...


* TODO: More rules\!

...



{code
}<project>  [...]
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-plugin</artifactId>
        <version>1.0</version>
        <executions>
          <execution>
            <id>enforce-plugin-versions</id>
            <goals>
              <goal>enforce</goal>
            </goals>
            <configuration>
              <rules>
                <requirePluginVersions>
                   <message>Best Practice is to always define plugin versions!</message>
                   <banLatest>true</banLatest>
                   <banRelease>true</banRelease>
                   <banSnapshots>true</banSnapshots>
                   <phases>clean,deploy,site</phases>
                   <additionalPlugins>
                     <additionalPlugin>org.apache.maven.plugins:maven-eclipse-plugin</additionalPlugin>
                     <additionalPlugin>org.apache.maven.plugins:maven-reactor-plugin</additionalPlugin>
                   </additionalPlugins>
                </requirePluginVersions>
                <unCheckedPluginsList>org.apache.maven.plugins:maven-enforcer-plugin,org.apache.maven.plugins:maven-idea-plugin</unCheckedPluginsList>
              </rules>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
  [...]
{code}</project>

...

Misc

relative path to parent

...



h3. relative path to parent
If a project is referring to a parent pom, but that pom isn't reachable in the default parent path (../pom.xml). Then you should either :

...


* update it to the right path

...


* put <relativePath /> in the <parent> tag so that maven knows it will have to look for it directly in the local

...

 repository

h3. Standard variables
When one wants to refer to the artifactId of a POM, the variable ${project.artifactId} can be used. 
There are a lot of other possibilities to do that, like ${pom.artifactId}, ${artifactId} and so on. 
These ways are all deprecated and might be deleted in the future. With maven3, all these deprecated uses appear as warnings.

* Always use *${project.xxx}* and no more ${pom.xxx} or ${xxx}

# Thank JVZ for the page title: [http://twitter.com/jvanzyl/status/4621533361]