How do Netbeans and Subversion interact well with libraries?

I find it difficult to determine how to add .jar / library to a Netbeans project so that I can transfer it to the repository.

The typical way to add a library (according to the Netbeans docs I already went through) ends up being just local to me. Anyone who validates my project skips my required library.

Inserting it manually and trying to work with Netbeans causes Netbeans to freeze when trying to scan a project ...

So, how can I tell Netbeans to pick up the jar as a library and include it in my project so that Subversion can handle it?

+4
source share
7 answers

OK, the working solution I just moved is to extract the class files from the jars and dump them into the source package area. Then everything becomes attached to the repository, and also avoids dealing with the processing of a separate "lib" directory during the deployment phase.

This solution does everything that I am looking for, but I feel very dirty when I do this. It just seems terribly broken and wrong ... :-)

0
source

There are several ways to fix this.

a. When you define your library, use the path to the common place. A location that is identical on each machine — for example, the location of the JAR installed with a third-party application in Program Files or / usr / local / works well or a network drive.

Then, when they check the code, the path will still be correct, and they don’t need to define the library in the Netbeans workspace.

C. Modify the project.properties file to use the relative path. Open the project.properties file and find " libs.LIBRARY_NAME.classpath=... ". This will be the "default location" if the library is not defined.

Modify this to use the path relative to your project and store the jar files in your project. For example: libs.Log4J.classpath=lib/log4j.jar

Keep in mind that the library definition in your library manager will override this value - make sure you keep them in sync (for example, add the version number to the library name!).

C. Use the Vincent suggestion to use a build system such as Maven. The Maven build process will handle dependency loading, etc. Netbeans has plugins for several popular build systems.

+2
source

NetBeans 6.5 introduces a new feature (paths in projects based on variables) that should make this easier.

See details http://wiki.netbeans.org/NewAndNoteWorthyNB65#section-NewAndNoteWorthyNB65-VariableBasedPathsInJ2SEJ2EEProjects . Please note that the screenshot contains variable links in the library customizer.

+2
source

Not quite the answer to your question, but ... as a rule, you should not include these libraries in your subversion repository. Generally, there is no need to manage them. You might want to create a central repository similar to what happens with maven. If you are using maven, you can create a local library repository on the server available to the team. Dependencies on these libraries are entered in the pom.xml file, and this is in the subversion repository. Now that team members are verifying code from subversion, they all have access to the maven repository.

[I am looking for a link to this right now. When I find this, I will edit this answer.]

+1
source

I am using NetBeans IDE 6.5.1, and the best solution I have found so far is to include the required libraries from your local host, and then change their paths to relative ones. After that, you must manually remove the libraries from NetBeans file explorer , and then copy them from your OS location to your computer manually into the file explorer again. In this way, NetBeans detects the change, and you can transfer it to the repository.


Note. I highly recommend cleaning up and re-creating the project after the upgrade.

+1
source

An easy way to combine your lib / jars libraries into your project so that subversion “just handles it” so that you can capture it with all attached libraries ready for compilation and transition to include them in the project directory via the “shared libraries” parameter, managing the library folder.

When creating a new project, you can specify "Use a dedicated folder to store libraries" and then use the estimated relative path. \ lib. If you have an existing project, you can edit its properties, the category "Libraries" and "Browse Library Folders". Again, the first launch will suggest. \ Lib, and then prompts you to copy the existing dependencies to this folder. These graphical actions should give similar results to James Shek's "B" answers.

Lock the project with the new libraries added in. \ lib, and you should be able to check and build from anywhere and know that you will have the same libraries (in the same version) that you had when you last built and completed.

I do not know how long this feature has been in NetBeans. For more details see:

http://netbeans.org/kb/docs/java/project-setup.html#projects-shared-libraries

+1
source

In the end, I just downloaded my own set and put them on my local drive for this project. I set up my Netbeans to look there, and warned the other guys what I did ... In the end, we will need to do something more scalable, though ... :-)

0
source

All Articles