Maven 1.x Ear Plugin

Duplicated entries if maven.ear.src and maven.ear.resources are the same

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Critical Critical
  • Resolution: Fixed
  • Affects Version/s: 1.5
  • Fix Version/s: 1.6
  • Component/s: None
  • Labels:
    None
  • Number of attachments :
    0

Description

The value of these 2 variables are different by default, but if the user change them so they become equals, the entries on that directory will be added twice in the generated ear.

That happens because we have 2 fileset entries in the Jelly script:

<fileset dir="${maven.ear.resources}" />
<fileset dir="${maven.ear.src}" casesensitive="false"
excludes="**/META-INF/application.xml"/>

The solution is simple, it's just a matter of adding an <j:if> as shown below:

<j:if test="${!pom.build.resources.isEmpty()}">
<mkdir dir="${maven.ear.resources}"/>
<maven:copy-resources resources="${pom.build.resources}" todir="${maven.ear.resources}"/>
<!-- if added below -->
<j:if test="${context.getVariable('maven.ear.resources') != context.getVariable('maven.ear.src')}">
<fileset dir="${maven.ear.resources}" />
</j:if>
</j:if>

(and also, that block should come before the other <fileset> block)

I will fix it later (the most difficult part will be writing a test case

– Felipe

Activity

Hide
Felipe Leme added a comment -

I opted for a simpler solution: forbid a project of setting both properties with the same value!

Show
Felipe Leme added a comment - I opted for a simpler solution: forbid a project of setting both properties with the same value!

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved:

Time Tracking

Estimated:
1h
Original Estimate - 1 hour
Remaining:
1h
Remaining Estimate - 1 hour
Logged:
Not Specified
Time Spent - Not Specified