By default the Atlassian Plugin SDK generates Version 2 (OSGi) plugins. Unfortunately Bamboo currently doesn't support Version 2 (v2) plugins for Remote Agents, meaning that plugin modules running on Agents require the Plugin to be a of Version 1 (v1). The most notable example is the Source Repository Module - which most commonly is executed on Remote Agents to access the source repository.
Ensure to always test your plugin with Remote Agents to verify that there are no NoClassDefFound
exceptions.
A v1 plugin is a plain old jar that is available on the Bamboo classpath. It should not contain any OSGi descriptors in it's Manifest.mf
. The tricky part is to make sure all dependencies get bundled with your plugin - either as separate jar or bundled with your plugin.
See the atlassian-plugin
section in Configuring the Plugin Descriptor where the plugin version is declared.
This also applies to v2 plugins, but is especially important for v1 plugins as they can pollute Bamboo's classpath with wrong versions of classes.
provided
It's important not to include any jars that already ship with your Bamboo server.
1 2<dependency> <groupId>com.atlassian.bamboo</groupId> <artifactId>atlassian-bamboo-api</artifactId> <version>${bamboo.version}</version> <!-- Don't bundle API classes --> <scope>provided</scope> </dependency>
atlas-mvn dependency:tree
is your friend here.
1 2<dependency> <groupId>org.eclipse.jgit</groupId> <artifactId>org.eclipse.jgit</artifactId> <version>0.9.3</version> <exclusions> <exclusion> <!-- jsch is provided by Bamboo --> <groupId>com.jcraft</groupId> <artifactId>jsch</artifactId> </exclusion> </exclusions> </dependency>
By default atlas-package
from Atlassian Plugins SDK bundles dependencies for a v2 plugin layout.
The jars are copied to META-INF/lib
in the plugin jar which is suitable for OSGi deployment.
To make plugin v1 work the jars need to be repackaged with the plugin jar so they are visible to non-OSGi classloader.
1 2<plugin> <groupId>com.atlassian.maven.plugins</groupId> <artifactId>maven-bamboo-plugin</artifactId> <version>3.2.3</version> <extensions>true</extensions> <configuration> <productVersion>${bamboo.version}</productVersion> <productDataVersion>${bamboo.data.version}</productDataVersion> <!-- Version 1 compatible layout --> <extractDependencies>true</extractDependencies> </configuration> </plugin>
V1 plugins are plain old jars on the Bamboo classpath. The main reasons to use them instead of v2 plugins are to:
There are a few issues that should be taken into account:
atlassian-bamboo.log
. This becomes a problem when different plugins provide different versions of the jars.
When adding a potentially popular dependency consider jarjar instead of unpack.atlas-cli
possible.Rate this page: