简体   繁体   中英

Ant build using two projects

I have two separate projects inside of eclipse: "project" and "pinclude"

Project includes pinclude, so without somehow include the java files for that project inside of my build.xml, javac will always return errors.

How do I got about including .class files inside of ant/javac? I've tried searching for a solution, but so far I've only came up with ways of adding jar files. Would creating a jar of all the "pinclude" .class files fix my problem?.

Thank you for your help.

NOTE :

I'm sorry for the poor naming convention; These are just projects I made to figure out this problem out.

Also, please ignore srcdir and destdit, they are not important.

Build.xml

<project name="project" basedir="." default="dist" >
<target name="dist" >
    <javac destdir="bin" 
        srcdir="${basedir}\myfileslocation\" >
    </javac>
</target>

I'm not 100% sure what you need. Are you saying that you have class files from pininclude , and you need to include them in your <javac> compile task? It would be something like this:

<javac destdir="bin"
    srcdir="${basedir}/myfileslocation">
    <classpath>
        <pathelement path="${path.to.pininclude.javac.files}"/>
    </classpath>
</javac>

How do I got about including .class files inside of ant/javac? I've tried searching for a solution, but so far I've only came up with ways of adding jar files. Would creating a jar of all the "pinclude" .class files fix my problem?.

Yes. It helps to separate functionality into smaller modules. If you export one project (pinclude in this case) into a jar and import(via classpath) in another , that is the most correct step.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM