This repository contains some experiments I do with Eclipse JDT.
Usage of the JDT from a simple Java main method (Java SE only, no OSGi, no maven tycho). All dependencies are fetched from Maven Central. See blog post: Use the Eclipse Java Development Tools in a Java SE application
Source code is available is in the java-formatter folder.
The two projects
programcreek-standalone contain unit-tests based on examples from the articles of the Eclipse JDT Tutorials proposed by the site
Maven can be used to run the unit-test and to see the JDT code in action.
The code is spitted into two sub-projects, depending if the JDT code used in the example needs a Workspace (that requires an OSGi runtime) or not.
The JDT examples presented in this project use operations (search index, Built-in AST Rewrite, …) that require a Workspace.
A Workspace can be created programmatically and doesn’t need to fire up the Eclipse UI, but this operation requires an OSGi runtime.
The services provided by
org.eclipse.core.runtime have to be available (the Workspace code in
org.eclipse.core.resources rely on those).
The Workspace location is driven by the
To run the tests inside an OSGi container, the proposed solution relies on the maven bnd plugins. This makes the pom file more complex than for plain java projects.
To execute the tests in an IDE, be sure to run them inside an OSGi container (in the same way the maven build is doing it).
If you are using Eclipse IDE, consider installing bndtools.
IntelliJ IDEA Ultimate seems also to have support for OSGi and
Source code is available is in the programcreek-osgi folder.
The JDT examples presented in this project are not relying on a Workspace.
They can be executed in a traditional Java SE application.
main(String args) method could be used instead of the unit-tests.
Source code is available is in the programcreek-standalone folder.