Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
-
Mac OS X 10.4.2, Java 1.4.2
Description
The ant artifact:dependencies task adds entire local repo to classpath if no dependencies are specified. For example, my build.xml contains this:
<typedef resource="org/apache/maven/artifact/ant/antlib.xml" uri="urn:maven-artifact-ant">
<classpath>
<pathelement location="lib/maven-artifact-ant-2.0-alpha-3-dep.jar" />
</classpath>
</typedef>
<artifact:dependencies filesetId="runtime.fileset">
</artifact:dependencies>
<path id="compile.classpath">
<fileset refid="runtime.fileset"/>
</path>
<target name="compile" description="==> Compile all the .java files">
<mkdir dir="${obj}"/>
<javac srcdir="${src}"
destdir="${obj}"
source="1.4"
deprecation="on"
debug="on">
<classpath refid="compile.classpath"/>
</javac>
</target>
This causes all .jars in the ~/.m2/ repo to be added to the class path. Kenny Westerhof wrote this in the users-list thread "Ant Maven2 Tasks include all .jars in local repo?":
----------------
It could be described as a bug: what the task does is
create an ant FileSet object. Since you defined no dependencies,
it's the same as <fileset id="runtime.fileset" dir="${localRepository}"/>
(where ${localRepository} = ~/.m2/repository).
I guess the default ant implementation for FileSet has an include
filter of */ and no exclude filter.
As soon as you specify 1 dependency it will override the default include
and put the referenced jar in there.
------------------