1

I am trying to copy all the dependent jars mentioned in my pom.xml using an ant script. I am able to copy all the dependencies except for dependency with scope 'system' in my pom.xml

My pom.xml looks like this

<dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
    <version>3.8.1</version>
</dependency>
<dependency>
    <groupId>javafx</groupId>
    <artifactId>jfxrt</artifactId>
    <version>${java.version}</version>
    <scope>system</scope>
    <systemPath>${java.home}/lib/jfxrt.jar</systemPath>
</dependency>

My build.xml looks like this

<target name="resolve"   description="retrieve dependencies with maven">
    <artifact:pom id="pomfile" file="pom.xml" />
    <echo message="Resolving...........${container}"></echo>
    <artifact:dependencies filesetId="dependency.fileset"> 
       <pom refid="pomfile" />               
    </artifact:dependencies>

    <!-- Copy all dependencies to the correct location. -->
    <copy todir="${ant.project.name}/lib">
        <fileset refid="dependency.fileset"  />              
            <mapper type="flatten" />
    </copy>
</target>

The JUnit jar gets copied to the specfied lib directory, but jfxrt.jar is not getting copied.

Chad Nouis
  • 6,861
  • 1
  • 27
  • 28
samby
  • 11
  • 2
  • Why would you like to copy the artifacts with Ant task? What is the purpose? – khmarbaise Aug 27 '15 at 14:54
  • System scope is poorly understood at the best of times and Maven is a highly opinionated build tool. When called from ANT it makes no sense at all because as @khmarbaise has pointed out there is always the option to copy files. If you're attempting to have a single file that captures both local and remote dependencies in ANT I would suggest switching to the use of Apache ivy, which supports this use case. – Mark O'Connor Aug 27 '15 at 18:49
  • Ivy example: http://stackoverflow.com/questions/10175000/sample-example-which-explain-how-to-use-filesystem-resolver/10180491#10180491 – Mark O'Connor Aug 27 '15 at 18:50
  • I have multiple projects and want to create a build executable. Some of my projects are using ant and some maven. – samby Aug 28 '15 at 05:50

0 Answers0