Project with sharable libraries (AKA How to avoid broken references)

Till now:

If you tried to share with someone your NetBeans project, where you depend on some libraries that you've defined in IDE, you probably received complains: "Your project does not work for me, I've got there broken references, everything's red underlined,.....and...I don't have time to do some tweaking, resolving...ummmm....maybe I'm not so interested in your project..:-)" Well, that's because your friend's IDE was missing definitions of libraries, that your project needs to work.

Since now:

If you share your NetBeans project (e.g. using VCS), your friend just simply checks out your project and libraries with their definitions. Project is then ready to use out of the box.

Example of typical workflow:

  1. Create you project under some versioned folder. When creating project, don't forget to check Project Shared With Other Users checkbox. Do not change location for sharable libraries, it's good to have them on the same level as project folder(s).
  2. Add dependencies on libraries that your project needs. Notice that when you invoke Add library on your project, you are operating with shared libraries (i.e. libraries stored in location you defined), not global libraries. Good practice is that when you are adding new library into shared location, choose that you want to copy library JAR(s) into shared location. It ensures that definitions and JARs are physically at the same location.
  3. Once you do some coding, it's time to check in your sources into VCS. Notice that also newly added libraries are offered for commit.
  4. That's it! If someone checks out your project (as well as libraries folder as location for shared libraries), project is ready to use out of the box.

TIP: If you have some projects created by NetBeans 6.0 and you want to make them sharable, there's a wizard which can make project to use sharable libraries. Just go to project properties, and on Libraries panel you'll see Make sharable... button. This button triggers a wizard, which switches your project into sharable concept and imports necessary libraries to your shared location.

For those who are interested here is some documentation of this great new feature. Feel free to try it out in NetBeans 6.1 Beta.

Comments:

It is great to see your first blog entry, Tomasi. Hopefully it is not your last:-)

Posted by .JARa on březen 14, 2008 at 08:42 dop. CET #

+1 ;-)

Posted by Petr Chytil on březen 15, 2008 at 03:09 dop. CET #

Very thorough and comprehensive blog entry. I knew about this feature, but haven't tried it out myself before. Now, it's simple and I know exactly how it's supposed to work. Awaiting other entries.

Jacek

Posted by Jacek Laskowski on červenec 21, 2008 at 05:47 dop. CEST #

Well, the blog entry was created \*before\* the UI freeze of 6.1, when this feature was in development phase. There were some UI changes, however the base idea of sharable concept works and is not changed. So, to keep this a little bit up-to-date:

1) Make sharable button = Browse button nearby Libraries folder textfield (this one should invoke the wizard to turn your old project into sharable one)
2) Project shared with other users checkbox = Use dedicated folder for Storing Libraries checkbox.
3) Default location of libraries folder was "../libs" (i.e. libraries modules is on the same level as project folders), now it is "./libs" (libraries folder is inside of project folder).

All these changes were done after communication with HIE (Human Interface Engineers) and should help new users to understand better this feature and to match most common usecases.

Posted by TM on červenec 22, 2008 at 07:57 dop. CEST #

Post a Comment:
  • HTML Syntax: NOT allowed
About

Tomas Musil

Search

Archives
« duben 2014
PoÚtStČtSoNe
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
    
       
Today