ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Peter Reilly" <peter.kitt.rei...@gmail.com>
Subject Re: Maven Ant Task problem when used with Ant 1.7.0
Date Wed, 10 Jan 2007 19:32:39 GMT
It looks like it is some strange stuff with
path through the code  that just avoids an NPE in ant.1.6.5.

On ant 1.6.5 with the following file and the maven jar in lib,
the first echo works but the second echo fails:

<project name="test-maven" default="test"
         xmlns:maven="antlib:org.apache.maven.artifact.ant">
  <target name="test">
    <typedef
      uri="antlib:org.apache.maven.artifact.ant"
      resource="org/apache/maven/artifact/ant/antlib.xml"
      >
      <classpath>
        <fileset dir="lib" includes="*.jar"/>
      </classpath>
    </typedef>
    <echo>Here</echo>
    <property name="artifact.groupid" value="junit"/>
    <property name="artifact.id" value="junit"/>
    <property name="artifact.version" value="3.8.1"/>
    <setproxy proxyhost="${proxy}" proxyport="8000"/>
    <maven:dependencies filesetId="dependency.files">
      <dependency groupId="${artifact.groupid}"
                  artifactId="${artifact.id}"
                  version="${artifact.version}"/>
    </maven:dependencies>
    <pathconvert property="echo.dependency.files"
                 refid="dependency.files"/>

    <echo>${echo.dependency.files}</echo>   <!--  1 -->
    <echo>${toString:dependency.files}</echo>  <!-- 2 -->
  </target>
</project>

I am not sure how to fix this in ant.

Peter


On 1/10/07, Matt Benson <gudnabrsam@yahoo.com> wrote:
> Sorry... to go farther down the stacktrace, I should
> correct myself:  it appears that the Maven guys don't
> set a project on their fileset when they create it, or
> something.  So it's a bug for them, but possibly a
> regression for Ant after all, if you want to look at
> it that way.
>
> -Matt
>
> --- Matt Benson <gudnabrsam@yahoo.com> wrote:
>
> > That looks like a bug in the Maven task.  The only
> > way
> > for an NPE to be triggered here would seem to
> > indicate
> > the task passed null as the project argument to
> > getDirectoryScanner().  Looking at Ant 1.6.5's code
> > it
> > appears that the same exception would be thrown,
> > however, so I am confused how this problem only
> > showed
> > up with Ant 1.7.0.
> >
> > -Matt
> >
> > --- Loic Jay <Loic.Jay@Sun.COM> wrote:
> >
> > > Hi,
> > >
> > > I have submitted the following problem to the
> > Maven
> > > mailing list which
> > > redirected me to this Ant mailing list.
> > >
> > > The problem occurs when I use the maven ant task
> > > 2.0.4 with Ant 1.7.0.
> > > The fileset created by the <maven:dependencies>
> > task
> > > raises a
> > > NullPointerException when used in the Ant
> > > <pathconvert> task.
> > >
> > > The following code :
> > >
> > >         <!-- The Artifact to be looked for with
> > the
> > > maven dependencies
> > > task -->
> > >         <property name="artifact.groupid"
> > > value="junit"/>
> > >         <property name="artifact.id"
> > value="junit"/>
> > >
> > >         <property name="artifact.version"
> > > value="3.8.1"/>
> > >
> > >        <!-- Try retrieving the artifact as a
> > fileset
> > > -->
> > >         <maven:dependencies
> > > filesetId="dependency.files">
> > >             <dependency
> > > groupId="${artifact.groupid}"
> > >                 artifactId="${artifact.id}"
> > >                 version="${artifact.version}"/>
> >
> > >
> > > </maven:dependencies>
> > >         <!-- The following does not fail, showing
> > > that a fileset
> > > reference has
> > >              actually been defined -->
> > >         <fail message="Reference
> > 'dependency.files'
> > > has not been set or
> > > is not a fileset reference.">
> > >             <condition>
> > >                 <not><isreference
> > > refid="dependency.files"
> > > type="fileset"/></not>
> > >             </condition>
> > >         </fail>
> > >         <!-- But the following task throws a
> > > NullPointerException -->
> > >         <pathconvert
> > > property="echo.dependency.files"
> > > refid="dependency.files"/>
> > >
> > > Raises the following NullPointerException:
> > >
> > > java.lang.NullPointerException
> > >         at
> > >
> >
> org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:115)
> > >         at
> > > org.apache.tools.ant.Task.perform(Task.java:348)
> > >         at
> > >
> > org.apache.tools.ant.Target.execute(Target.java:357)
> > >         at
> > >
> >
> org.apache.tools.ant.Target.performTasks(Target.java:385)
> > >         at
> > >
> >
> org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
> > >         at
> > >
> >
> org.apache.tools.ant.Project.executeTarget(Project.java:1298)
> > >         at
> > >
> >
> org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
> > >         at
> > >
> >
> org.apache.tools.ant.Project.executeTargets(Project.java:1181)
> > >         at
> > > org.apache.tools.ant.Main.runBuild(Main.java:698)
> > >         at
> > > org.apache.tools.ant.Main.startAnt(Main.java:199)
> > >         at
> > >
> >
> org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
> > >         at
> > >
> >
> org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
> > > Caused by: java.lang.NullPointerException
> > >         at
> > >
> >
> org.apache.tools.ant.types.AbstractFileSet.setupDirectoryScanner(AbstractFileSet.java:464)
> > >         at
> > >
> >
> org.apache.tools.ant.types.AbstractFileSet.getDirectoryScanner(AbstractFileSet.java:430)
> > >         at
> > >
> >
> org.apache.tools.ant.types.FileSet.iterator(FileSet.java:69)
> > >         at
> > >
> >
> org.apache.tools.ant.types.resources.Union.getCollection(Union.java:105)
> > >         at
> > >
> >
> org.apache.tools.ant.types.resources.Union.list(Union.java:67)
> > >         at
> > >
> >
> org.apache.tools.ant.taskdefs.PathConvert.execute(PathConvert.java:339)
> > >         at
> > >
> >
> org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
> > >         at
> > >
> > sun.reflect.GeneratedMethodAccessor5.invoke(Unknown
> > > Source)
> > >         at
> > >
> >
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> > >         at
> > > java.lang.reflect.Method.invoke(Method.java:585)
> > >         at
> > >
> >
> org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
> > >         ... 11 more
> > > --- Nested Exception ---
> > > java.lang.NullPointerException
> > >         at
> > >
> >
> org.apache.tools.ant.types.AbstractFileSet.setupDirectoryScanner(AbstractFileSet.java:464)
> > >         at
> > >
> >
> org.apache.tools.ant.types.AbstractFileSet.getDirectoryScanner(AbstractFileSet.java:430)
> > >         at
> > >
> >
> org.apache.tools.ant.types.FileSet.iterator(FileSet.java:69)
> > >         at
> > >
> >
> org.apache.tools.ant.types.resources.Union.getCollection(Union.java:105)
> > >         at
> > >
> >
> org.apache.tools.ant.types.resources.Union.list(Union.java:67)
> > >         at
> > >
> >
> org.apache.tools.ant.taskdefs.PathConvert.execute(PathConvert.java:339)
> > >         at
> > >
> >
> org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
> > >         at
> > >
> > sun.reflect.GeneratedMethodAccessor5.invoke(Unknown
> > > Source)
> > >         at
> > >
> >
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> > >         at
> > > java.lang.reflect.Method.invoke(Method.java:585)
> > >         at
> > >
> >
> org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
> > >         at
> > > org.apache.tools.ant.Task.perform(Task.java:348)
> > >         at
> > >
> > org.apache.tools.ant.Target.execute(Target.java:357)
> > >         at
> > >
> >
> org.apache.tools.ant.Target.performTasks(Target.java:385)
> > >         at
> > >
> >
> org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
> > >         at
> > >
> >
> org.apache.tools.ant.Project.executeTarget(Project.java:1298)
> > >         at
> > >
> >
> org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
> > >         at
> > >
> >
> org.apache.tools.ant.Project.executeTargets(Project.java:1181)
> > >         at
> > > org.apache.tools.ant.Main.runBuild(Main.java:698)
> > >         at
> > > org.apache.tools.ant.Main.startAnt(Main.java:199)
> > >         at
> > >
> >
> org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
> > >         at
> > >
> >
> org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
> > >
> > > Any idea if this is an incompatibility introduced
> > > with Ant 1.7.0 ?
> > >
> > > Thanks
> > >
> > >
> >
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> > > dev-unsubscribe@ant.apache.org
> > > For additional commands, e-mail:
> > > dev-help@ant.apache.org
> > >
> > >
> >
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Tired of spam?  Yahoo! Mail has the best spam
> > protection around
> > http://mail.yahoo.com
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > dev-unsubscribe@ant.apache.org
> > For additional commands, e-mail:
> > dev-help@ant.apache.org
> >
> >
>
>
>
>
> ____________________________________________________________________________________
> Need a quick answer? Get one in minutes from people who know.
> Ask your question on www.Answers.yahoo.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
> For additional commands, e-mail: dev-help@ant.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message