Setting Up Eclipse - dogtagpki/pki GitHub Wiki

Overview

It is recommended to use Eclipse for PKI development, although that is not required. As a Java IDE, Eclipse provides:

  • auto build so code issues can be detected immediately

  • auto completion so it’s easier to write the code

  • auto formatting so the code style will be more consistent (i.e. easier to read)

  • auto dependency management so the import statements will be more consistent (i.e. easier to cherry-pick)

and many other useful functionalities.

PKI repositories has been set up such that it can easily be added into Eclipse.

Installation

To install Eclipse on the latest Fedora, download Eclipse, unpack it, then install it:

$ cd eclipse-installer
$ ./eclipse-inst

To install Eclipse on older Fedora:

$ dnf install eclipse-jdt

It will add an icon in the desktop’s Favorites.

Starting Eclipse

To start Eclipse, click the Eclipse icon in the desktop’s Favorites or execute the following command:

$ eclipse

It may ask you to select a workspace to store project metadata.

Adding a Java Project

To add the Java project into Eclipse, first clone the project into a local repository, for example:

$ git clone [email protected]:dogtagpki/pki.git

Install the build dependencies, for example:

$ dnf builddep dogtag-pki

Then execute the following steps in Eclipse:

  • Click FileNewJava Project.

  • Enter the Project name, e.g. pki.

  • Unselect Use default location.

  • In Location enter the path to the cloned project repository, e.g. /home/<username>/Projects/pki.

  • Unselect Create module-info.java file.

  • Click Finish.

If the project already has the .project and .classpath files in the project’s main folder, the project build path is already set up so Eclipse can build the code automatically, and there should be no errors. The project can be used immediately.

If some dependencies are still missing, try to install it manually:

$ dnf install <package>

Then fix the RPM spec file so that dnf builddep will install the complete dependencies.

It’s also possible that some dependencies are no longer needed/available. In that case fix the project build path or fix the .classpath manually, then commit the changes into the repository.

If the project doesn’t have the .project and .classpath files, it may be necessary to configure the project build path manually before the project can be used. Once these files are created, commit the files into the repository so others can use the files too.

Switching Project Branch

To switch to a different branch, execute the following command:

$ git checkout <branch>

Then right-click on the project in Eclipse, and select Refresh.

Switching Java Version

To switch Java version, open WindowPreferencesJavaInstalled JREs. Select the Java version to use, then click Apply and Close.

See Also

⚠️ **GitHub.com Fallback** ⚠️