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

Create bamboo plugin tutorial

nmarquesantos December 10, 2017

I've followed the tutorial explained here: https://developer.atlassian.com/bamboodev/bamboo-tasks-api/writing-a-task-with-a-user-interface

 

After opening the project on my IDE, I found that the dependencies were not resolved properly for some reason, so had to update my pom.xml to the following:

 

<?xml version="1.0" encoding="UTF-8"?>

<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>
<groupId>helloworld</groupId>
<artifactId>helloworld</artifactId>
<version>1.0.0-SNAPSHOT</version>

<organization>
<name>Example Company</name>
<url>http://www.example.com/</url>
</organization>

<name>helloworld</name>
<description>This is the helloworld:helloworld plugin for Atlassian Bamboo.</description>
<packaging>atlassian-plugin</packaging>

<properties>
<bamboo.version>6.2.2</bamboo.version>
<bamboo.data.version>6.2.2</bamboo.data.version>
<amps.version>6.3.3</amps.version>
<plugin.testrunner.version>2.0.1</plugin.testrunner.version>
<atlassian.spring.scanner.version>1.2.13</atlassian.spring.scanner.version>
<!-- This key is used to keep the consistency between the key in atlassian-plugin.xml and the key to generate bundle. -->
<atlassian.plugin.key>${project.groupId}.${project.artifactId}</atlassian.plugin.key>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
<dependency>
<groupId>com.atlassian.bamboo</groupId>
<artifactId>atlassian-bamboo-web</artifactId>
<version>${bamboo.version}</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>com.atlassian.plugin</groupId>
<artifactId>atlassian-spring-scanner-annotation</artifactId>
<version>${atlassian.spring.scanner.version}</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>com.atlassian.plugin</groupId>
<artifactId>atlassian-spring-scanner-runtime</artifactId>
<version>${atlassian.spring.scanner.version}</version>
<scope>runtime</scope>
</dependency>

<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<version>1</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<scope>test</scope>
</dependency>

<!-- WIRED TEST RUNNER DEPENDENCIES -->
<!-- https://mvnrepository.com/artifact/com.atlassian.plugins/atlassian-plugins-osgi-testrunner -->
<dependency>
<groupId>com.atlassian.plugins</groupId>
<artifactId>atlassian-plugins-osgi-testrunner</artifactId>
<version>2.0.1</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>jsr311-api</artifactId>
<version>1.1.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.2.2-atlassian-1</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>com.atlassian.maven.plugins</groupId>
<artifactId>maven-bamboo-plugin</artifactId>
<version>${amps.version}</version>
<extensions>true</extensions>
<configuration>
<productVersion>${bamboo.version}</productVersion>
<productDataVersion>${bamboo.data.version}</productDataVersion>
<enableQuickReload>true</enableQuickReload>
<enableFastdev>false</enableFastdev>

<!-- See here for an explanation of default instructions: -->
<!-- https://developer.atlassian.com/docs/advanced-topics/configuration-of-instructions-in-atlassian-plugins -->
<instructions>
<Atlassian-Plugin-Key>${atlassian.plugin.key}</Atlassian-Plugin-Key>

<!-- Add package to export here -->
<Export-Package>
helloworld.api,
</Export-Package>

<!-- Add package import here -->
<Import-Package>
org.springframework.osgi.*;resolution:="optional",
org.eclipse.gemini.blueprint.*;resolution:="optional",
*
</Import-Package>

<!-- Ensure plugin is spring powered -->
<Spring-Context>*</Spring-Context>
</instructions>
</configuration>
</plugin>

<plugin>
<groupId>com.atlassian.plugin</groupId>
<artifactId>atlassian-spring-scanner-maven-plugin</artifactId>
<version>${atlassian.spring.scanner.version}</version>
<executions>
<execution>
<goals>
<goal>atlassian-spring-scanner</goal>
</goals>
<phase>process-classes</phase>
</execution>
</executions>
<configuration>
<scannedDependencies>
<dependency>
<groupId>com.atlassian.plugin</groupId>
<artifactId>atlassian-spring-scanner-external-jar</artifactId>
</dependency>
</scannedDependencies>
<verbose>false</verbose>
</configuration>
</plugin>
</plugins>
</build>


<pluginRepositories>

<pluginRepository>

<id>atlassian-public</id>

<url>https://m2proxy.atlassian.com/repository/public/</url>

<releases>

<enabled>true</enabled>

</releases>

<snapshots>

<enabled>true</enabled>

</snapshots>

</pluginRepository>

</pluginRepositories>
</project>

I needed to add the pluginRepository element.

After that, I execute atlas-run on the project root and bamboo starts successfully.

However, I'm unable to find the helloworld task. I've logged in as the admin user

Here is the atlassian-plugin.xml, left untouched:

<atlassian-plugin key="${atlassian.plugin.key}" name="${project.name}" plugins-version="2">
<plugin-info>
<description>${project.description}</description>
<version>${project.version}</version>
<vendor name="${project.organization.name}" url="${project.organization.url}" />
<param name="plugin-icon">images/pluginIcon.png</param>
<param name="plugin-logo">images/pluginLogo.png</param>
</plugin-info>

<!-- add our i18n resource -->
<resource type="i18n" name="i18n" location="helloworld"/>

<!-- add our web resources -->
<web-resource key="helloworld-resources" name="helloworld Web Resources">
<dependency>com.atlassian.auiplugin:ajs</dependency>

<resource type="download" name="helloworld.css" location="/css/helloworld.css"/>
<resource type="download" name="helloworld.js" location="/js/helloworld.js"/>
<resource type="download" name="images/" location="/images"/>

<context>helloworld</context>
</web-resource>

</atlassian-plugin>

Any help would be greatly appreciated :)

2 answers

1 vote
xetius January 2, 2018

I had a similar problem.  Turned out that something I added meant that the OSGI configuration was broken and the plugin was not loading.  Was not the most obvious.  Try using atlas-debug --product bamboo and examine the output log.

 

I had to add the following to the POM

<Import-Package>
org.springframework.osgi.*;resolution:="optional",
org.eclipse.gemini.blueprint.*;resolution:="optional",
*;version="0";resolution:=optional
</Import-Package>
0 votes
Steffen Opel _Utoolity_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 10, 2017

Unfortunately the example 'helloworld' task implementation formerly included within 'atlas-create-bamboo-plugin' got removed from the SDK at some point, even though this "most relevant and most frequently implemented extension point" is still not available via 'atlas-create-bamboo-plugin-module' as of today - please watch and vote for the following issue to increase Atlassian's priority regarding this notable SDK flaw:

As a workaround, I recommend to instead follow the Introduction to writing Tasks tutorial and/or check out one of the open source apps that are using the task plugin module type for inspiration, for example:

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events