[ 
http://jira.codehaus.org/browse/MANTTASKS-197?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Knut Forkalsrud updated MANTTASKS-197:
--------------------------------------

    Attachment: MANTTASKS-197.zip

Attached is a more comprehensive example.
It is just some silly code to test.
When I fork the junit task to execute the unit test I get the annoying stack 
trace.

There are maven2 build files as well as ant build files.
Extract the archive somewhere, cd into MANTTASKS-197 and run
{{mvn clean test}}
{{ant clean test}}
and compare.

> Dependency with packaging=pom shows up in the classpath
> -------------------------------------------------------
>
>                 Key: MANTTASKS-197
>                 URL: http://jira.codehaus.org/browse/MANTTASKS-197
>             Project: Maven 2.x Ant Tasks
>          Issue Type: Bug
>          Components: dependencies task
>    Affects Versions: 2.1.1
>         Environment: Mac OSX, Ant 1.8.1
>            Reporter: Knut Forkalsrud
>         Attachments: MANTTASKS-197.zip
>
>
> My use case is that I have a set of common dependencies that I use across 
> many projects.
> In order to save me some typing I created a pom whose sole purpose is to 
> depend on all
> the common dependencies, so that each of my projects can depend on only this 
> one pom.
> The problem is that the pom file gets included in the classpath, an the junit 
> task shows
> an annoying error because it can't make sense of it as a directory or jar 
> file.
> A relatively simple testcase to show the issue is this pom.xml:
> {code:xml}<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
> http://maven.apache.org/xsd/maven-4.0.0.xsd";
>          xmlns="http://maven.apache.org/POM/4.0.0";
>          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";> 
>     <modelVersion>4.0.0</modelVersion> 
>     <groupId>foo</groupId>
>     <artifactId>bar</artifactId>
>     <version>1.0</version>
>     <dependencies>
>         <dependency>
>             <groupId>asm</groupId>
>             <artifactId>asm-parent</artifactId>
>             <version>3.1</version>
>             <type>pom</type>
>         </dependency>
>     </dependencies>
> </project>
> {code}
> An the following build.xml in the same directory:
> {code:xml}
> <?xml version="1.0" encoding="UTF-8"?>
> <project name="foo" default="test" 
> xmlns:artifact="antlib:org.apache.maven.artifact.ant">
>     <target name="test">
>         <artifact:pom file="${basedir}/pom.xml" id="maven.project"/>
>         <artifact:dependencies pathId="maven2.test.classpath" 
> filesetId="test.fileset">
>             <pom refid="maven.project"/>
>         </artifact:dependencies>
>         <echo>${toString:maven2.test.classpath}</echo>
>     </target>
> </project>
> {code}
> When I run this I expect the output from <echo> to list the classpath 
> consisting of the jars dependencies from {{asm-parent}}.  That pom happens to 
> have no jar dependencies, so I expect the output to be empty.  Instead I get 
> the path of the pom file.
> In a more realistic example I will use this as a classpath argument to 
> <junit> and get an error like:
> {noformat}
> Unable to obtain resource from 
> /Users/knut/.m2/repository/asm/asm-parent/3.1/asm-parent-3.1.pom: 
> java.util.zip.ZipException: error in opening zip file
>     [junit] Unable to obtain resource from 
> /Users/knut/.m2/repository/asm/asm-parent/3.1/asm-parent-3.1.pom: 
>     [junit] java.util.zip.ZipException: error in opening zip file
>     [junit]   at java.util.zip.ZipFile.open(Native Method)
>     [junit]   at java.util.zip.ZipFile.<init>(ZipFile.java:114)
>     [junit]   at java.util.jar.JarFile.<init>(JarFile.java:135)
>     [junit]   at java.util.jar.JarFile.<init>(JarFile.java:99)
>     [junit]   at 
> org.apache.tools.ant.AntClassLoader.getResourceURL(AntClassLoader.java:1002)
>     [junit]   at 
> org.apache.tools.ant.AntClassLoader$ResourceEnumeration.findNextResource(AntClassLoader.java:145)
>     [junit]   at 
> org.apache.tools.ant.AntClassLoader$ResourceEnumeration.<init>(AntClassLoader.java:109)
>     [junit]   at 
> org.apache.tools.ant.AntClassLoader.findResources(AntClassLoader.java:949)
>     [junit]   at 
> org.apache.tools.ant.AntClassLoader.getNamedResources(AntClassLoader.java:918)
>     [junit]   at 
> org.apache.tools.ant.loader.AntClassLoader5.getResources(AntClassLoader5.java:54)
>     [junit]   at 
> org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.checkForkedPath(JUnitTask.java:1135)
>     [junit]   at 
> org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.executeAsForked(JUnitTask.java:1011)
>     [junit]   at 
> org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.execute(JUnitTask.java:811)
>     [junit]   at 
> org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.executeOrQueue(JUnitTask.java:1808)
>     [junit]   at 
> org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.execute(JUnitTask.java:760)
>     [junit]   at 
> org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
>     [junit]   at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
>     [junit]   at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>     [junit]   at java.lang.reflect.Method.invoke(Method.java:597)
>     [junit]   at 
> org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
>     [junit]   at org.apache.tools.ant.Task.perform(Task.java:348)
>     [junit]   at org.apache.tools.ant.Target.execute(Target.java:390)
>     [junit]   at org.apache.tools.ant.Target.performTasks(Target.java:411)
>     [junit]   at 
> org.apache.tools.ant.Project.executeSortedTargets(Project.java:1397)
>     [junit]   at org.apache.tools.ant.Project.executeTarget(Project.java:1366)
>     [junit]   at 
> org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
>     [junit]   at 
> org.apache.tools.ant.Project.executeTargets(Project.java:1249)
>     [junit]   at org.apache.tools.ant.Main.runBuild(Main.java:801)
>     [junit]   at org.apache.tools.ant.Main.startAnt(Main.java:218)
>     [junit]   at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
>     [junit]   at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
> {noformat}
> When I read MANTTASKS-41 I can't help but think it revolves around the same 
> culprit, but I'm not expert enough to pinpoint the issue.

-- 
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

        

Reply via email to