This project provides an Eclipse plugin for building, debugging, and deploying Google Cloud Platform applications.
mvn package should
generate a p2-accessible repository in
This project is built using Maven Tycho, a set of extensions to Maven for building Eclipse bundles and features.
The Google Cloud SDK; install this somewhere on your file system and add it to your path.
Install the App Engine Java components:
$ gcloud components install app-engine-java
The Eclipse IDE. It's easiest to use the Eclipse IDE for Java EE Developers package. You must use Eclipse 4.9 or later. We use target platforms to support building for earlier versions of Eclipse. You also need the following:
The m2e connector for maven-dependency-plugin
should be installed from
This connector should be prompted for by M2Eclipse. If not, use
Preferences > Maven > Discovery > Open Catalog and search
for Dependency and install.
The Google Java Format plugin for Eclipse.
Download the latest version
and place the jar into your Eclipse installation's
(on MacOS this may be in
Maven 3.5.0 or later. Although m2eclipse is bundled with its own Maven install, Maven is necessary to test command-line builds.
git (optional: you can use EGit from within Eclipse instead)
Clone the project to a local directory using
git clone https://github.com/GoogleCloudPlatform/google-cloud-eclipse.git.
If you're using Goobuntu, first point JAVA_HOME at a stock OpenJDK, not at the Google JDK:
$ export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
If all you want is to run tests, just do
However, the integration tests will interfere with your display, disrupt your using your computer, and likely fail if you touch the screen while the integration tests are running. A nice solution on Unix-like systems is to do
xvfb-run mvn verify. (Install Xvfb if necessary.)
xvfb-run will use a virtual display, and you and the tests will not be disrupted.
The plugin is built using Maven/Tycho and targeted to Java 8.
The tests need to find the Google Cloud SDK. You can either:
/bindirectory on your
GOOGLE_CLOUD_SDK_HOMEto point to your SDK
By default, the build is targeted against Eclipse
You can explicitly set the
eclipse.target property to
$ mvn -Declipse.target=2018-12 package
We normally put production code into a bundle and tests as a fragment hosted
by that bundle, put under the
For now we have been committing both the
pom.xml and Eclipse's
.settings/ files. We have a master set
of project settings in
eclipse/settings; see the
README.md for more details.
Our CI process is configured to run our tests with JaCoCo, which requires
some additional configuration to add new bundles and fragments
We pull in some dependencies directly from Maven-style repositories, such as Maven Central and the Sonatype staging repository, which isn't directly supported within Eclipse. We have a few hoops to jump through to set up a working development environment.
The Eclipse IDE and Tycho both use a Target Platform to manage the dependencies for the source bundles and features under development. Although Tycho can pull dependencies directly from Maven-style repositories (like Maven Central), Eclipse cannot. So we use Tycho to cobble together a target platform suitable for the Eclipse IDE with the following command.
$ (cd eclipse; mvn -Pide-target-platform package) # may want -Declipse.target=XXX
This command creates a local copy of the
target platform, including any Maven dependencies, into
You will use this repository to create a target platform within the IDE,
as described below.
The Eclipse version used for the target platform is affected by the
eclipse.target property, described below.
You must regenerate the target platform and reconfigure the IDE's target platform whenever dependencies are updated.
Setup JDK 8 in Eclipse (this may already be set up by Eclipse's JRE/JDK auto-discovery)
Window/Preferences (on Mac
Java/Installed JREs click
Select Standard VM and click
Select the folder that contains the JDK 8 installation by clicking
Java/Installed JREs/Execution Environments page.
JavaSE-1.8 in the list on the left under
The JDK just added should show up in the list on the right along with other
installed JDKs/JREs. Set the checkbox next to the JDK 8 added in the
previous steps to mark it as compatible with the
Set up the Target Platform: you will need to repeat this process whenever
items are changed in the target platform, such as a new release of the
As described above, you must first build the target platform with Maven:
$ (cd eclipse; mvn -Pide-target-platform package)
Preferences dialog, go to
Plug-in Development >
Nothing to create a new Target Platform.
GCP IDE Target Platform.
Add... button (found beside the
Work with: field) and then select
to find a local repository. Navigate to
Once the main content populates, check the
Uncategorized item to pull in all items. Click
Finish to complete the new target platform definition.
Select your new target platform (instead of Running Platform) in the
Target Platform preferences.
Apply and Finish to load this new target platform.
Eclipse will load the target.
Import the projects.
File/Import... menu in Eclipse.
Existing Maven Projects from the list.
Browse... and select the directory that
contains the project.
pom.xml files representing modules should be
displayed. Make sure that all of them are selected except
verify_feature_completeness and the sub-directories under
eclipse. You probably need to explicitly unselect these
eclipsedirectory define target platforms for the Tycho build. It's easier to edit the files from the
Maven may prompt you to install several additional plugin connector plugins from
Tycho if they are not already installed. Click
Finish to install them. If Eclipse prompts you to install any other
plugins, do so.
Restart Eclipse when prompted.
Check the imported projects.
There should be no errors in the
Problems views in Eclipse.
However you may see several low-priority warnings.
Create and initialize a launch configuration:
gcloud-eclipse-tools.launch file under the
google-cloud-eclipse module in the
Run As >
Set variables required for launch:
Go to the second tab for
Variables... button for
Edit variables... button
Set the name to
oauth_id, and the value to the value you want to use
OK, the variable will appear in the list
Repeat steps 6-8 but use
oauth_secret as the name and use the
OK to close the edit variables dialog
Cancel to close the variable selection dialog
Apply to apply the changes to the run config
Run menu, select
Run History > gcloud-eclipse-tools. A new instance of Eclipse launches with the plugin installed.
We use Target Platform files (
.target) to collect the dependencies used
for the build. These targets specify exact versions of the bundles and
features being built against. We currently maintain three target platforms,
targeting the latest version of the current, previous, and next releases.
This is currently:
.target files are generated and should not be manually updated.
.target files directly becomes a chore once it has more than a
couple of dependencies. We instead generate these
Target Platform Definition
.tpd files use a simple DSL to specify the bundles and features,
and the location of the repositories containing them.
.tpd files are processed using the TPD Editor
which resolves the specified dependencies and creates a
The process is:
http://download.eclipse.org/cbi/tpd/3.0.0-SNAPSHOT/as the location.
.tpdfile in Eclipse.
org.eclipse.core.runtime). Features are specified using their Feature ID suffixed with
.target files should be committed.
The IDE Target Platform needs to be rebuilt at the command line and reimported into Eclipse when dependency versions are changed:
(cd eclipse; mvn -Pide-target-platform package)
The IDE Target Platform, defined in
may need to be updated when dependencies are added or removed. The
contents are defined in the
category.xml file, which specifies
the list of features and bundles that should be included. This
file can be edited using the Category editor in Eclipse. Ideally
the version should be specified as
"0.0.0" to indicate that the
current version found should be used. Unlike the
the identifiers are not p2 identifiers, and so features do not
eclipse/settings/ for details.
Now that OpenJDK is moving to a 6-month release cycle...
We use Tycho's support for Maven Toolchains to ensure that new
language features do not creep into the code. Tycho's support is
automatically enabled in the build when compiling with a newer JDK
than our minimium supported platform. When using such a JDK, currently
anything later than JDK 8, we configure the Tycho compiler plugin to
setting to ensure bundles are compiled with a JDK that matches
Bundle-RequiredExecutionEnvironment. However we leave
tycho-surefire to run the tests using the current toolchain
(the default for
so as to catch any non-backwards compatible changes.
These settings require configuring
to point to appropriate JRE installations. Tycho further requires
that a toolchain defines an
id for the specified Execution
Environment identifier. For example, a
configure Maven on macOS for 8, and 11 toolchains might be:
<?xml version="1.0" encoding="UTF8"?> <toolchains> <toolchain> <type>jdk</type> <provides> <id>JavaSE-11</id> <version>11</version> <vendor>openjdk</vendor> </provides> <configuration> <jdkHome>/Library/Java/JavaVirtualMachines/jdk-11.jdk/Contents/Home</jdkHome> </configuration> </toolchain> <toolchain> <type>jdk</type> <provides> <id>JavaSE-1.8</id> <version>1.8</version> <vendor>oracle</vendor> </provides> <configuration> <jdkHome>/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre</jdkHome> </configuration> </toolchain> </toolchains>
Note that jdkHome for
JavaSE-1.8 specifies the
jre/ directory: Tycho sets the default boot classpath to
/lib/ext/*, and jdkHome
For many JDKs, including Oracle's JDK and the OpenJDK prior to Java 9, those
directories are actually found in the
jre/ directory. Compilation
errors such as
java.lang.String not found and
not found indicate a misconfigured jdkHome. With the introduction of
Java modules with Java 9, there is no longer a separate JRE distribution.
If a particular CI build in the matrix (e.g. Java 8 Eclipse 4.8 on push) appears to be reproducibly failing while other builds pass, try clearing the cache on Travis. To do so, on the relevant page
More Options > Caches
Delete all repository caches
"Are you sure?" dialog. Press OK.