Sure thing.

Here is an excerpt from the pom.xml:

<tasks>
<ant antfile="test-maven.xml" target="test-maven-classpath"
inheritRefs="true"/>
</tasks>

Then, this works:

<project name="scxml-js" basedir="." >
<target name="test-maven-classpath">
<property name="compile_classpath" refid="maven.compile.classpath"/>
<property name="runtime_classpath" refid="maven.runtime.classpath"/>
<property name="test_classpath" refid="maven.test.classpath"/>
<property name="plugin_classpath" refid="maven.plugin.classpath"/>

<echo message="compile classpath: ${compile_classpath}"/>
<echo message="runtime classpath: ${runtime_classpath}"/>
<echo message="test classpath: ${test_classpath}"/>
<echo message="plugin classpath: ${plugin_classpath}"/>
</target>
</project>

But this fails:

<project name="scxml-js" basedir="." >
<property name="compile_classpath" refid="maven.compile.classpath"/>
<property name="runtime_classpath" refid="maven.runtime.classpath"/>
<property name="test_classpath" refid="maven.test.classpath"/>
<property name="plugin_classpath" refid="maven.plugin.classpath"/>

<target name="test-maven-classpath">
<echo message="compile classpath: ${compile_classpath}"/>
<echo message="runtime classpath: ${runtime_classpath}"/>
<echo message="test classpath: ${test_classpath}"/>
<echo message="plugin classpath: ${plugin_classpath}"/>
</target>
</project>

With the following error:

[INFO] An Ant BuildException has occured: The following error occurred
while executing this line:
/home/jacob/workspace/gsoc2010/git-scxml-js/scxml-js/test-maven.xml:19:
Reference maven.compile.classpath not found.

If I then set a property in the pom.xml, like this:


<tasks>
<property name="foo" value="bar"/>

<ant antfile="test-maven.xml" target="test-maven-classpath"
inheritRefs="true"/>
</tasks>

Then both of the following work:

<project name="scxml-js" basedir="." >

<target name="test-maven-classpath">
<property name="new-foo" value="${foo}"/>

<echo>${new-foo}</echo>
</target>
</project>

<project name="scxml-js" basedir="." >

<property name="new-foo" value="${foo}"/>

<target name="test-maven-classpath">

<echo>${new-foo}</echo>
</target>
</project>


Please let me know what you think. Thanks,

Jake

On 10-08-27 02:24 AM, Cody zhang wrote:
> Hi,Jacob
>     Can you paste your code example?
>     Best Regards,
>         --Cody.Zhang
>
>
> 2010/8/27 Jacob Beard <jbea...@cs.mcgill.ca>
>
>   
>> Hi,
>>
>> I have question on the capabilities of the AntRun plugin. This example
>> shows the Maven classpaths being copied into Ant properties, which are then
>> used in Ant:
>>
>>
>> http://maven.apache.org/plugins/maven-antrun-plugin/examples/classpaths.html
>>
>> I thougth it would be useful to reference these classpaths directly in Ant,
>> rather than using the copied properties, and so I ran a series of tests.
>> What I found was that the maven classpaths could be referenced, but only in
>> the scope of the called target. When used outside of a target (in a taskdef,
>> for example), an error is thrown. On the other hand, properties that are
>> created in the Maven tasks element can be used both in and outside of the
>> scope of the called target. This is using the ant task, with both
>> inheritsAll and inheritsRefs set to true.
>>
>> I'm wondering if I'm correct in the above assessment of the capabilities of
>> antrun. Can maven classpaths not be referenced directly, outside of the
>> scope of the called ant task? If they cannot, what is the best way in Ant to
>> read a classpath that has been read into a property back into a path
>> element?
>>
>> Let me know. Thanks,
>>
>> Jake
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
>> For additional commands, e-mail: users-h...@maven.apache.org
>>
>>
>>     
>   

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org

Reply via email to