3 Replies Latest reply on Jan 26, 2007 4:43 PM by starksm64

    Common parent pom.xml

    pgier

      After creating the pom files for microcontainer, and looking at the poms for common, there are some common things that I would like to put into a parent pom. The main thing initially is the definition of the jboss maven repository and plugin repository. This parent pom can be put into the maven repository so that we wouldn't have to add it to each project.

      Here is what it looks like:

      <!--
       A parent pom with default settings for JBoss projects
       Each jboss project should have something similar to the following lines in their pom file.
       <parent>
       <artifactId>jboss-build</artifactId>
       <groupId>jboss</groupId>
       <version>snapshot</version>
       </parent>
      
       To build this project maven 2 should be installed and "mvn" should be in the system path. From the command line
       run "mvn install".
      -->
      
      <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>snapshot</version>
       <artifactId>jboss-build</artifactId>
       <name>JBoss Build</name>
       <url>http://www.jboss.org</url>
       <description>Parent POM for all JBoss 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>
      
       <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>
      
       <distributionManagement>
       <repository>
       <!-- Copy the distribution jar file to a local copy of the maven repository, for use by other projects -->
       <id>cvs-file-repository</id>
       <url>file://${maven.cvs.root}</url>
       </repository>
       </distributionManagement>
      
      </project>
      


      The pom files for the various projects would then add a section like this in the beginning of the file:
       <parent>
       <artifactId>jboss-build</artifactId>
       <groupId>jboss</groupId>
       <version>snapshot</version>
       </parent>
      


      The parent pom would have to be in the main maven repository (not just the jboss one) because otherwise the child project poms wouldn't be able to find it.



        • 1. Re: Common parent pom.xml
          starksm64

          I want to get to the point of not relying on the maven repos for anything. It should all be in our repository.

          • 2. Re: Common parent pom.xml
            pgier

            Ok, in that case I could leave the repository specification out of the parent pom. Should we still use a common parent?
            We could put the JBoss repository config in each specific project pom, but put the plugin repository and other common configuration into the parent. Then the build would still function without access to the main maven repository.

            • 3. Re: Common parent pom.xml
              starksm64

              That sounds fine.