Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.2
-
None
-
Patch
Description
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.
Attachments
Attachments
Issue Links
- is related to
-
MEAR-48 Remove the deprecated resourcesDir parameter
- Closed