27 February 2014

Removing an unresolved library reference from a netbeans project

When netbeans (v7) opens a project containing a library that is not in its libraries collection,
it proposes you to resolve the issue by creating this library.
Sometimes you do not need the library that is missing (e.g. because you have another library that you'd like to use instead).
You'd like to remove it, but that option is not proposed.
We'll need to play with netbeans project file to achieve this.

  1. Close the project.
  2. Navigate to the nbproject subdirectory of your project directory.
  3. Make a backup copy of  project.properties, just in case.
  4. Open project.properties and remove references to the library. For example to remove the "hibernate-persistence" library, you'll need to change
    javac.classpath=\
        ${libs.hibernate-persistence.classpath}
    to
    javac.classpath=