I am very new to Ant (I came from Maven) and I am finding many problem to do the following operation.
I have a main project named CrystalIceGUI that use another dependency project named ShellExtBridge.
The dependency project ShellExtBridge have an own build.xml file that compile the project and pack it into a jar file putted into a direcotry named Release
The main project CrystalIceGUI have its build.xml ant file that contain a target named init that try to execute the build.xml file of the ShellExtBridge depency project to build this project and, later, use its jar in another target.
The problem is that if I execute the build.xml ant script of ShellExtBridge it work well and the jar file is correctly created into its Release directory (so I think that this ant script is ok) but if I call it from the build.xml of the main project it give me a long series of errors.
This is the build.xml of the ShellExtBridge dependency project:
<?xml version="1.0"?>
<project default="default">
<!-- ============================================ -->
<!-- Load build properties -->
<!-- ============================================ -->
<property name="project.buildfile" value="build.num" />
<property file="${project.buildfile}" />
<property file="info.properties" />
<!-- ============================================ -->
<!-- The default target -->
<!-- ============================================ -->
<target name="default" depends="jar" />
<!-- Elimina le cartelle contenenti le classi compilate ed i jar -->
<target name="clean">
<echo message="Into ShellExtBridge build.xml clean target"/>
<delete dir="../Release" />
<!-- Elimina directory del jar finale -->
<delete dir="bin" />
<!-- Elimina directory delle classi compilate -->
</target>
<!-- Contiene i task di COMPILAZIONE:
1) Crea la directory "bin/" nel progetto
2) Compila tutte le classi dentro la cartella "src" del progetto e mette i risultanti .class
dentro "bin"
-->
<target name="compile" depends="clean">
<echo message="Into ShellExtBridge build.xml compile target"/>
<mkdir dir="bin" />
<javac srcdir="src" destdir="bin" />
</target>
<target name="jar" description="Packs classes of shellextbridge" depends="compile">
<echo message="Into ShellExtBridge build.xml jar target"/>
<jar destfile="../Release/shellExtBridge.jar" index="false">
<fileset dir="bin" />
<manifest>
<attribute name="Created-By" value="${info.software.author}" />
<attribute name="Main-Class" value="com.techub.crystalice.rmi.Main" />
</manifest>
</jar>
</target>
</project>
And this is the init target of the build.xml file of the main project CrystalIceGUI:
<target name="init">
<ant antfile="${basedir}../../../ShellExtBridge/Project/build.xml" />
</target>
If I go to execute the init target of this ant script I obtain these errors:
Buildfile: /home/andrea/Documenti/XCloud/Implementazione/CrossPlatform/CrystalIceGUI/Project/build.xml
init:
clean:
[echo] Into ShellExtBridge build.xml clean target
[delete] Deleting directory /home/andrea/Documenti/XCloud/Implementazione/CrossPlatform/CrystalIceGUI/Project/bin
compile:
[echo] Into ShellExtBridge build.xml compile target
[mkdir] Created dir: /home/andrea/Documenti/XCloud/Implementazione/CrossPlatform/CrystalIceGUI/Project/bin
[javac] /home/andrea/Documenti/XCloud/Implementazione/CrossPlatform/ShellExtBridge/Project/build.xml:37: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
[javac] Compiling 117 source files to /home/andrea/Documenti/XCloud/Implementazione/CrossPlatform/CrystalIceGUI/Project/bin
[javac] /home/andrea/Documenti/XCloud/Implementazione/CrossPlatform/CrystalIceGUI/Project/src/com/techub/crystalice/utils/QuickLocale.java:8: package org.apache.log4j does not exist
[javac] import org.apache.log4j.Logger;
[javac] ^
[javac] /home/andrea/Documenti/XCloud/Implementazione/CrossPlatform/CrystalIceGUI/Project/src/com/techub/crystalice/fuse/AtmosFuseWrapper.java:8: package org.apache.log4j does not exist
[javac] import org.apache.log4j.Logger;
[javac] ^
[javac] /home/andrea/Documenti/XCloud/Implementazione/CrossPlatform/CrystalIceGUI/Project/src/com/techub/crystalice/fuse/AtmosFuseWrapper.java:11: package com.techub.crystalice.jaxb.settings does not exist
[javac] import com.techub.crystalice.jaxb.settings.DriveType;
[javac]
...............................................................................
...............................................................................
ETCETCETC MANY OTHERS SIMILAR ERRORS
...............................................................................
...............................................................................
BUILD FAILED
/home/andrea/Documenti/XCloud/Implementazione/CrossPlatform/CrystalIceGUI/Project/build.xml:70: The following error occurred while executing this line:
/home/andrea/Documenti/XCloud/Implementazione/CrossPlatform/ShellExtBridge/Project/build.xml:37: Compile failed; see the compiler error output for details.
As you can see seems that the build.xml ant script of the dependency ShellExtBridge project is called because the echo messages of this ant script are shown.
But there is something strange because when the build.xml script of the ShellExtBridge is called execute these operations:
[echo] Into ShellExtBridge build.xml clean target [delete] Deleting directory /home/andrea/Documenti/XCloud/Implementazione/CrossPlatform/CrystalIceGUI/Project/bin compile: [echo] Into ShellExtBridge build.xml compile target [mkdir] Created dir: /home/andrea/Documenti/XCloud/Implementazione/CrossPlatform/CrystalIceGUI/Project/bin [javac] /home/andrea/Documenti/XCloud/Implementazione/CrossPlatform/ShellExtBridge/Project/build.xml:37: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
It delete this directory /home/andrea/Documenti/XCloud/Implementazione/CrossPlatform/CrystalIceGUI/Project/bin instead the correct directory that is the one related to the bin directory inside the ShellExtBridge project.
Seems like that, when it call the ant file of the ShellExtBridge project, lost its references and do the operations on the folder of the main project and not of the right project.
Do you have some ideas about to solve it?