I have a NetBeans project that I’m trying to compile manually from command-line ant. When running on the same machine that has NetBeans installed, it works flawlessly.
However, if I run ant on a central continuous integration server (no NetBeans installed) it fails on a <copyfiles> task:
BUILD FAILED
/var/lib/jenkins/workspace/project_name/nbproject/build-impl.xml:697: Problem: failed to create task or type copyfiles
Cause: The name is undefined.
Action: Check the spelling.
Action: Check that any custom tasks/types have been declared.
Action: Check that any <presetdef>/<macrodef> declarations have taken place.
The target is in the auto-generated build-impl.xml, which looks something like this:
<target depends="init" name="library-inclusion-in-archive" unless="dist.ear.dir">
<copyfiles files="${file.reference.some_dependency.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
</target>
When I look at the ant manual, copyfiles isn’t even a proper ant task. So what’s up?
How can I get this to run on a machine with no NetBeans installation?
Per this advice, I verified the dependencies, and indeed the
lib/CopyLibsdirectory was not versioned in our source control repo. That’s why my local environment was able to compile, but the CI server wasn’t.After adding the dependency to the classpath –
org-netbeans-modules-java-j2seproject-copylibstask.jarspecifically – the ant build succeeded.On a personal note, I find it absurd that NetBeans needs an external dependency for a task that – trivially – exists as a standard
anttask.