I tend to upload my complete project into version control. This includes the sources, tests, Jars and also the nbproject directory where NetBeans stores the project configuration. By doing so, I can check out the project on a different machine and start quickly without having to configure the project.
Sources and API Docs of external libraries are not commited as they’re are not requried for compiling. I usually keep sources and docs in a separate place outside my project (let’s say
When I check out the project on a different machine I can do coding but I do have neither the sources nor the API docs. Even worse: as I’ve commited the whole project including the configuration, I have also commited the nbproject/project.properties file which stores the pathes to the source and docs. Which is not a problem if the pathes on all the machines are the same. But when a new contributer wants to join in, (s)he either has to use the same directory structure (and possibly the same OS) or he has to overwrite the settings. Both not very desirable.
But this issue can be solved in some ways – some more or less convenient:
- Don’t care about it. Download the sources and docs for each JAR and edit the source and API doc links manually and relink them. That’s inconvenient.
- Bundle sources and Docs in a single Zip which is provided as a separate download (or repository). Then just set up a rule that this zip MUST be unpacked into a certain directrory. Inconvenient as well as you try to dictate the directory structure.
- Use the NetBeans Library feature (Tools > Libraries) to bundle libs, docs and sources. Unfortunately I have not yet discovered a way to share these Libraries. So that’s inconvenient as well!
The optimal solution (for me): Use a NetBeans variable for the path
- Put the Jars, sources and docs in a separate directory like
- Create a downloadable archive with all the files (sources and docs) and make it accessible.
- Create a NetBeans Variable: Tools > Variables > Add
- Name: “
- Location: “the location where you put all your libs”,
<userdir>javaLibsin my case
- When importing a new JAR into your project, put the jar into your project’s
- Copy API and sources into subdirectory under
- link API and sources in NetBeans by using the option:
Project Properties > Libraries > select the Jar > Edit > Browse > hit the “…” button besides “Path from Variable” and select the file or folder
A new conributor just needs to
- check out the project
- create a
libDirNetBeans variable pointing to a certain directory
- check out/download the API/Src and unpack it into