简体   繁体   中英

How to get Netbeans 6.5 shareable libraries working

I created a Web application in Netbeans 6.5. Now I want to use the Joda Time library. I want to share this library via subversion, because I don't want my team mates to be dependend on some Netbeans configuration.

Just to get the project working, I first added the library to the Netbeans library (Tools->Library). This worked OK. The JAR is added to the classpath, and is also deployed.

But when I create a shared library (via Project Properties->Libraries->Browse/New Libraries Folder), the JAR is not in the classpath. I get the error message package org.joda.time does not exist on the code import org.joda.time.* .

Any ideas?

What is the scope of this library? Is this library used for just this particular web-application?

If so, can we put the library in the WEB-INF/lib directory and check that into subversion as well?

Libraries in the WEB-INF/lib directory should be automatically added to the classpath of the project.

Here is what I did:

  • Tools -> Library -> New Library...

    • called the library joda-time
    • add added the joda-time-1.6.jar file to it
  • Project -> Properties -> Libraries

    • under the compile tab
      • Add library...
      • selected joda-time

(Edit, think I see the issue now - but perhaps not).

You need to add the library to the compile libraries AND add it to the distribution libraries. Or am I misunderstanding the question?

This blog entry describes a hack that worked in NetBeans 5. I don't know if it will work in NetBeans 6.5. I also don't know if this will work if you are building files nightly on a server.

http://blogs.oracle.com/gjmurphy/entry/using_netbeans_free-form_projects_as

I remember setting up shared libraries like this 8 years ago in JBuilder. I wish Netbeans had it by now.

when creating a 'new project', there is an option to enable 'dedicated folder for libraries'. That way, the libraries will also be committed to the repository and your peer developer can checkout your project with all the libraries, your project has dependencies upon, thereby eliminating netbeans configuration bound.

In scenario where a project depends on JARs which can be placed in different locations for different users, a named IDE variable can be used.

http://wiki.netbeans.org/NewAndNoteWorthyNB65#section-NewAndNoteWorthyNB65-VariableBasedPathsInJ2SEJ2EEProjects

Another option would be to use the Maven plugin which already works quite well in NetBeans 6.5. A Intranet repository for the Artifact Jar files could be placed on a file server, or managed through a Maven Proxy like Nexus.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM