Maven 2.x Antrun Plugin

Use ant-1.7.1

Details

  • Type: New Feature New Feature
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.1
  • Fix Version/s: 1.3
  • Component/s: None
  • Labels:
    None
  • Environment:
    xp, linux
  • Number of attachments :
    1

Description

with out this upgrade, i will need to <exec> ant 1.7.1 to use its new features like abily to do delete,move, etc using filelist

Issue Links

Activity

Hide
Brian Topping added a comment -

I need to be able to use <zipfileset>, a part of 1.7.0.

Show
Brian Topping added a comment - I need to be able to use <zipfileset>, a part of 1.7.0.
Hide
Mauro Talevi added a comment -

Why is this dependent on MNG-3083?

Show
Mauro Talevi added a comment - Why is this dependent on MNG-3083?
Hide
Paul Shemansky added a comment -

I recently stumbled upon this issue while trying to use Ant 1.7.0 features in the maven-antrun-plugin.

Please review the attached patch. I believe this should fix the maven-antrun-plugin issue regardless of MNG-3083.

The patch changes the ant dependency version numbers to 1.7.0.

It also changes the maven-antrun-plugin's version number to match Ant in order to make usage more intuitive. I believe the two should be synchronized for clarity to the end-user.

Show
Paul Shemansky added a comment - I recently stumbled upon this issue while trying to use Ant 1.7.0 features in the maven-antrun-plugin. Please review the attached patch. I believe this should fix the maven-antrun-plugin issue regardless of MNG-3083. The patch changes the ant dependency version numbers to 1.7.0. It also changes the maven-antrun-plugin's version number to match Ant in order to make usage more intuitive. I believe the two should be synchronized for clarity to the end-user.
Hide
Paul Shemansky added a comment -

I apologize for any confusion I may have caused, with regards to MNG-3083.

I believe MNG-3083
relates to upgrading any and all dependencies that Maven 2 may have on Ant. This seems
irrelevant to the issue/patch which I filed here with MANTRUN-68, but I felt the need to mention it because the two were previously linked together somehow.

I hope you are closing MNG-3083 because you/someone upgraded the supposed internal Maven 2 dependency on Ant or there simply isn't a need to work on that. If this is not the case, please re-open MNG-3083 because it may still be necessary, and I do not want to be responsible for causing an uproar.

Thank you for all of your help.

Show
Paul Shemansky added a comment - I apologize for any confusion I may have caused, with regards to MNG-3083. I believe MNG-3083 relates to upgrading any and all dependencies that Maven 2 may have on Ant. This seems irrelevant to the issue/patch which I filed here with MANTRUN-68, but I felt the need to mention it because the two were previously linked together somehow. I hope you are closing MNG-3083 because you/someone upgraded the supposed internal Maven 2 dependency on Ant or there simply isn't a need to work on that. If this is not the case, please re-open MNG-3083 because it may still be necessary, and I do not want to be responsible for causing an uproar. Thank you for all of your help.
Hide
Kohsuke Kawaguchi added a comment -

When I tried to use Ant 1.7.0 with Maven 2 in an environment similar to maven-antrun-plugin, I get the following error when Ant tries to load a resource from a jar file, whose path name includes whitespace.

It appears that ClassLoaders from ClassWorlds return file URL that contains whitespace instead of escaping it to %20, and Ant 1.7 doesn't like this.

ava.lang.IllegalArgumentException
        at java.net.URI.create(URI.java:842)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.tools.ant.launch.Locator.fromURI(Locator.java:162)
        at org.apache.tools.ant.launch.Locator.getResourceSource(Locator.java:119)
        at org.apache.tools.ant.launch.Locator.getClassSource(Locator.java:90)
        at org.apache.tools.ant.Project.setAntLib(Project.java:313)
        at org.apache.tools.ant.Project.initProperties(Project.java:309)
        at org.apache.tools.ant.Project.init(Project.java:295)
        at org.jvnet.maven.plugin.antrun.components.AntTargetConverter.processConfiguration(AntTargetConverter.java:110)
        at org.jvnet.maven.plugin.antrun.components.AntTargetConverter.fromConfiguration(AntTargetConverter.java:80)
        at org.codehaus.plexus.component.configurator.converters.ComponentValueSetter.configure(ComponentValueSetter.java:247)
        at org.codehaus.plexus.component.configurator.converters.composite.ObjectWithFieldsConverter.processConfiguration(ObjectWithFieldsConverter.java:137)
        at org.codehaus.plexus.component.configurator.BasicComponentConfigurator.configureComponent(BasicComponentConfigurator.java:56)
        at org.apache.maven.plugin.DefaultPluginManager.populatePluginFields(DefaultPluginManager.java:1147)
        at org.apache.maven.plugin.DefaultPluginManager.getConfiguredMojo(DefaultPluginManager.java:614)
        at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:421)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:539)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:480)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:459)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:311)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:278)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:143)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:334)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:125)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:280)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
        at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: java.net.URISyntaxException: Illegal character in path at 
index 18: file:/C:/Documents and Settings/tjquinn/.m2/repositor
y/org/apache/ant/ant/1.7.0/ant-1.7.0.jar
        at java.net.URI$Parser.fail(URI.java:2809)
        at java.net.URI$Parser.checkChars(URI.java:2982)
        at java.net.URI$Parser.parseHierarchical(URI.java:3066)
        at java.net.URI$Parser.parse(URI.java:3014)
        at java.net.URI.<init>(URI.java:578)
        at java.net.URI.create(URI.java:840)
        ... 35 more
Show
Kohsuke Kawaguchi added a comment - When I tried to use Ant 1.7.0 with Maven 2 in an environment similar to maven-antrun-plugin, I get the following error when Ant tries to load a resource from a jar file, whose path name includes whitespace. It appears that ClassLoaders from ClassWorlds return file URL that contains whitespace instead of escaping it to %20, and Ant 1.7 doesn't like this.
ava.lang.IllegalArgumentException
        at java.net.URI.create(URI.java:842)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.tools.ant.launch.Locator.fromURI(Locator.java:162)
        at org.apache.tools.ant.launch.Locator.getResourceSource(Locator.java:119)
        at org.apache.tools.ant.launch.Locator.getClassSource(Locator.java:90)
        at org.apache.tools.ant.Project.setAntLib(Project.java:313)
        at org.apache.tools.ant.Project.initProperties(Project.java:309)
        at org.apache.tools.ant.Project.init(Project.java:295)
        at org.jvnet.maven.plugin.antrun.components.AntTargetConverter.processConfiguration(AntTargetConverter.java:110)
        at org.jvnet.maven.plugin.antrun.components.AntTargetConverter.fromConfiguration(AntTargetConverter.java:80)
        at org.codehaus.plexus.component.configurator.converters.ComponentValueSetter.configure(ComponentValueSetter.java:247)
        at org.codehaus.plexus.component.configurator.converters.composite.ObjectWithFieldsConverter.processConfiguration(ObjectWithFieldsConverter.java:137)
        at org.codehaus.plexus.component.configurator.BasicComponentConfigurator.configureComponent(BasicComponentConfigurator.java:56)
        at org.apache.maven.plugin.DefaultPluginManager.populatePluginFields(DefaultPluginManager.java:1147)
        at org.apache.maven.plugin.DefaultPluginManager.getConfiguredMojo(DefaultPluginManager.java:614)
        at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:421)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:539)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:480)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:459)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:311)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:278)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:143)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:334)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:125)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:280)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
        at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: java.net.URISyntaxException: Illegal character in path at 
index 18: file:/C:/Documents and Settings/tjquinn/.m2/repositor
y/org/apache/ant/ant/1.7.0/ant-1.7.0.jar
        at java.net.URI$Parser.fail(URI.java:2809)
        at java.net.URI$Parser.checkChars(URI.java:2982)
        at java.net.URI$Parser.parseHierarchical(URI.java:3066)
        at java.net.URI$Parser.parse(URI.java:3014)
        at java.net.URI.<init>(URI.java:578)
        at java.net.URI.create(URI.java:840)
        ... 35 more
Hide
Santhosh Nair added a comment - - edited

Apparently the URI need to escaped for spaces before passing to URI.

I got around this by making a one line change.

1. download ant 1.7.0 sources
2. open the file org.apache.tools.ant.launch.Locator.java
3. Add the following line as first line inside function public static String fromURI(String uri)
4.

uri = uri.replaceAll(" ", "%20");

5. build ant from sources
6. go to local maven repository and replace ant-launcher-1.7.0.jar with the new file

Show
Santhosh Nair added a comment - - edited Apparently the URI need to escaped for spaces before passing to URI. I got around this by making a one line change. 1. download ant 1.7.0 sources 2. open the file org.apache.tools.ant.launch.Locator.java 3. Add the following line as first line inside function public static String fromURI(String uri) 4.
uri = uri.replaceAll(" ", "%20");
5. build ant from sources 6. go to local maven repository and replace ant-launcher-1.7.0.jar with the new file
Hide
Benjamin Bentmann added a comment -

It appears that ClassLoaders from ClassWorlds return file URL that contains whitespace instead of escaping it to %20, and Ant 1.7 doesn't like this.

Ant is not to blame and should IMHO not be the target of any patches. According to RFC 2396, 2.4.3. Excluded US-ASCII Characters URIs/URLs must not contain spaces. Although the Java class java.net.URL does not enforce/check this (see the last paragraphs in its class javadoc about the URL encoding and the relationship to java.net.URI and URLEncoder), well-behaved applications should never construct such invalid URLs.

Show
Benjamin Bentmann added a comment -
It appears that ClassLoaders from ClassWorlds return file URL that contains whitespace instead of escaping it to %20, and Ant 1.7 doesn't like this.
Ant is not to blame and should IMHO not be the target of any patches. According to RFC 2396, 2.4.3. Excluded US-ASCII Characters URIs/URLs must not contain spaces. Although the Java class java.net.URL does not enforce/check this (see the last paragraphs in its class javadoc about the URL encoding and the relationship to java.net.URI and URLEncoder), well-behaved applications should never construct such invalid URLs.
Hide
ajbanck added a comment -

Looks like the Affects and Fix version/s fields are mixed up:
Affects Version/s: 1.2
Fix Version/s: None

Affects version/s should be 1.1 Fix version/s 1.2 (I assume..)

Show
ajbanck added a comment - Looks like the Affects and Fix version/s fields are mixed up: Affects Version/s: 1.2 Fix Version/s: None Affects version/s should be 1.1 Fix version/s 1.2 (I assume..)
Hide
Trevor Pounds added a comment -

Added a link to the non-conformance URI issue in ClassWorlds.

Show
Trevor Pounds added a comment - Added a link to the non-conformance URI issue in ClassWorlds.
Hide
Trevor Pounds added a comment -

Changing link type to "is related to"

Show
Trevor Pounds added a comment - Changing link type to "is related to"
Hide
Stephane Nicoll added a comment -

Updated to ant 1.7.1 since ant 1.7 has a path problem on Windows.

Show
Stephane Nicoll added a comment - Updated to ant 1.7.1 since ant 1.7 has a path problem on Windows.
Hide
Basil James Whitehouse III added a comment -

NOTE: the groupid has changed for ant 1.7.1 from 'ant' to 'org.apache.ant' .

Show
Basil James Whitehouse III added a comment - NOTE: the groupid has changed for ant 1.7.1 from 'ant' to 'org.apache.ant' .
Hide
Barrie Treloar added a comment -

As a workaround you can do this:
(where you can add additional dependencies for your scripting language of choice)

pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>test</groupId>
  <artifactId>antrun-1.2-with-ant-1.7.1</artifactId>
  <packaging>pom</packaging>
  <name>AntRun 1.2 using Ant 1.7.1</name>
  <version>1</version>
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-antrun-plugin</artifactId>
        <executions>
          <execution>
            <phase>generate-resources</phase>
            <configuration>
              <tasks>
                <ant antfile="${basedir}/build.xml" />
              </tasks>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
        </executions>
        <dependencies>
          <dependency>
            <groupId>org.apache.ant</groupId>
            <artifactId>ant</artifactId>
            <version>1.7.1</version>
          </dependency>
          <dependency>
            <groupId>org.apache.ant</groupId>
            <artifactId>ant-launcher</artifactId>
            <version>1.7.1</version>
          </dependency>
          <dependency>
            <groupId>org.apache.ant</groupId>
            <artifactId>ant-nodeps</artifactId>
            <version>1.7.1</version>
          </dependency>
          <dependency>
            <groupId>org.apache.ant</groupId>
            <artifactId>ant-apache-bsf</artifactId>
            <version>1.7.1</version>
          </dependency>
          <dependency>
            <groupId>org.apache.bsf</groupId>
            <artifactId>bsf-all</artifactId>
            <version>3.0-beta2</version>
          </dependency>
          <dependency>
            <groupId>rhino</groupId>
            <artifactId>js</artifactId>
            <version>1.7R1</version>
          </dependency>
        </dependencies>
      </plugin>
    </plugins>
  </build>
</project>
build.xml
<?xml version="1.0"?>
<project name="myproject" default="run-script">

  <target name="run-script">
    <antversion property="antversion"/>
    <echo message="Antrun is using Ant version ${antversion}"/>

    <script language="javascript">
      <![CDATA[
      echo = myproject.createTask("echo");

        for(var i=0; i<10; i++ ) {
          echo.setMessage(i);
          echo.perform();
      }
    ]]>
    </script>
  </target>
</project>
Show
Barrie Treloar added a comment - As a workaround you can do this: (where you can add additional dependencies for your scripting language of choice)
pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>test</groupId>
  <artifactId>antrun-1.2-with-ant-1.7.1</artifactId>
  <packaging>pom</packaging>
  <name>AntRun 1.2 using Ant 1.7.1</name>
  <version>1</version>
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-antrun-plugin</artifactId>
        <executions>
          <execution>
            <phase>generate-resources</phase>
            <configuration>
              <tasks>
                <ant antfile="${basedir}/build.xml" />
              </tasks>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
        </executions>
        <dependencies>
          <dependency>
            <groupId>org.apache.ant</groupId>
            <artifactId>ant</artifactId>
            <version>1.7.1</version>
          </dependency>
          <dependency>
            <groupId>org.apache.ant</groupId>
            <artifactId>ant-launcher</artifactId>
            <version>1.7.1</version>
          </dependency>
          <dependency>
            <groupId>org.apache.ant</groupId>
            <artifactId>ant-nodeps</artifactId>
            <version>1.7.1</version>
          </dependency>
          <dependency>
            <groupId>org.apache.ant</groupId>
            <artifactId>ant-apache-bsf</artifactId>
            <version>1.7.1</version>
          </dependency>
          <dependency>
            <groupId>org.apache.bsf</groupId>
            <artifactId>bsf-all</artifactId>
            <version>3.0-beta2</version>
          </dependency>
          <dependency>
            <groupId>rhino</groupId>
            <artifactId>js</artifactId>
            <version>1.7R1</version>
          </dependency>
        </dependencies>
      </plugin>
    </plugins>
  </build>
</project>
build.xml
<?xml version="1.0"?>
<project name="myproject" default="run-script">

  <target name="run-script">
    <antversion property="antversion"/>
    <echo message="Antrun is using Ant version ${antversion}"/>

    <script language="javascript">
      <![CDATA[
      echo = myproject.createTask("echo");

        for(var i=0; i<10; i++ ) {
          echo.setMessage(i);
          echo.perform();
      }
    ]]>
    </script>
  </target>
</project>
Hide
Barrie Treloar added a comment -

Upgraded to ant-1.7.1

Added integration tests using echoxml (1.7 feature only)
Also upgraded to plexus-utils 1.5.6 which has FileUtils.contentEquals()

Show
Barrie Treloar added a comment - Upgraded to ant-1.7.1 Added integration tests using echoxml (1.7 feature only) Also upgraded to plexus-utils 1.5.6 which has FileUtils.contentEquals()
Hide
Dan Tran added a comment -

bravo!!!! let's release it

Show
Dan Tran added a comment - bravo!!!! let's release it
Hide
Barrie Treloar added a comment -

I'm in the process of working out how to do that
Bare with me, i'm making a mess of it so far.

Probably a couple of days.

Show
Barrie Treloar added a comment - I'm in the process of working out how to do that Bare with me, i'm making a mess of it so far. Probably a couple of days.
Hide
Dan Tran added a comment -

Could you doc/blog your experience going apache maven release process? This is very handy for any new commiter what would like to sponsor a release

Show
Dan Tran added a comment - Could you doc/blog your experience going apache maven release process? This is very handy for any new commiter what would like to sponsor a release

People

Vote (20)
Watch (14)

Dates

  • Created:
    Updated:
    Resolved: