Jenkins Plugin For Eclipse

Have you ever used Eclipse before? If not, it’s a free Java IDE that is used by thousands of developers worldwide. This is where the Jenkins Plugin For Eclipse comes in.

Jenkins is one of the most popular CI tools and similarly Eclipse is a very popular IDE. Jenkins provides many plugins which allows us to perform different tasks during building, testing and deploying the software application. This article mentions the plugin “Jenkins Plugin For Eclipse” which helps us perform different actions in eclipse whenever a file got modified.

Trying to set up Jenkins with a lot of plugins can be frustrating process. This is why it’s important to really know what plugins you need and use. However, with the help of an Eclipse plugin, this process can be easier.

Jenkins Plugin For Eclipse

Make sure you’re using Java 7 or above

Select Window > Preferences…
Make sure JDK7 or above is present and checked.

Set your M2_REPO variable

Select Window > Preferences…


Click New, then specify your M2_REPO location, for example:

On UNIX platforms, the path will be in your home directory, for example /home/brian/.m2/repository.

Import the modules you want to work with

In File > Import, select General > Existing projects into Workspace, and then click on Next.  The Import Project form appears.  In Select root directory, enter the path to your Eclipse workspace.  Type <tab> and Import Projects will recursively search for projects to import, and display them:

Click Finish to import the selected Jenkins projects into Eclipse.

Even if you are modifying just one module, you must import all of them into Eclipse as they depend on each other.

Other tips

Setting up Jenkins to run as web app within tomcat/eclipse (using eclipse 3.3, tomcat 6.0, sysdeo tomcat plugin):

  • Add the plugin project you are currently working on into Tomcat’s classpath using the Sysdeo plugin (Preferences, Tomcat, Advanced, …)
  • Download a recent stable Jenkins war.
  • Copy war to tomcat webapps.
  • Start tomcat. This will explode the war into the tomcat webapps directory (needed for subsequent step).
  • Limitation: This setup does not deploy any non-Java artifacts to the web application. If you update any of these (e.g. html files), you’ll need to manually copy these to the exploded directories in the tomcat webapps directory.

If you are changing multiple modules, the most reliable way to have the correct version appear first on the tomcat classpath is to add the imported version of the module to the classpath of the plugin you’re debugging, then only add the plugin project to Tomcat’s classpath. For example, this shows the Jenkins-core project added to the build path of the perforce plugin.

After you add the jenkins-core project to the classpath, use the ‘Order and Export’ tab to move the jenkins-core project before the jar version (in M2_REPO) of jenkins-core. Also, you must check the checkbox to the left of jenkins-core, otherwise Tomcat will not be able to load any of the classes in jenkins-core.


Use Mylyn and the Jenkins issue tracker

It is possible to configure Mylyn so it will connect to the Jenkins issue tracker. To be able to connect to the tracker you need to install the CollabNet Desktop plugin.

Task repository

When the plugin has been installed, create a new Task repository with the following settings:

Task query

To create a query to the issue tracker

  1. Create a new Mylyn query
  2. Select the newly create task repository
  3. Select “Create query using form”
  4. Enter a name for the query
  5. Set the component to Jenkins
  6. Configure the query
    !

Leave a Comment