The maven-remote-resources-plugin (1.2.1) fails to create a usable Resource Bundle if the outputDirectory configuration parameter is specified and does not explicitly contain ${project.build.outputDirectory} ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Key: MRRESOURCES-56 URL: https://jira.codehaus.org/browse/MRRESOURCES-56 Project: Maven 2.x Remote Resources Plugin Issue Type: Bug Affects Versions: 1.2.1 Environment: Window XP, Java 1.6 Reporter: Gareth Tudor Eley Attachments: test.zip Issue: The maven-remote-resources-plugin (1.2.1) fails to create a usable Resource Bundle if the outputDirectory configuration parameter is specified and does not explicitly contain ${project.build.outputDirectory} - this makes ${project.build.outputDirectory} the only viable configuration. The documentation for the remote-resources:bundle goal: (see: http://maven.apache.org/plugins/maven-remote-resources-plugin/bundle-mojo.html#outputDirectory) states: outputDirectory: The directory where you want the resource bundle manifest written to. Type: java.io.File Required: No Expression: ${project.build.outputDirectory} Reproduction the issue: With this initial POM: <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> <groupId>org.gteley</groupId> <artifactId>test</artifactId> <version>0.0.1-SNAPSHOT</version> <build> <plugins> <plugin> <artifactId>maven-remote-resources-plugin</artifactId> <version>1.2.1</version> <executions> <execution> <goals> <goal>bundle</goal> </goals> </execution> </executions> <configuration> <includes> <include>**/database*</include> </includes> </configuration> </plugin> </plugins> </build> </project> With this project directory structure: test/ | +src/ | + main/ | + resources | `database.ddl `database.sql Execute this command: mvn clean package to obtain this good result: test/ | +src/ | +target/ | +test-0.0.1-SNAPSHOT.jar/ | `database.ddl `database.sql | + META-INF\ | ` MANIFEST.MF | + maven | ` remote-resources.xml | + org.gteley/ | `pom.properties `pom.xml | + classes/ | `database.ddl `database.sql | + META-INF\ | + maven | ` remote-resources.xml | + maven-archiver/ | ` pom.properties | + maven-shared-archive-resources/ + test-classes/ Everything is fine, the contents of the Resource Bundle (test-0.0.1-SNAPSHOT.jar) are as required and expected for subsequent consumption by the remote-resource:process goal.. Now, amend the POM to explicitly specify the default value for the outputDirectory parameter: (...) <configuration> <includes> <include>**/database*</include> </includes> <outputDirectory> ${project.build.outputDirectory} </outputDirectory> </configuration> (...) Execute this command again: mvn clean package to obtain the same good result. OK far, now amend the POM to explicitly specify an alternative value (${project.build.directory}) for the outputDirectory parameter: (...) <configuration> <includes> <include>**/database*</include> </includes> <outputDirectory> ${project.build.directory} </outputDirectory> </configuration> (...) The result below now reveals the issue, the Resource Bundle (test-0.0.1-SNAPSHOT.jar) is created, but without the necessary META-INF/maven/remote-resources.xml file: test/ | | + META-INF\ | ` MANIFEST.MF | + maven | ` remote-resources.xml | + org.gteley/ | `pom.properties `pom.xml | +src/ | +target/ | +test-0.0.1-SNAPSHOT.jar/ | `database.ddl `database.sql | + classes/ | `database.ddl `database.sql | + maven-archiver/ | ` pom.properties | + maven-shared-archive-resources/ + test-classes/ By specifying ${project.build.directory} the META-INF/maven/remote-resources.xml file lies at the same directory level as the src and target directories (as expected) - but the Resource Bundle (test-0.0.1-SNAPSHOT.jar) does not now contain the META-INF/maven/remote-resources.xml file rendering useless for subsequent processing by the remote-resource:process goal: Another way to also render the Bundled Resource useless for processing by the remote-resource:process goal is to append a subdirectory to the valid ${project.build.outputDirectory} configuration. Amend the POM again this time specify an additional subdirectory to the ${project.build.outputDirectory} configuration of the outputDirectory parameter like this: (...) <configuration> <includes> <include>**/database*</include> </includes> <outputDirectory> ${project.build.outputDirectory}/somedirectory </outputDirectory> </configuration> (...) Execute this command: mvn clean package to obtain this bad result: test/ | +src/ | +target/ | +test-0.0.1-SNAPSHOT.jar/ | `database.ddl `database.sql | + somedirectory | + META-INF\ | ` MANIFEST.MF | + maven | ` remote-resources.xml | + org.gteley/ | `pom.properties `pom.xml | + classes/ | `database.ddl `database.sql | + somedirectory | + META-INF\ | + maven | ` remote-resources.xml | + maven-archiver/ | ` pom.properties | + maven-shared-archive-resources/ + test-classes/ The META-INF/maven/remote-resources.xml file now stems from the somedirectory/ directory, and not from the Jar's root directory as so again the Resource Bundle cannot be consumed by the remote-resource:process goal One other avenue I've found that prevents the META-INF/maven/remote-resources.xml file from appearing in the Resource Bundle (test-0.0.1-SNAPSHOT.jar) is to update the execution section of the POM to include a phase like this: (...) <executions> <execution> <phase>package</phase> <goals> <goal>bundle</goal> </goals> </execution> </executions> <configuration> <includes> <include>**/database*</include> </includes> </configuration> (...) Execute this command: mvn clean package to obtain this bad result: test/ | +src/ | +target/ | +test-0.0.1-SNAPSHOT.jar/ | `database.ddl `database.sql | + META-INF\ | ` MANIFEST.MF | + maven | + org.gteley/ | `pom.properties `pom.xml | + classes/ | `database.ddl `database.sql | + META-INF\ | + maven | ` remote-resources.xml | + maven-archiver/ | ` pom.properties | + maven-shared-archive-resources/ + test-classes/ This time, the remote-resources.xml correctly appears in the classes directory under classes/META-INF/maven/remote-resources.xml - but it does not get included in the Resource Bundle (test-0.0.1-SNAPSHOT.jar). -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira