[ 
https://jira.codehaus.org/browse/MRRESOURCES-56?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Dennis Lundberg closed MRRESOURCES-56.
--------------------------------------

       Resolution: Fixed
    Fix Version/s: 1.4
         Assignee: Dennis Lundberg

Fixed in r1401211.

I made the outputDirectory parameter read-only. The process-resources mojo 
reads this file from the class path, so the we cannot allow the directory to be 
modified.
                
> 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
>            Assignee: Dennis Lundberg
>             Fix For: 1.4
>
>         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:
> {code: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>
>   <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>
> {code}
> With this project directory structure:
> {noformat}
> test/
>   |
>   +src/
>     |
>     + main/
>       |
>       + resources
>         |
>         `database.ddl
>         `database.sql
> {noformat}
> Execute this command: mvn clean package to obtain this good result:
> {noformat}
> 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/
> {noformat}
> 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:
> {code:xml}
>         (...)
>         <configuration>
>           <includes>
>             <include>**/database*</include>
>           </includes>
>           <outputDirectory>
>             $\{project.build.outputDirectory}
>           </outputDirectory>
>         </configuration>
>         (...)
> {code}
> 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:
> {code:xml}
>         <configuration>
>           <includes>
>             <include>**/database*</include>
>           </includes>
>           <outputDirectory>
>             $\{project.build.directory}
>           </outputDirectory>
>         </configuration>
> {code}
> 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:
> {noformat}
> 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/
> {noformat}
> 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:
> {code:xml}
>         (...)
>         <configuration>
>           <includes>
>             <include>**/database*</include>
>           </includes>
>           <outputDirectory>
>             $\{project.build.outputDirectory}/somedirectory
>           </outputDirectory>
>         </configuration>
>         (...)
> {code}
> Execute this command: mvn clean package to obtain this bad result:
> {noformat}
> 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/
> {noformat}
> 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:
> {code:xml}
>     (...)
>         <executions>
>           <execution>
>           <phase>package</phase>
>             <goals>
>               <goal>bundle</goal>
>             </goals>
>           </execution>
>         </executions>
>         <configuration>
>           <includes>
>             <include>**/database*</include>
>           </includes>
>         </configuration>
>        (...)
> {code}
> Execute this command: mvn clean package to obtain this bad result:
> {noformat}
> 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/
> {noformat}
> 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.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira


Reply via email to