Pátek III 14, 2008

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.

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