Difference between revisions of "Maven/Parent POM"
|Line 15:||Line 15:|
Revision as of 13:04, 8 November 2011
Following the foot steps of many other open source projects that use maven, the Eclipse community has created a base parent pom that all eclipse projects hosted at the foundation are encouraged to inherrit from.
The parent pom, contains standard information like the location of the issue tracking system, the license, and continus build management location.
Also included are several profiles that projects can use during their builds.
To use this parent pom, your project's parent must specify the following entry:
<parent> <groupId>org.eclipse</groupId> <artifactId>eclipse-parent</artifactId> <version>3</version> </parent>
Your project should also be using the settings.xml file during your build. Projects can copy the settings.xml into their source control management system, and then specify the -s option to specify the location of the settings.xml to use during your build:
mvn clean install -s settings.xml
The above assumes the settings.xml resides in the same location as your parent pom. The settings.xml contains the repository locations for the maven.eclipse.org, and also makes sure your build uses maven.eclipse.org for any requests that would normally go to maven central.
There are several static code analysis profiles that can be used by a project. To enable a profile, specify the -P option.
The analysis profile enables the PMD duplicate code detector and FindBugs to run during your builds. These will output an XML file that can be read by Hudson and displayed. Note that depending on the size of your project, FindBugs can take a while to run. It also depends on the number of possible bugs that finds. The static code analysis profile uses the default FindBugs profile, and the default pmd copy paste detector profiles.
mvn clean install -Panalysis
Checkstyle is another static code analysis tool but focusing more on coding style, missing headers, duplicate code, javadoc, etc. Several eclipse projects have profiles for their projects, and these can be used during a build to report how well the team is keeping up with following those agreed conventions. The default profile uses the Sun coding style checks.
mvn clean install -Pcheckstyle
There are a couple of profiles for those that need to deploy maven artifacts during Juno to maven.eclipse.org. You will need deployment rights to maven.eclipse.org in order to use these profiles.
- eclipse-milestone-juno - released versions of milestones for projects to use
- eclipse-nightly-juno - snapshots for use by projects