The Couchebase Java Client is a library for other clients to implement. The Couchbase team uses Ant to test and create the JAR, while using both Ivy and Maven for dependency related tasks. In other words, a highly customized project structure. How to set it up in NetBeans IDE? The end goal is this:
I.e., no red error marks, and [which you can't see above], code completion working, as well as compilation of the application. Also, the ability to run single test classes is a requirement.
Therefore, use the Java Free-Form Project Type and point to the root folder of the download, once you've got it from Git:
Spend some time configuring the project, with this end result:
Below, for the Source Packages, select all the JARs from build/ivy/lib/couchbase-client/common. Then, for the Test Packages, select all JARs from build/ivy/lib/couchbase-client/common AND from build/jars/*.jar:
Everything below is defined as you see it by default, except for the mapping of "jar" to Build Project and "mvn-install" to Run Project:
What's great is that all these configurations have no impact on the original build.xml file. Nevertheless, one small, but very important, tweak should be done to the 'clean' target in the build.xml file, so that the "nbproject" file is not deleted when clean target is run.
Next, let's make it possible to, as requested, provide the ability to run individual test classes. In the project.xml file, add this to the ide-actions section:
Then create a new file named ide-file-targets.xml in the same folder as where project.xml is found and define it as follows:
<?xml version="1.0" encoding="UTF-8"?>
<project basedir=".." name="couchbase-client-IDE">
<fail unless='classname'>Must set property 'classname'</fail>
<ant antfile="build.xml" inheritall="false">
<formatter type='brief' usefile='false'></formatter>
Better than the above is to use "Automatic Projects", which works fine in 7.3:
I will blog about this soon, works perfectly with Couchbase Java Client Library.