Search code examples
javanetbeans

Netbeans build fails "Not copying library" /path/to/${libs.log4j.classpath} , it can't be read


I'm using Netbeans IDE 8.2, trying to build a "legacy application" after some updates.

The compile is finishing ok, but then NetBeans is packaging up stuff in dist/, and encounters some missing library issues:

Copying 1 file to /path/to/Project/build
Not copying library /path/to/Project/${libs.log4j.classpath} , it can't be read.
Not copying library /path/to/Project/${libs.ApacheCommonsCLI.classpath} , it can't be read.
Not copying library /path/to/Project/${libs.BoneCP.classpath} , it can't be read.

It refused to copy some other libraries, but these had exact path in the error messages, so I could just put the .JARs where it wanted them. I have already added some JARs to the source-tree under "Libraries", and this helped the compile succeed. But it doesn't seem to use these for this operation.

How do I provide NetBeans these files? Where does ${libs... refer to?

EDIT: I found that text in a subfolder/project.properties:

libs.ApacheCommonsNet.classpath=../Apache/Commons/commons-net-1.4.1/commons-net-1.4.1.jar
...
javac.classpath=\
    ${libs.ApacheCommonsNet.classpath}:\
    ${libs.log4j.classpath}:\
    ${libs.ApacheCommonsCLI.classpath}:\
    ${libs.MySQLDriver.classpath}:\
    ${libs.BoneCP.classpath}:\
    ...

So it's not complaining about ApacheCommonsNet because there is a hard-coded path further up in the properties. Maybe I can add one for each missing library.


Solution

  • The problem is resolved by configuring NetBeans Libraries under [Tools]->[Libraries].

    To resolve say the ${libs.ApacheCommonsCLI.classpath} dependency, I added a library named "ApacheCommonsCLI", then for that entry added the JAR "commons-cli-1.2.jar" via the button [Add JAR/Folder...].

    The dependency starting with the test ${libs. is an indicator that it is looking for it here.