Hello List. I'm aiming at introducing maven (mvn 3.0.3 to be precise) in our company.
In preparation for the task I've set up a company wide POM (c-p-p) and a project specific POM (c-p-p-p) plus a sample project for the developers here to use as a template (sample-project) - all included below. The SCM used is Subversion and the structure of the repositories is historically grown, which requires me to define a <scm-loc> property which needs to be reset for every project. The problem I'm encountering: After "mvn install" for the company and project wide parent POMs I run "mvn help:effective-pom" from within the sample-project with unexpected results: ... <groupId>com.company</groupId> <artifactId>sample-project</artifactId> <version>2012.0.0-SNAPSHOT</version> <name>A sample project</name> <description>A very simple example project.</description> <url>https://doc.company.com/build/trunk/maven/sample-project</url> <scm> <connection>scm:svn:https://svn.company.com/repos/build/trunk/maven/sample-project/c-p-p-p/sample-project</connection> <developerConnection>scm:svn:https://svn.company.com/repos/build/trunk/maven/sample-project/c-p-p-p/sample-project</developerConnection> <url>scm:svn:https://svn.company.com/repos/build/trunk/maven/sample-project/c-p-p-p/sample-project</url> </scm> ... -> The project URL that I explicitly (re-)defined in the sample-project's POM is expanded as I would expect. -> All URLs in the SCM section of the effective POM have a trailing "c-p-p-p/sample-project" (as does the project URL if it is inherited and not explicitly set it in the sample-project's POM). I understand that maven does "inheritance before interpolation", so as the <scm-loc> property is set in the sample-project's POM I would expect all expansions of the property to have the value defined in the POM. What am I missing? Where does the additional suffixing come from? Is this a bug? Is there a way to achieve my goal without having to make it explicit in every single derived POM? As side remarks: The effective POM fpr c-p-p-p looks ok - no unexpected tailing traces of the parent POM there; and mvn 2.2.1 behaves exactly the same way. Cheers, Wolf POMs used c-p-p/pom.xml: <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> <!-- Artifact coordinates --> <groupId>com.company</groupId> <artifactId>c-p-p</artifactId> <version>2012.0.0-SNAPSHOT</version> <packaging>pom</packaging> <!-- Artifact description --> <name>Company Parent POM</name> <description>Central POM for all of Company. Defines central locations, central repositories and central properties.</description> <url>https://${doc-host}/${svn-loc}</url> <!-- Globally defined properties --> <properties> <!-- Documentation host --> <doc-host>doc.company.com</doc-host> <!-- Subversion repository host --> <svn-host>svn.company.com</svn-host> <!-- readonly access to SVN --> <svn-ro>scm:svn:https://${svn-host}/repos</svn-ro> <!-- read/write access to SVN --> <svn-rw>scm:svn:https://${svn-host}/repos</svn-rw> <!-- Current branch in SVN --> <svn-branch>trunk</svn-branch> <!-- location of artifact in SVN --> <svn-loc>build/${svn-branch}/maven/c-p-p</svn-loc> <!-- Default encoding used for source files --> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <!-- Repositories (SVN integration) --> <scm> <connection>${svn-ro}/${svn-loc}</connection> <developerConnection>${svn-rw}/${svn-loc}</developerConnection> <url>${svn-ro}/${svn-loc}</url> </scm> </project> c-p-p-p/pom.xml: <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/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <properties> <!-- location of artifact in SVN --> <svn-loc>build/${svn-branch}/maven</svn-loc> </properties> <!-- Import Company-wide Settings --> <parent> <groupId>com.company</groupId> <artifactId>c-p-p</artifactId> <version>2012.0.0-SNAPSHOT</version> </parent> <!-- This defines generic project settings --> <groupId>com.company</groupId> <artifactId>c-p-p-p</artifactId> <version>2012.0.0-SNAPSHOT</version> <packaging>pom</packaging> <name>Company Project Parent POM</name> <description>Central POM for Company Projects. Defines generic project properties.</description> </project> sample-project/pom.xml: <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/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <!-- Import Company Project Wide Settings --> <parent> <groupId>com.company</groupId> <artifactId>c-p-p-p</artifactId> <version>2012.0.0-SNAPSHOT</version> </parent> <properties> <!-- location of artifact in SVN --> <svn-loc>build/${svn-branch}/maven/sample-project</svn-loc> </properties> <!-- Coordinates of the project --> <groupId>com.company</groupId> <artifactId>sample-project</artifactId> <!-- Version inherited from com.company.c-p-p-p! <version>2012.0.0-SNAPSHOT</version> --> <packaging>jar</packaging> <name>A sample project</name> <description>A very simple example project.</description> <!-- The next should *not* be necessary! --> <url>https://${doc-host}/${svn-loc}</url> </project> --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
