Search code examples
javasvnjarantbuild.xml

Ant execution different depending on svn export


I have an ant build.xml script. In order to run my application, it requires external libraries.

I am able to successfully run ant clean jar in the command prompt, and in the -do-jar-copylibs function the libraries are copied, the jar is built, and the jar can be ran by java -jar jarfile.jar This is ran on code that I have extracted manually from svn.

The issue comes when I use a script to svn export the code and build file from svn to the C:/temp directory and then run ant clean jar the build of the application happens in -do-jar-jar instead of the -do-jar-copylibs . It doesn't copy all the libraries into the dist folder, it just builds the jar and tells me that the jar can be ran using java -jar "lots/of/libraries.jar" jarfile.jar mainclass

Does this have to do with permissions? I cannot find any answers to how to fix this. Maybe there is a way to set permissions of svn export

Any help is appreciated

Thanks.


Solution

  • Figured it out.

    The -do-jar-copylibs function relies on the libs.CopyLibs.classpath property being set, if it is set correctly, the condition property="do.mkdist" will result in true, which triggers the -do-jar-copylibs funciton. If the condition property="do.mkdist" is false, then the -do-jar-jar will run instead.

    This classpath being set has to do with the nbproject/private.properties file. If I added the private directory to my svn export, the build packaged correctly. Another workaround is to define the classpath in your project.properties file.