Skip to content

Latest commit

 

History

History
236 lines (169 loc) · 10.6 KB

setup_development_environment.adoc

File metadata and controls

236 lines (169 loc) · 10.6 KB

The JBoss Tools 4.x Development Environment

This article explains the different options you have to set up a first-class development environment when looking to contribute to JBoss Tools.

Java

JBoss Tools 4.3 requires Java 8. JBoss Tools 4.2 required Java 7 or 8.

For other versions of JBoss Tools or Red Hat CodeReady Studio, see:

Eclipse Base Installation

When developing JBoss Tools, you have several options. We strongly suggest using either the Eclipse RCP/RAP or the Eclipse JavaEE distribution, as these two packages are the most complete and will require the least additional configuration. You can find either of these packages, or your other favorite eclipse distribution, here.

PDE - Eclipse Plug-in Development Tools

The most important part of any package you choose is that it comes with Eclipse PDE, which is Eclipse’s Plugin Development Environment tools. To see if your chosen distribution comes with PDE (or any other features), you can check here. If your chosen eclipse installation does not come with PDE, you can also install PDE into any installation of Eclipse. Once you have your chosen distribution downloaded and running, you can install PDE by clicking Help → Install New Software…​ menu items. You should see a wizard similar to the one below:

installPDE

From the combo box, you’ll want to select an Update Site URL that looks similar to http://download.eclipse.org/releases/luna. Search for the Eclipse Plug-in Development Environment feature, select it, and click 'next' to continue with the installation.

For more information on installing new plugins, please see this eclipse guide.

Git and EGit

Git is the chosen version control system used by JBoss Tools. To be able to checkout (or clone) our source code, you’ll first need to install git. The instructions for installing Git vary depending on your operating system. Please consult the Git website for more information.

Once the Git command line tools are installed, you’ll want to install Hub.

Using a utility like Hub can help shave a lot of time off dealing with multiple topic branches, pull requests, and other more time-intensive workflows. You can find out more at http://hub.github.com/.

Next, you’ll want to install EGit, to use Git from inside Eclipse.

To see if your chosen distribution comes with EGit, you can check here. If your chosen eclipse installation does not come with EGit, you’ll want to follow the above instructions for PDE to install EGit, with some small changes. Specifically, you’ll want to paste in the update site url found at Egit’s download page.

Maven

Make sure that Maven 3.5.2 (or newer) is available by default and Java 1.8 or 9.0.1 is used.

$ mvn -version

Apache Maven 3.5.2 (138edd61fd100ec658bfa2d307c43b76940a5d7d; 2017-10-18T03:58:13-04:00)
Maven home: /opt/maven3
Java version: 1.8.0_151, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.151-1.b12.fc27.x86_64/jre
Default locale: en_CA, platform encoding: UTF-8
OS name: "linux", version: "4.14.13-300.fc27.x86_64", arch: "amd64", family: "unix"

$ export JAVA_HOME=/usr/lib/jvm/java-9/
$ mvn -version

Apache Maven 3.5.2 (138edd61fd100ec658bfa2d307c43b76940a5d7d; 2017-10-18T03:58:13-04:00)
Maven home: /opt/maven3
Java version: 9.0.1, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-9-openjdk-9.0.1.11-4.fc27.x86_64
Default locale: en_CA, platform encoding: UTF-8
OS name: "linux", version: "4.14.13-300.fc27.x86_64", arch: "amd64", family: "unix"

Maven settings

See Maven Getting Started - Developers to add a reference to the JBoss Repositories into your settings.xml. You’ll also probably need access to the SNAPSHOT repository. So here is what you should see in your ~/.m2/settings.xml

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">

  <profiles>
    <profile>
    <id>jboss-default</id>
    <repositories>
    <!-- To resolve parent artifact -->
    <repository>
        <id>jboss-public-repository-group</id>
        <name>JBoss Public Repository Group</name>
        <url>http://repository.jboss.org/nexus/content/groups/public/</url>
      </repository>
      <repository>
        <id>jboss-snapshots-repository</id>
        <name>JBoss Snapshots Repository</name>
        <url>https://repository.jboss.org/nexus/content/repositories/snapshots/</url>
      </repository>
    </repositories>
    <pluginRepositories>
      <!-- To resolve parent artifact -->
      <pluginRepository>
        <id>jboss-public-repository-group</id>
        <name>JBoss Public Repository Group</name>
        <url>http://repository.jboss.org/nexus/content/groups/public/</url>
      </pluginRepository>
      <pluginRepository>
        <id>jboss-snapshots-repository</id>
        <name>JBoss Snapshots Repository</name>
        <url>https://repository.jboss.org/nexus/content/repositories/snapshots/</url>
      </pluginRepository>
    </pluginRepositories>
    </profile>
  </profiles>
  <activeProfiles>
    <activeProfile>jboss-default</activeProfile>
  ...
  </activeProfiles>
</settings>

Toolchain Settings

Need to build against a SPECIFIC JDK version, as defined by the Bundle-RequireExecutionEnvironment (BREE) directives in your MANIFEST.MF files? You can use a ~/.m2/toolchains.xml file like this one, but pointed at the actual paths for YOUR installed JDKs:

<?xml version="1.0" encoding="UTF8"?>
<toolchains>
  <toolchain>
    <type>jdk</type>
    <provides>
      <version>1.8</version>
      <vendor>openjdk</vendor>
    </provides>
    <configuration>
      <jdkHome>/usr/lib/jvm/java-1.8.0-openjdk/</jdkHome>
    </configuration>
  </toolchain>
  <toolchain>
    <type>jdk</type>
    <provides>
      <version>9</version>
      <vendor>openjdk</vendor>
    </provides>
    <configuration>
      <jdkHome>/usr/lib/jvm/java-9-openjdk/</jdkHome>
    </configuration>
  </toolchain>
 </toolchains>

Maven & Java Memory Configuration

To configure the amount of memory used by Maven, you can define MAVEN_OPTS as follows, either in the mvn / mvn.bat script you use to run Maven, or set as global environment variables. Here’s how to do so for Fedora, Ubuntu, Windows, OSX.

set MAVEN_OPTS=-Xms512m -Xmx1024m -XX:PermSize=128m -XX:MaxPermSize=256m

m2e

m2e (maven integration for Eclipse) is also required to get the most out of your development experience with JBoss Tools. JBoss Tools uses Maven, and a maven plugin Tycho, to build our tools. To see if your chosen distribution comes with m2e, you can check here. If your chosen Eclipse installation does not come with m2e, you’ll want to follow the above instructions to install m2e, using the update site url found at m2e’s download page.

Once m2e is installed, we recommend that you also install m2e-tycho and m2e-EGit connectors, if they were not automatically installed upon import, from Window → Preferences → Maven → Discovery → Open Catalog.

m2e tycho

Tips for productivity and quality

Here are some highly recommended plugins that will make you more efficient when working inside the IDE

Code Recommenders

Code Recommenders provides additional snippets, templates and smart auto-completion. It is not intrusive. You can find it on the latest Eclipse release update site, using an update site url such as http://download.eclipse.org/releases/luna/

Static analysis

Static analysis will detect bugs very early in your development, could save you hours of debugging, and improve team morale. Static Analysis tools will warn you of bugs that it can detect while you are still typing the code. You won’t need to wait for tests to run or CI reports to be published in order to detect this.

Enable all JDT warnings

JDT provides very good static analysis, and can prevent you from writing bugs. You simply have to turn all "ignored" advices to "warning" in Window → Preference → Java → Compiler → Errors/Warning

jdtWarnings

Install SonarLint for Eclipse

SonarLint is an Eclipse plugin that provides on-the-fly feedback to developers on new bugs and quality issues injected into Java, JavaScript, PHP, Python…​ code. It will ensure that your patches and contributions are more likely to remain free of the most common bugs.

You can install SonarLint from the Eclipse Marketplace. The Eclipse Marketplace can be accessed in Eclipse via Help → Eclipse Marketplace…​.

You can then search the Marketplace and select SonarLint to install:

sonarLintInstall

If your Eclipse does not include the Marketplace, you should first install it from the Marketplace Client update site.

Coverage

Coverage answers the question "What has been tested?"

JBoss Tools CI builds provide JaCoCo reports for coverage by unit tests (file name is jacoco.exec). This file can easily be analyzed inside Eclipse on your Java editor using the EclEmma plugin. The EclEmma plugin can also be installed from Eclipse Marketplace, as in the previous section above.

Conclusion

Now that you’re all done here, you’ll want to learn all about target platforms. Please go back to the index to move forward with setting up your target platform.