Details
-
Type:
Bug
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: 1.7
-
Fix Version/s: None
-
Labels:None
-
Number of attachments :
Description
The plugin:plugin goal is written as follows:
<goal name="plugin:plugin" description="Build a plugin jar">
<!-- For some reason a prereq on this causes an internal error... -->
<attainGoal name="jar:jar" />
<!-- We can't use it in the bootstrap phase because classes aren't yet build in the artifact plugin -->
<j:if test="$
">
<assert:assertPluginAvailable groupId="maven" artifactId="maven-artifact-plugin" minRelease="1.7" neededBy="$
"/>
<artifact:rewritePOM path="$
<ant:jar
jarfile="${maven.build.dir}
/$
{maven.jar.final.name}"
basedir="$
update="true">
<ant:setProperty name="includes" value="project.xml" />
</ant:jar>
<ant:delete file="${maven.build.dir}
/project.xml" quiet="true"/>
</j:if>
</goal>
The idea here is first to build an ordinary jar, and then update its project.xml by using the rewritten version.
This didn't work as expected in my system, because the jar generation and POM rewriting happens too quickly,
they get the same (or at least very similar) timestamp — note that zip file only maintains timestamp in
2 sec precision.
So when this runs the <jar> task to update project.xml, Ant actually skips the processing, saying project.xml
is up to date.
One simple but stupid way to fix this is to insert a delay before rewriting POM, like:
<ant:sleep seconds="3" />
Or alternatively I guess one can unjar, use <copy> to overwrite, then update.