Eclipse, maven multiproject
Only use multiple maven projects with eclipse when absolutely necessary.
We have need to use both eclipse and maven in the Marid project. In order to set this up correctly, we made one major assumption. The build process is different than the development process. This being said, we are only doing builds about once a week.
I am going to list references up top here.
We have need to use both eclipse and maven in the Marid project. In order to set this up correctly, we made one major assumption. The build process is different than the development process. This being said, we are only doing builds about once a week.
I am going to list references up top here.
- http://maven.apache.org/reference/plugins/multiproject/properties.html
- http://roller.anthonyeden.com/page/jojopaderes/20041021
- http://maven.apache.org/reference/user-guide.html#Packaging
- http://maven.apache.org/reference/project-descriptor.html
- http://mevenide.codehaus.org/mevenide-ui-eclipse/
Jojo Paderes provides an excellent implementation and directory structure and that is where I started. Since we already had the projects in a tree structure, I elected not to try the sibling impl that Jojo suggests.
I also have to admit that any tool that saves me time is a good tool. Mevenide Eclipse is a good tool to handle the project.xml, but does not yet handle the standard plugins.
So the parent directory has two files:
Project.xml
<?xml version="1.0" encoding="UTF-8"?>
<project>
<pomVersion>3</pomVersion>
<artifactId>marid</artifactId>
<groupId>marid</groupId>
<id>marid</id>
<name>Marid</name>
<currentVersion>0.1-alpha</currentVersion>
<organization>
<name>Marid</name>
<url>http://maridspace.org</url>
<logo>/images/marid.jpg</logo>
</organization>
<inceptionYear>2002</inceptionYear>
<package>org.marid</package>
<logo>/images/maven.jpg</logo>
<description>
Marid is a service that creates relationships between people and services and their associated devices.
</description>
<shortDescription>Marid is a service that creates relationships between people and services and their associated devices.</shortDescription>
<url>http://maridspace.org</url>
<issueTrackingUrl>http://www.maridspace.org/wiki/ow.asp?BugsFrontPage</issueTrackingUrl>
<siteAddress>http://maridspace.org</siteAddress>
<siteDirectory>/proj/marid/www/</siteDirectory>
<distributionDirectory>/proj/marid/dist/</distributionDirectory>
<repository>
<connection>scm:subversion:svn://www.maridspace.org</connection>
<url>http://www.maridspace.org/websvn/</url>
</repository>
<versions>
<version>
<id>alpha</id>
<name>0.1-alpha</name>
<tag>HEAD</tag>
</version>
</versions>
<mailingLists>
<mailingList>
<name>Marid Developer List</name>
<subscribe>qagwaai@maridspace.org</subscribe>
<unsubscribe>qagwaai@maridspace.org</unsubscribe>
</mailingList>
</mailingLists>
<developers>
<developer>
<name>Robin George</name>
<id>rob</id>
<email>rkgeorge42@hotmail.com</email>
<organization>maridspace.org</organization>
</developer>
<developer>
<name>Peter Girard</name>
<id>qagwaai</id>
<email>qagwaai@hotmail.com</email>
<organization>maridspace.org</organization>
</developer>
<developer>
<name>Lance Weber</name>
<id>lance</id>
<email>lance@alfheimstudios.com</email>
<organization>maridspace.org</organization>
</developer>
</developers>
<dependencies>
<dependency>
<groupId>marid</groupId>
<artifactId>marid-framework</artifactId>
<version>${pom.currentVersion}</version>
</dependency>
<dependency>
<groupId>marid</groupId>
<artifactId>marid-services</artifactId>
<version>${pom.currentVersion}</version>
</dependency>
<dependency>
<groupId>marid</groupId>
<artifactId>marid-applications</artifactId>
<version>${pom.currentVersion}</version>
</dependency>
</dependencies>
<build>
<nagEmailAddress>marid@maridspace.org</nagEmailAddress>
<sourceDirectory>src/java</sourceDirectory>
<unitTestSourceDirectory>src/test/java</unitTestSourceDirectory>
<!-- Unit test classes -->
<unitTest>
<includes>
<include>**/*Test.java</include>
</includes>
</unitTest>
<!-- J A R R E S O U R C E S -->
<!-- Resources that are packaged up inside the JAR file -->
<jars />
</build>
<!-- For maven internal testing -->
<properties>
<testName>testValue</testName>
<pomProperty>${pomProperty}</pomProperty>
</properties>
</project>
project.properties
maven.repo.remote=http://www.ibiblio.org/maven,http://www.maridspace.org/lib
maven.repo.remote.enabled=true
maven.changelog.factory=org.apache.maven.svnlib.SvnChangeLogFactory
maven.junit.fork=true
maven.junit.format=plain
maven.junit.jvmargs=-Xmx256m
maven.junit.envvars=marid.home
marid.home=/development/marid/workspace/marid/config/
#NOTE: make sure no extra spaces are entered after these values!
maven.multiproject.basedir=${basedir}/../
maven.multiproject.includes=*/project.xml
maven.multiproject.excludes=${basedir}/project.xml
And for each of the sub projects, a project.xml and a project.properties.
(Sub)Project.xml
<?xml version="1.0" encoding="UTF-8"?>
<project>
<extend>${basedir}/../project.xml</extend>
<pomVersion>3</pomVersion>
<artifactId>marid-applications</artifactId>
<groupId>marid</groupId>
<!-- Need to mark these as compile-time/run-time -->
<dependencies>
<dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>1.4-dev-8</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>servletapi</groupId>
<artifactId>servletapi</artifactId>
<version>2.3</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>marid</groupId>
<artifactId>marid-framework</artifactId>
<version>${pom.currentVersion}</version>
</dependency>
<dependency>
<groupId>marid</groupId>
<artifactId>marid-services</artifactId>
<version>${pom.currentVersion}</version>
</dependency>
</dependencies>
<build>
<nagEmailAddress>marid@maridspace.org</nagEmailAddress>
<sourceDirectory>src/java</sourceDirectory>
<unitTestSourceDirectory>src/test/java</unitTestSourceDirectory>
<!-- Unit test classes -->
<unitTest>
<includes>
<include>**/*Test.java</include>
</includes>
</unitTest>
<!-- J A R R E S O U R C E S -->
<!-- Resources that are packaged up inside the JAR file -->
<jars />
</build>
<reports>
<report>maven-license-plugin</report>
<report>maven-checkstyle-plugin</report>
<report>maven-jdepend-plugin</report>
<report>maven-changelog-plugin</report>
<report>maven-file-activity-plugin</report>
<report>maven-developer-activity-plugin</report>
<report>maven-javadoc-plugin</report>
<report>maven-faq-plugin</report>
<report>maven-linkcheck-plugin</report>
<report>maven-tasklist-plugin</report>
<report>maven-multiproject-plugin</report>
<report>maven-junit-report-plugin</report>
</reports>
</project>
(Sub)project.properties
maven.checkstyle.properties=../CheckStyle.xml
maven.repo.remote=http://www.ibiblio.org/maven,http://www.maridspace.org/lib
maven.repo.remote.enabled=true
maven.changelog.factory=org.apache.maven.svnlib.SvnChangeLogFactory
maven.junit.fork=true
maven.junit.format=plain
maven.junit.jvmargs=-Xmx256m
maven.junit.envvars=marid.home
marid.home=/development/marid/workspace/marid/config/
maven.license.licenseFile=../LICENSE.txt
maven.checkstyle.header.file=../LICENSE.txt
Notes on the files.
- The subproject uses the extends tag.
- You will still need to set up a repository so that the dependencies will work correctly. No circular dependencies.
- We use a single License file which can be specified in the sub project.properties file.
Comments