[ http://jira.codehaus.org/browse/MPJAVA-38?page=all ]
Ignacio G. Mac Dowell updated MPJAVA-38:
----------------------------------------
Attachment: sourceModifications.patch
I came across this same problem...
Truly, ant:available is working as expected. Quoting
http://ant.apache.org/manual/CoreTasks/available.html
"If the resource is present, the property value is set to true by default;
otherwise, the property is <b>not set</b>"
I tried to reset the value through ant:property and it doesn't work. What does
work is using the jelly core tag:
<j:set var="classPresent" value=""/>
before each invocation of ant:available
Simple, but not very elegant... If someother way is proposed (via
j:invokeStatic or something like that) I can provide patches. IMHO this issue
is critical if you have more than one sourceModification.
Patch attached.
> sourceModifications handled incorrectly when more than one clause present
> -------------------------------------------------------------------------
>
> Key: MPJAVA-38
> URL: http://jira.codehaus.org/browse/MPJAVA-38
> Project: maven-java-plugin
> Type: Bug
> Versions: 1.5
> Reporter: Simon Kitching
> Attachments: sourceModifications.patch
>
>
> The loop
> <j:forEach var="sm" items="${pom.build.sourceModifications}">
> <ant:available property="classPresent" classname="${sm.className}"/>
> is flawed. When the class is not present, the <available> action does NOT
> reset $classPresent to a false value; instead, its previous value is left
> unaltered (ie is the value from the previous time around the loop).
> So a sourceModified clause with a classname that is present will cause all
> following sourceModified clauses to be skipped, regardless of whether their
> test class is present or not.
> The following ant file demonstrates this nicely:
> <project name="foo" default="def" basedir=".">
> <target name="def">
> <echo>av: ${av}</echo>
> <available property="av" classname="dafasfas"/>
> <echo>av: ${av}</echo>
> <available property="av" classname="java.lang.String"/>
> <echo>av: ${av}</echo>
> <available property="av" classname="no.such.class"/>
> <echo>av: ${av}</echo>
> </target>
> </project>
> perhaps simply inserting an assignment to reset the variable to false
> immediately before the <ant:available> test will fix this?
--
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
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]