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 6920243
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:07:22+00:00 2026-05-27T10:07:22+00:00

I have an Ant build script to generate some classes. The process requires an

  • 0

I have an Ant build script to generate some classes. The process requires an external library. Since I need this task for a lot of different modules I don’t want to copy the lib everytime and I don’t want to reference it localy as that would require all developers to download the lib first.
How do I reference and include an external resource?
This is my setup so far

<project name="generate" basedir=".">

    <property name="src" location="src/main/java"/>
    <property name="generated" location="target/classes"/>
    <property name="build" location="src/main/java"/>

    <path id="cp">
        <fileset dir="path/to/lib" includes="**/querydsl-jpa-2.2.3-apt-one-jar.jar"/>
    <fileset dir="path/to/.m2" includes="**/*.jar"/>
    </path>


  <target name="compile" >
    <!-- Compile the java code from ${src} into ${build} -->
    <javac srcdir="${src}" classpathref="cp" includeantruntime="false">
      <compilerarg value="-proc:only"/>      
      <compilerarg value="-processor"/>
      <compilerarg value="com.mysema.query.apt.QuerydslAnnotationProcessor"/>
      <compilerarg value="-s"/>
      <compilerarg value="${generated}"/>
    </javac>

    <!-- compilation -->
    <javac classpathref="cp" destdir="${build}" includeantruntime="false">      
      <src path="${src}"/>
      <src path="${generated}"/>
    </javac>  
  </target>

</project>

Now I have the querydsl-jpa-2.2.3-apt-one-jar.jar at some remote location and I also want to reference our internal maven repository instead of the local .m2 directory, so I need to reference remote locations and include the libraries from there.

  • 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-05-27T10:07:22+00:00Added an answer on May 27, 2026 at 10:07 am

    I would suggest you use the Apache Ivy Ant plug-in. It can help you in two ways:

    1. Ivy can download libraries in the same manner as Maven
    2. Your library is already available from Maven Central (No need to store it on your own website)

    Developers using your project will only require the Ivy jar installed into one of the following locations:

    • $HOME/.ant/lib
    • $ANT_HOME/lib

    build.xml

    The Ivy resolve task downloads (and caches) dependencies (found in the ivy.xml file). The cachepath task automatically populates the classpath:

    <project name="generate" basedir="." xmlns:ivy="antlib:org.apache.ivy.ant">
    
        <property name="src" location="src/main/java"/>
        <property name="generated" location="target/classes"/>
        <property name="build" location="src/main/java"/>
    
        <target name="resolve" >
            <ivy:resolve/>
            <ivy:cachepath pathid="cp" conf="compile"/>
        </target>
    
        <target name="compile" depends="resolve">
        ..
    

    ivy.xml

    Dependencies are declared here:

    <ivy-module version="2.0" xmlns:e="http://ant.apache.org/ivy/extra">
    
        <info organisation="com.myspotontheweb" module="demo"/>
    
        <configurations defaultconfmapping="compile->default"/>
        
        <dependencies>
            <!-- Your jar -->
            <dependency org="com.mysema.querydsl" name="querydsl-jpa" rev="2.2.3" >
                <artifact name="querydsl-jpa" type="jar" m:classifier="apt-one-jar"/>
            </dependency>
    
            <!-- Other Maven dependencies -->
            <dependency org="commons-lang" name="commons-lang" rev="2.6"/>
            ..
    
        </dependencies>
    
    </ivy-module>
    

    The querydsl-jpa-2.2.3-apt-one-jar.jar jar is special needs an additional classifier specification. If it was a Maven dependency it would be declared as follows:

    <dependency>
        <groupId>com.mysema.querydsl</groupId>
        <artifactId>querydsl-jpa</artifactId>
        <version>2.2.3</version>
        <classifier>apt-one-jar</classifier>
    </dependency>
    

    ivysettings.xml

    Ivy can be configured to use your Maven repository (Just like a Maven client):

    <ivysettings>
        <settings defaultResolver="maven-repo"/>
        <resolvers>
            <ibiblio name="maven-repo" m2compatible="true" root="http://myrepo.mycompany.com/maven-central-proxy"/>
        </resolvers>
    </ivysettings>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some automatically generated Ant build scripts that I need to use to
I currently have this in my Ant build script: <exec dir=${basedir} executable=perl> <arg line=${basedir}/version.pl
I have an ant build script that needs to pull files down from a
I have a Java project that I build using an Ant script. I am
We have inherited an ant build file but now need to deploy to both
I have an Ant script that performs a copy operation using the 'copy' task
I have an ant build.xml file with XJC task definition: <taskdef name=xjc classname=com.sun.tools.xjc.XJCTask> <classpath>
Let's suppose I have a valid Ant build script which packs up and prepares
We have an ant build script for a project we're developing for a PDA.
I have following target in mz ant script to build my java application <target

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.