How can I build a Netbeans RCP application with SBT?

59 views Asked by At

Netbeans RCP application are built with Ant. How can I build with SBT and integrate in Jenkins?

1

There are 1 answers

0
Richard Gomes On BEST ANSWER

There's a SBT plugin which allows Ant targets to be called.

First build ant4sbt from sources:

git clone http://github.com/sbt/ant4sbt.git
cd ant4sbt
sbt publish-local

Create a file properties/sbt-ant4sbt.sbt like this:

addSbtPlugin("de.johoop" % "ant4sbt" % "1.1.2")

Create a build.sbt on the root of your Netbeans RCP application:

import de.johoop.ant4sbt.Ant4Sbt._
antSettings
addAntTasks("build-osgi") // creates task antRunBuildOsgi
addAntTasks("run-osgi")   // creates task antRunRunOsgi

Now you can build OSGi bundles from command line and run it inside a container, like this:

sbt antRunBuildOsgi
sbt antRunRunOsgi

Building in Jenkins is as easy as calling sbt antRunBuildOsgi but you will have to copy dependencies to the library directory you defined in your Netbeans IDE. After the build you will also have to copy artifacts to the place you distribute artifacts of your builds.

See also: Cannot build OSGi bundle for a Netbeans RCP application