since resourcesDir property is deprecated anyway, please make it optional and 
do not attempt to copy resources from it if is not explicitly set
-----------------------------------------------------------------------------------------------------------------------------------------------

                 Key: MEAR-47
                 URL: http://jira.codehaus.org/browse/MEAR-47
             Project: Maven 2.x Ear Plugin
          Issue Type: Improvement
    Affects Versions: 2.2
            Reporter: Ian Springer
         Attachments: make-resourcesDir-optional.patch, 
skip-resources-copy-if-resourceDir-equals-workDirectory.patch

The deprecated resourcesDir property recently caused me quite a bit of grief. 
In our build environment we use a profile called "dev" that allows artifacts to 
be built directly to their test deploy locations, rather than to target/classes 
(or target/my.ear in the case of the ear plugin). To make this magic happen, I 
had to write a simple M2 plugin that allows you to override the value of 
project.build.directory and/or project.build.outputDirectory. So for our ear, 
the dev profile sets the ear plugin's workDirectory prop to 
<testAppServer>/deploy/my.ear. It also sets project.build.outputDirectory to 
<testAppServer>/deploy/my.ear in the pre-clean phase, so that the clean phase 
will delete <testAppServer>/deploy/my.ear.

The problem that I hit was that if I ran "mvn clean install", 
project.build.outputDirectory would still be set to 
"<testAppServer>/deploy/my.ear" when mvn got to the default lifecycle, and 
since the ear plugin's resourcesDir property defaults to 
"${project.build.outputDirectory}", the ear plugin ends up trying to copy the 
contents of "<testAppServer>/deploy/my.ear" over top of themselves, which 
causes all of the files in the ear to get zeroed out.

Anyway, I know my use case is a bit unusual, but making the property optional 
and not doing anything if it's not explicitly set would save me from having to 
do an additional hack to reset project.build.outputDirectory at the beginning 
of the default lifecycle.

Another acceptable alternative would be if the resource copying was skipped if 
resourceDir equals workDirectory.

I've attached patches for both of the alternatives.


-- 
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

        

Reply via email to