Buildship 2.2 Release Supports Java 9, Runtime Classpath Separation and More
- By John K. Waters
The Eclipse Foundation has just announced the release of a new version of the Eclipse Buildship project, which integrates the Gradle build tool with Eclipse. Version 2.2 supports Java 9 and introduces runtime classpath separation based on the dependency scope information supplied by Gradle.
"The previous releases did not define any separation for the Eclipse runtime classpath. This meant that when a user launched a Java application or executed a test via JDT then all dependencies from all configurations were available on the classpath," explained Java developer and project contributor Donát Csikós, in a blog post." If the project uses Gradle 4.4 or newer, then all source directories and binary dependencies define which scope (main, test, integTest and so on) they belong. Buildship then filters elements from the runtime classpath if the launched application is associated with a different scope."
Csikós also noted that Buildship must still use Eclipse's default flat classpath approach, Note, that Buildship still must use Eclipse's default flat classpath approach, so this feature can only filter unwanted dependencies based on the dependency scopes.
"This feature is especially useful for the Spring Tool Suite users," he wrote. "In Spring Boot it is common practice to keep the application configuration in the main sources and override it with a similar one in the test sources. Before Buildship 2.2 when the main application was launched from the IDE, the test configuration was still picked up, making the IDE unusable in this use-case. With this new feature, launching a Spring Boot app from the command line and from Eclipse produces consistent results."
Gradle is the general-purpose build management system that uses Groovy, an open source scripting language with Java syntax, and Kotlin, an open-source programming language for both the JVM and Android. Gradle has supported Java 9 since mid-October. Gradle 3.4, released in March, introduced a new Java Library Plugin, which enforces strong encapsulation for libraries by separating API dependencies from implementation dependencies. Version 3.5, released in April, announced a new build cache, among other improvements. This integration will help Eclipse users to synchronize Gradle builds with their workspace and execute tasks without having to leave their Integrated Development Environments (IDEs).
In Buildship 2.2, Gradle build files are now opened in a dedicated Gradle editor that provides basic syntax highlighting, and Eclipse can be configured to execute Gradle project synchronization automatically when a build script changes.
John K. Waters is the editor in chief of a number of Converge360.com sites, with a focus on high-end development, AI and future tech. He's been writing about cutting-edge technologies and culture of Silicon Valley for more than two decades, and he's written more than a dozen books. He also co-scripted the documentary film Silicon Valley: A 100 Year Renaissance, which aired on PBS. He can be reached at firstname.lastname@example.org.