9 Replies Latest reply on Jan 17, 2007 1:14 AM by Ales Justin

    Maven build scripts

    Paul Gier Master

      Hi Everyone,
      I created some maven scripts for building the microcontainer project. The scripts are organized the same way that the jboss common scripts are organized. There is one main pom.xml in the build directory, and each subproject has its own pom.xml. Each subproject can be built by itself (assuming it's not dependent on recent changes in another subproject) or by building the entire project.

      Here is what the main pom.xml file looks like:

      <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">
       <modelVersion>4.0.0</modelVersion>
       <groupId>jboss</groupId>
       <version>2.0.0.Beta</version>
       <artifactId>jboss-microcontainer</artifactId>
       <name>JBoss Microcontainer Build</name>
       <url>http://www.jboss.org</url>
       <description>Parent POM for the JBoss Microcontainer Projects</description>
       <licenses>
       <license>
       <name>lgpl</name>
       <url>http://repository.jboss.com/licenses/lgpl.txt</url>
       </license>
       </licenses>
       <organization>
       <name>JBoss Inc.</name>
       <url>http://www.jboss.org</url>
       </organization>
      
       <packaging>pom</packaging>
       <modules>
       <module>../container</module>
       <module>../dependency</module>
       <module>../metatype</module>
       <module>../kernel</module>
       <module>../managed</module>
       <module>../deployers</module>
       <module>../aop-mc-int</module>
       <module>../osgi-int</module>
       <module>../spring-int</module>
       </modules>
       <reporting>
       <plugins>
       <plugin>
       <groupId>org.apache.maven.plugins</groupId>
       <artifactId>maven-project-info-reports-plugin</artifactId>
       <reportSets>
       <reportSet>
       <reports>
       <report>dependencies</report>
       <report>issue-tracking</report>
       <report>license</report>
       <report>scm</report>
       </reports>
       </reportSet>
       </reportSets>
       </plugin>
       </plugins>
       </reporting>
      
       <distributionManagement>
       <repository>
       <id>cvs-file-repository</id>
       <url>file://${maven.cvs.root}</url>
       </repository>
       </distributionManagement>
      
      </project>
      
      


      And here is the one for the container subproject:

      
      <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">
       <modelVersion>4.0.0</modelVersion>
       <groupId>jboss</groupId>
       <artifactId>jboss-container</artifactId>
       <packaging>jar</packaging>
       <version>2.0.0.Beta</version>
       <name>JBoss Microcontainer Container</name>
       <url>http://www.jboss.org</url>
       <description>JBoss Microcontainer Container</description>
       <licenses>
       <license>
       <name>lgpl</name>
       <url>http://repository.jboss.com/licenses/lgpl.txt</url>
       </license>
       </licenses>
       <organization>
       <name>JBoss Inc.</name>
       <url>http://www.jboss.org</url>
       </organization>
      
       <repositories>
       <repository>
       <id>jboss</id>
       <name>JBoss Inc. Repository</name>
       <layout>default</layout>
       <url>http://repository.jboss.com/maven2/</url>
       <snapshots>
       <enabled>true</enabled>
       </snapshots>
       </repository>
       </repositories>
      
       <pluginRepositories>
       <pluginRepository>
       <id>jbosspluginrepo</id>
       <name>jboss plugin repository</name>
       <url>http://repository.jboss.com/maven2</url>
       <layout>default</layout>
       <snapshots>
       <enabled>false</enabled>
       <updatePolicy>never</updatePolicy>
       </snapshots>
       </pluginRepository>
       </pluginRepositories>
      
       <build>
       <sourceDirectory>src/main</sourceDirectory>
       <testSourceDirectory>src/tests</testSourceDirectory>
       <finalName>${artifactId}</finalName>
       <plugins>
      
       <!-- define how we want compilation to take place
       here, we accept most of the defaults but say that we want the
       optimization flag set, and define the source and target to be 1.5,
       these setting will be inherited by child projects -->
       <plugin>
       <artifactId>maven-compiler-plugin</artifactId>
       <version>2.0</version>
       <configuration>
       <optimize>true</optimize>
       <source>1.5</source>
       <target>1.5</target>
       </configuration>
       </plugin>
      
       <plugin>
       <groupId>org.apache.maven.plugins</groupId>
       <artifactId>maven-jar-plugin</artifactId>
       <configuration>
       <archive>
       <manifest>
       <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
       <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
       </manifest>
       </archive>
       </configuration>
       </plugin>
      
       <!-- define that we wish to create src jars -->
       <plugin>
       <artifactId>maven-source-plugin</artifactId>
       <inherited>true</inherited>
       <executions>
       <execution>
       <goals>
       <goal>jar</goal>
       </goals>
       </execution>
       </executions>
       </plugin>
       <plugin>
       <groupId>org.apache.maven.plugins</groupId>
       <artifactId>maven-surefire-plugin</artifactId>
       <configuration>
       <skip>true</skip>
       </configuration>
       </plugin>
      
       </plugins>
       </build>
       <dependencies>
       <!-- Global dependencies -->
       <dependency>
       <groupId>javassist</groupId>
       <artifactId>javassist</artifactId>
       <version>3.4.GA</version>
       </dependency>
       <dependency>
       <groupId>jboss</groupId>
       <artifactId>jboss-vfs</artifactId>
       <version>2.0.4.snapshot</version>
       </dependency>
      
       <!-- Test dependencies -->
       <dependency>
       <groupId>jboss</groupId>
       <artifactId>jboss-test</artifactId>
       <version>1.0.1.GA</version>
       <scope>test</scope>
       </dependency>
       <dependency>
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
       <version>3.8.1</version>
       <scope>test</scope>
       </dependency>
       <dependency>
       <groupId>jboss.profiler.jvmti</groupId>
       <artifactId>jboss-profiler-jvmti</artifactId>
       <version>1.0.0.CR5</version>
       <scope>test</scope>
       </dependency>
       </dependencies>
      </project>
      
      


      The other pom.xml files look pretty similar to the one for the container subproject, just with different dependency lists and a few other minor differences. Let me know if you have any comments or questions about these files. I'm planning to commit them to the repository next to the build.xml as long as no one has a problem with this.