ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 47640] New: Targets created inside a <script> task sometimes do not appear when "ant -p" is run
Date Tue, 04 Aug 2009 15:41:06 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=47640

           Summary: Targets created inside a <script> task sometimes do
                    not appear when "ant -p" is run
           Product: Ant
           Version: 1.7.1
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Optional Tasks
        AssignedTo: notifications@ant.apache.org
        ReportedBy: camskinner@gmail.com


--- Comment #0 from Cameron Skinner <camskinner@gmail.com> 2009-08-04 08:41:03 PDT ---
More specifically, only the most recently created target will be shown. The
generated targets still exist and can be called normally, they just don't
appear in the ant -p output.

The following build file demonstrates the issue:

<project name="test" basedir=".">
  <target name="foo" description="Foo task"/>

  <script language="javascript">
    <![CDATA[
      importClass(org.apache.tools.ant.Target);
      var t1 = new Target();
      t1.setName("script-target-1");
      t1.setDescription("Target 1 generated from script");
      project.addTarget(t1);

      var t2 = new Target();
      t2.setName("script-target-2");
      t2.setDescription("Target 2 generated from script");
      project.addTarget(t2);
    ]]>
  </script>
</project>

The output from ant -p is this:

Buildfile: build.xml

Main targets:

 foo              Foo task
 script-target-2  Target 2 generated from script


ant -p -v generates this:

Apache Ant version 1.7.1 compiled on November 10 2008
Buildfile: build.xml
Detected Java version: 1.6 in: /usr/lib/jvm/java-6-sun-1.6.0.14/jre
Detected OS: Linux
parsing buildfile /home/cam/test/build.xml with URI =
file:/home/cam/test/build.xml
Project base dir set to: /home/cam/test
[antlib:org.apache.tools.ant] Could not load definitions from resource
org/apache/tools/ant/antlib.xml. It could not be found.

Main targets:

 foo              Foo task
 script-target-2  Target 2 generated from script
Other targets:



script-target-1 is not appearing in the output. However, I can run that target:

ant script-target-1
Buildfile: build.xml

script-target-1:

BUILD SUCCESSFUL
Total time: 0 seconds


Commenting out the second half of the script results in script-target-1 being
displayed from ant -p.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

Mime
View raw message