Wednesday, February 24, 2010

Sharing source files across the projects in Nebeans 6.5 or above.

I observed a strange problem using netbeans ,when I tried to use the source files that are already used by other projects. I get an exception “Package folder already used in project”. As per the netbeans it is correct, because we are trying to use the source folder that is already used by other project. But there are few situations that demands us to do so.
For example we have code in folder “c1”; it has to be shared by two projects p1 and p2

Include the code “c1” by going to project ”p1” ->properties->sources->Source PackageFolders->add folder
Add the c1 code to p1 source

If you are trying to add “c1” again to project “p2” it give you an error “Package folder already in use by project p1”. To overcome this.

Add the parent folder of “c1” (i.e) c0 to project “p2” by properties->sources->Source PackageFolders->add folder

• Open the file “project.properties” of p2 at “p2\nbproject\ project.properties”
• Search for the string “src.c0.dir=${file.reference.c-c0}”
• Replace the value of file.reference.c-c0 with actual code folder “c1”
• Example file.reference.c-c0=\home\c\c0\c1
• Save the file project.properties

Hope this help . I spent 3 hours in figuring this out, But its worth to document by spending 30 min more 


Thanks & Regards
Balaji Chopparapu

No comments:

Post a Comment

Followers