Skip to content

Building Open Liberty with Eclipse

Scott Kurz edited this page Jan 30, 2018 · 16 revisions

DRAFT! NOT READY



Building Open Liberty in Eclipse

Step 1. Clone the repository to your system.

git clone [email protected]:OpenLiberty/open-liberty.git

For more detailed instructions on setting up your clone, see here.


Step 2 : Import cloned projects to Eclipse

  1. Ensure you turn off build automatically in Eclipse (click Project and ensure that Build Automatically is not checked).

  2. Ensure you turn off the auto ignore derived resources (click Window -> Preferences -> Team -> Git -> Projects and uncheck Automatically ignore derived resources by adding them to .gitignore).

  3. Ensure you create an ant.home (all lower case) class path variable (click Window -> Preferences -> Java -> Build Path - > Classpath Variables). Click New, click Folder, and locate the org.apache.ant_ in your eclipse plugins directory (ex, D:\Eclipse\Eclipse4.6\eclipse\plugins\org.apache.ant_1.9.6.v201510161327).

    Mac Users. Places to look:

    /Applications/Eclipse.app/Contents/Eclipse/plugins/org.apache.ant_1.9.6.v201510161327

    ~/.p2/pool/plugins/org.apache.ant_1.9.6.v201510161327

    Mac and Oxygen Users. You may need to use your locally installed Ant

    For example: /Users//apache-ant-1.8.4

  4. If you're on Windows, ensure you disable content assist proposals for user defined Ant tasks (click Window -> Preferences -> Ant -> Editor -> Content Assist and uncheck "Provide proposals for user defined tasks (may lock referenced JAR files)")

  5. Import the projects into Eclipse

    There are two options for importing the projects into Eclipse. Either use the built-in Eclipse function to import the existing projects, or use eGit to add the repository and add the projects via the repository.

    Importing using pure Eclipse has the benefit of typically being quicker since it doesn't have the overhead of using eGit. Doing so also means you have no reliance on eGit and can remove it from your Eclipse instance. However if you're unfamiliar with Git or simply prefer to use eGit capabilities, you'll need to import the projects via eGit.

    A. Import projects via Eclipse (recommended)

    1. Select File -> Import...

    2. In the window that pops up, search for or find Existing Projects into Workspace. Select it and click Next >.

    3. Under the Options section, ensure that Search for nested projects and Copy projects into workspace are not checked.

    4. In the Select root directory: input, input the path to the <ol_clone_dir>/dev directory.

      Eclipse will navigate through the directory to find all of the necessary projects. This might take a couple seconds, but no more than 30 or so.

    5. Click Finish

    B. Import projects via eGit

    1. Next open the Git Repository viewer(Window -> Show View -> Other -> Git Repositories).

    2. Select Add an existing local Git Repository in the Git Repository window.

    3. In the Add Git Repositories dialog box, navigate to <ol_clone_dir> (via Browse/Search) and select it. It is where the <repository_name>.git file is located for the repository on your local file system.

    4. Check the box by your repository, and click Finish.

    5. Ensure that you modify the CRLF properties to use input. This can be done via the command line in Git bash:

      git config --global core.autocrlf input

      or via Eclipse by Windows -> Preferences -> Team -> Git -> Configuration. Under the Repository Settings tab highlight the core key, and click Add Entry. Enter core.autocrlf as the key, and for the value enter input.

      More information regarding CRLF can be found at the Dealing with line endings topic on GitHub Help (though note we make a different suggestion than to use true on Windows, since you may be working with a Windows Git repository but working on other systems like EZWAS).

    6. In the Git Repositories window, right click your repository, and select Import Projects.

    7. Ensure the Import existing Eclipse projects is selected (default), and ensure that you've select the correct working tree with your local repository. Click Next.

    8. After a few seconds you'll see a list of all the projects. Uncheck the 'Search for nested projects' option, then click the Finish button to import all the projects. NOTE: The import can take a ~5-10 minutes to complete depending on your system hardware.

  6. At this point, you should have all the projects into your Eclipse work space similar to what you have with the old RTC work space creation.


Step 3: Run a Gradle build

  1. Run a gradle build.

    cd open-liberty/dev

    ./gradlew cnf:initialize You should only have to run this command on the initial setup of the repo

    ./gradlew assemble

  2. Run the unit or FAT tests.

    ./gradlew test for unit tests

    ./gradlew build.example_fat:buildandrun to run a FAT project

    NOTE: ./gradlew build runs assemble and test targets

  3. Perform a local release

    ./gradlew releaseNeeded

    NOTE: This task releases all projects to the local releaseRepo. The final openliberty zip can be found in

    open-liberty\dev\cnf\release\dev\openliberty\<version>\openliberty-xxx.zip


Step 4: Eclipse Build All

To ensure all the Bnd Bundle paths resolve for bndtools inside of Eclipse for your Open Liberty workspace, ensure you do a Project -> Build All.

IMPORTANT The this step of building the code within Eclipse is just for development time purposes to get errors out of your workspace. You must run builds from the command line tools for things to get generated properly!


Clone this wiki locally