Missed Team ’24? Catch up on announcements here.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How do I manage different versions of the same dependency for different releases of Bamboo?

Jason Huntley
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 30, 2012

With the release of 4.2, I found my plugin incompatible with Bamboo. I rely on the 1.8.18 version of the bamboo git plugin.

<dependency>
			<groupId>com.atlassian.bamboo.plugins</groupId>
			<artifactId>atlassian-bamboo-plugin-git</artifactId>
			<version>1.8.18</version>
			<scope>provided</scope>
		</dependency>

However, 4.2, is bundled with 1.9.9. Is there a way to tell my plugin to use the default git plugin bundled with the current Bamboo release? I'm not sure how to define this in OSGI. If I bump up the version, then my plugin isn't going to maintain compatibility with previous releases correct? Any input is greatly appreciated.

Update:

I tried switching to 1.9.9 and my plugin still will not load:

<dependency>
			<groupId>com.atlassian.bamboo.plugins</groupId>
			<artifactId>atlassian-bamboo-plugin-git</artifactId>
			<version>1.9.9</version>
			<scope>provided</scope>
		</dependency>

I get the following error:

2012-09-04 12:00:45,700 ERROR [pool-11-thread-1] [OsgiPlugin] Detected an error (BundleException) enabling the plugin 'com.houghtonassociates.bamboo.plugins.gReview' : Unresolved constraint in bundle com.houghtonassociates.bamboo.plugins.gReview [57]: Unable to resolve 57.0: missing requirement [57.0] package; (package=com.atlassian.bamboo.plugins.git). This error usually occurs when your plugin imports a package from another bundle with a specific version constraint and either the bundle providing that package doesn't meet those version constraints, or there is no bundle available that provides the specified package. For more details on how to fix this, see http://confluence.atlassian.com/x/1xy6D

2012-09-04 12:00:45,707 WARN [pool-11-thread-1] [OsgiPlugin] Unable to enable plugin 'com.houghtonassociates.bamboo.plugins.gReview'

com.atlassian.plugin.osgi.container.OsgiContainerException: Cannot start plugin: com.houghtonassociates.bamboo.plugins.gReview

I checked the plugins directory and see the jar for the referenced plugin:

bamboo\home\bundled-plugins\atlassian-bamboo-plugin-git-1.9.9.jar

How am I supposed to load this plugin and still maintain backwards compatibility?

Why is there a reference to a tiny URL which doesn't exist? http://confluence.atlassian.com/x/1xy6D

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
Answer accepted
Joe Clark
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 5, 2012

Hi Jason,

At compile time, your classpath dependencies are controlled by maven. At runtime, your classpath dependencies are controlled by OSGi. There is quite a lot of documentation floating around on OSGI, Spring, Atlassian plugins, and how they all fit together. For example, you may like to browse through:

When your plugin is installed, the Atlassian plugin framework does some byte-code scanning and other trickery to look at your plugin and try to build an appropriate OSGI bundle and corresponding manifest. This manifest is what explicitily lists the dependencies that your plugin requires at runtime. The auto-generated manifest is not very intelligent and can, in circumstances like this, fail to generate what you require.

The solution is to take over from the automatic process and provide instructions in the atlassian-plugin.xml on what you want to be specified in the manifest. For information on how to do this, have a look at the documentation on:

You need to add an Import-Package element to your bundle instructions that specifies a version range to your dependency on the bamboo-git-plugin. For example:

<atlassian-plugin name="My Plugin" key="com.example.plugin" plugins-version="2">
    <plugin-info>
        <version>${project.version}</version>
        <bundle-instructions>
            <Import-Package>
              com.atlassian.bamboo.plugins.git;version="[1.8.18,1.9.9]"
            </Import-Package>
        </bundle-instructions>
    </plugin-info>
</atlassian-plugin>

This instruction tells OSGi and the plugins framework that your plugin requires classes from the com.atlassian.bamboo.plugins.git package, but that the dependency can be satisfied with either version 1.8.18 or 1.9.9 of that package (and anything in between). The automatically generated manifest does not include this version range, and explicitly adds the version that was found in your pom.xml.

Also note that once you specify bundle-instructions in your plugin XML, you now have to list all the dependencies you want to import - including those from bamboo core. This completely overrides the automatic manifest generation.

Jason Huntley
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 6, 2012

Hi Joseph, thanks for the input! Definitely gonna check this out, looks like the answer. I'll come back and be sure to credit you once I read further.

Joe Clark
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 6, 2012

Great! I was kind of writing off-the-cuff, so not sure the solution is 100% accurate. Please come back if you run into any problems.

Jason Huntley
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 6, 2012

Do I specify the git dependency in both the pom.xml and atlassian-plugin.xml?

Joe Clark
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 6, 2012

Yes, you need the git plugin dependency in your pom.xml so that you can actually compile against it. Then you need to list the package names that you use in the atlassian-plugin.xml so that Bamboo's plugin framework knows how to connect the 'wires' between the two plugins at runtime.

Jason Huntley
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 7, 2012

Worked Thanks!

TAGS
AUG Leaders

Atlassian Community Events