Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8682395
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T21:45:40+00:00 2026-06-12T21:45:40+00:00

My project was constructed using Maven. I was happily building it with Maven. Now,

  • 0

My project was constructed using Maven. I was happily building it with Maven. Now, I need to build it with Ant (which I wish I needn’t!!!). I wish to use existing maven dependencies – i.e., wish to retain the pom for dependency management.

So, I wrote this task:

<target name="java.compile">
  <artifact:pom id="mypom" file="pom.xml" />
  <artifact:dependencies filesetId="mypomdeps" pomRefId="mypom" />

  <mkdir dir="build/classes" />

  <javac
    srcdir="${src.java.dir}"
    destdir="build/classes"
    includeantruntime="no">

    <classpath>
      <fileset refid="mypomdeps"/>
    </classpath>

  </javac>
</target>

However, the ant compilation output complains the libraries(in the jars) pointed to by mypomdeps are missing.

What are the reasons that javac was unable to see the classpath that I intended?

Am I using the filesetId generated by artifact:dependencies correctly?

My ant project defn:
I placed maven-ant-tasks-2.1.3.jar in the project basedir.

<project name="why-does-the-sun-go-on-shining"
  default="java.compile"
  xmlns:artifact="antlib:org.apache.maven.artifact.ant">

  <path id="maven-ant-tasks.classpath" path="maven-ant-tasks-2.1.3.jar" />
  <typedef
    resource="org/apache/maven/artifact/ant/antlib.xml"
    uri="antlib:org.apache.maven.artifact.ant"
    classpathref="maven-ant-tasks.classpath" />

Further Clarification

The gist of the question is … how to use my pom dependencies in my Ant javac task?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T21:45:41+00:00Added an answer on June 12, 2026 at 9:45 pm

    Would like to answer my own question to say that

    My ant targets and definition were correct. The refid to artefact dependencies are properly referenced.

    However, there were some system scope dependencies defined in the pom.

    antlib:org.apache.maven.artifact.ant would not resolve system scoped transitive dependencies. e.g.,

    <dependencies>
      <dependency>
        <groupId>sun.jdk</groupId>
        <artifactId>tools</artifactId>
        <version>LATEST</version>
        <scope>system</scope>
        <systemPath>${java.home}/../lib/tools.jar</systemPath>
      </dependency>
    </dependencies>
    

    Thanks to Oers’ getting me to debug the ant script by issuing echo elements.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using ant to build a project in eclipse. Before the jar is constructed,
I am using Maven framework to build my project and EJB 3.0 is the
I have constructed the following query using NHibernate which will give me a collection
I have a project in which I need a way to display essentially a
I need to upload a single image to server. The project is using .NET
I have a newly constructed Django project on a windows machine and am using
I have constructed a simple Rest service using ServiceStack (which is brilliant), that returns
I have a web project which the folders are constructed within the areas .
I am working on a school project using Spring MVC (Spring 3.0.0). Now everything
Hey guys, I'm building a project using Silverlight and the MVVM pattern, what I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.