Package com.diffplug.gradle.eclipse
Class MavenCentralPlugin
java.lang.Object
com.diffplug.gradle.ProjectPlugin
com.diffplug.gradle.eclipse.MavenCentralPlugin
Now that Eclipse is publishing artifacts to maven central,
it's possible to use the valuable components of the
eclipse project without getting bogged down in p2 and OSGi.
The trouble is that it can be difficult to get a coherent set
of versions across the many bundles. It's also a little tricky
to know what the groupId:artifactId mapping is, since eclipse
artifacts only have a bundleId by default.
Here is the fix:
```
apply plugin: 'com.diffplug.eclipse.mavencentral'
eclipseMavenCentral {
release '4.7.0', {
// supports the standard java configurations
api 'org.eclipse.swt'
implementation 'org.eclipse.jdt'
testImplementation 'org.eclipse.swt'
// and custom ones too
dep 'implementation', 'org.eclipse.jdt'
// specify this to add the native jars for this platform
useNativesForRunningPlatform()
// specify that all transitive dependencies should be from this release
// (otherwise the version ranges which eclipse uses will use latest available)
constrainTransitivesToThisRelease()
}
}
```
## Platform-native jars
When an eclipse jar needs a platform-specific dependency,
such as SWT, the platform-specific part of the name is specified
in the POM as `${osgi.platform}`. useNativesForRunningPlatform()
will replace `${osgi.platform}` with whatever is appropriate for
your platform, such as `org.eclipse.swt.win32.win32.x86_64`.
That's normally all you need, but if you want more specific
control, there is a special `sourceSetNative` method,
along with builtins like `testRuntimeNative` for each
of the builtin java configurations.
```
eclipseMavenCentral {
release '4.7.0', {
testRuntimeOnlyNative 'org.eclipse.swt'
nativeDep 'testRuntimeOnly', 'org.eclipse.swt'
}
}
```
Either of the above lines will add the
`org.eclipse.swt.win32.win32.x86_64` as a `testRuntimeOnly`
dependency if you're running on a 64-bit JVM on Windows, or some
whichever platform-specific jar is appropriate. This
works only for the SWT naming convention, `windowing.os.arch`.
## Compatibility
Only works with versions from `4.6.2` onwards.
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class com.diffplug.gradle.ProjectPlugin
apply, getPlugin, treeDef
-
Constructor Details
-
MavenCentralPlugin
public MavenCentralPlugin()
-
-
Method Details
-
applyOnce
Description copied from class:ProjectPluginPlugin application, which is guaranteed to execute only once.- Specified by:
applyOncein classProjectPlugin
-