pomPropertiesFile does not actually permit override ---------------------------------------------------
Key: MSHARED-154 URL: http://jira.codehaus.org/browse/MSHARED-154 Project: Maven Shared Components Issue Type: Bug Components: maven-archiver Affects Versions: maven-archiver-2.4 Environment: RHEL 5.4 Apache Maven 2.2.1 (r801777; 2009-08-06 13:16:01-0600) Java version: 1.6.0_19 Default locale: en_US, platform encoding: ANSI_X3.4-1968 OS name: "linux" version: "2.6.18-164.2.1.el5pae" arch: "i386" Family: "unix" Reporter: Dan Nelson h4. The What My understanding is that the {{pomPropertiesFile}} configuration element will allow you to override the default {{pom.properties}} file that is created by the maven-archiver when {{addMavenDescriptor}} is {{true}}. I wanted to use this feature to include some [Hudson|https://hudson.dev.java.net/] build data into the {{pom.properties}} file. We already have utility classes that read version information from this file, so it wasn't a leap to add some build-server information to this same file. >From the [Maven Archiver >Reference|http://maven.apache.org/shared/maven-archiver/index.html] page: {quote} | pomPropertiesFile | Use this to override the auto generated pom.properties file (only if addMavenDescriptor is set to true) | File | 2.3 | {quote} h4. My Expectations So my assumption is that I can provide a customized pom.properties file that will be written/copied to the {{META-INF/maven/" + ${pom.groupId} + "/" + ${pom.artifactId} + "/pom.properties}} file. h4. The Actual Result The File I pass to the {{pomPropertiesFile}} element is actually overwritten with the default pom.properties file format. One could say it is overriding my override. Maybe I am misunderstanding this configuration element altogether, I can't see how it can possibly be helpful the way that it is behaving right now... h4. Background Information I am witnessing this behaviour with the apache war plugin: {code:xml|title=Snippet of my pom.xml} <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <version>2.1-beta-1</version> <configuration> <archive> <addMavenDescriptor>true</addMavenDescriptor> <pomPropertiesFile>configurations/custom-pom.properties</pomPropertiesFile> </archive> </configuration> </plugin> {code} And here is my customized properties file that I want used to replace the default pom.properties content: {code:java|title=Snippet of my custom-pom.properties override file} version=$\{pom.version\} groupId=$\{pom.groupId\} artifactId=$\{pom.artifactId\} buildTag=${BUILD_TAG} buildNumber=${BUILD_NUMBER} buildId=${BUILD_ID} {code} I see from my Maven output that {{maven-war-plugin-2.1-beta-1}} uses {{maven-archiver-2.4}}: {code:title=Maven output} ... [DEBUG] Plugin dependencies for: org.apache.maven.plugins:maven-war-plugin:2.1-beta-1 are: org.apache.maven:maven-plugin-api:jar:2.0.6:runtime org.apache.maven:maven-artifact:jar:2.0.6:runtime org.apache.maven:maven-archiver:jar:2.4:runtime org.codehaus.plexus:plexus-archiver:jar:1.0-alpha-9:runtime org.codehaus.plexus:plexus-io:jar:1.0-alpha-1:runtime com.thoughtworks.xstream:xstream:jar:1.3.1:runtime org.codehaus.plexus:plexus-utils:jar:1.5.5:runtime org.apache.maven.shared:maven-filtering:jar:1.0-beta-2:runtime ... [DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-war-plugin:2.1-beta-1:war' --> [DEBUG] (s) addMavenDescriptor = false [DEBUG] (s) pomPropertiesFile = /SOME_PATH/configurations/custom-pom.properties ... {code} h4. [MavenArchiver#createArchive(...)|http://maven.apache.org/shared/maven-archiver/xref/org/apache/maven/archiver/MavenArchiver.html#493] I notice that the {{createArchive(...)}} method ALWAYS writes the standard/default [pom.properties contents|http://maven.apache.org/shared/maven-archiver/index.html#pom-properties-content] to the supplied file. That provides no benefit. If I can offer a suggestion: # get the pomPropertiesFile configuration property. #* if the property is not null and the property maps to an existing file #*# {{archiver.addFile( pomPropertiesFile, "META-INF/maven/" + groupId + "/" + artifactId + "/pom.properties" );}} #* else the file property was null #*# Create the temporary maven-archiver folder #*# Create a ref to the maven-archiver/pom.properties file #*# Call PomPropertiesUtil#createPomProperties -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira