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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,553,798
Community Members
 
Community Events
184
Community Groups

spring-scanner and shading in bamboo plugin

Edited
Deleted user Jan 20, 2018

Using the Atlassian SDK, I was able to successfully deploy a Bamboo plugin with a single task that injects EventPublisher using atlassian-spring-scanner 1.2.13.  Hooray!

Unfortunatly, when I attempted to integrate the same logic into an existing plugin that is fairly complex, things did not work so well.  What is different about this plugin is that it is using shading which causes the maven package task to hang when generating the manifest.

[INFO] Generating a manifest for this plugin
[INFO] using maven-bundle-plugin v2.5.3

According to this stackoverflow post, it is due to the order of the bamboo-maven-plugin which executes before shading has occured.

https://stackoverflow.com/questions/18280608/using-maven-bundle-plugin-with-the-maven-shade-plugin

I've tried most of the suggestions in this post (the ones I understand anyway) without much luck.  So basically my question is, what do I need to do in order to use maven-bamboo-plugin to prep the osgi dependencies in order to use atlassian-spring-scanner while still working with shading.

The relevant parts of my package are listed below.

 

 <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></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>
<!-- It appears upber jars are needed for Bamboo plugins -->
<!-- https://bitbucket.org/dehringer/bamboo-cloudfoundry-plugin/src/99b93a6aba4f7abfec3055da06303f5dba3fc5f9/pom.xml?at=master -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<!-- needed to make the shaded dependencies available on the remote
agent classpath -->
<!-- don't understand why this is necessary, but the plugin throws
a NoClassDef without it -->
<configuration>
<relocations>
<relocation>
<pattern>org.springframework</pattern>
<shadedPattern>com.shaded.cf.services.org.springframework</shadedPattern>
</relocation>
<relocation>
<pattern>org.apache.velocity</pattern>
<shadedPattern>com.shaded.cf.services.org.apache.velocity</shadedPattern>
</relocation>
</relocations>
<!-- exclude signatures of shaded jars -->
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
<exclude>META-INF/*.EC</exclude>
</excludes>
</filter>
</filters>
<!-- Unnecessary jars can cause errors with class loading on the remote
agents. These are getting pulled in as test dependencies -->
<artifactSet>
<excludes>
<exclude>org.slf4j:slf4j-api</exclude>
<exclude>junit:junit</exclude>
<exclude>org.easymock</exclude>
<exclude>cglib:cglib-nodep</exclude>
<exclude>org.powermock</exclude>
<exclude>org.jacoco</exclude>
<exclude>org.springframework:spring-test</exclude>
<exclude>org.hamcrest</exclude>
<exclude>org.springframework:spring-core</exclude>
<exclude>org.objenesis:objenesis</exclude>
<exclude>org.javassist:javassist</exclude>
</excludes>
</artifactSet>
</configuration>
</execution>
</executions>
</plugin>
</plugins>

 

1 answer

1 accepted

1 vote
Answer accepted
Deleted user Jan 24, 2018

For anyone stumbling here, it appears that the manifest creation did actually complete but it took quite a long time (30 seconds or so).   Ultimately, I ended up creating my own EmailService instead of using the atlassian wired EventPublisher service due to:

 

https://community.atlassian.com/t5/Bamboo-questions/EventPublisher-spring-scanner-and-remote-bamboo-agents/qaq-p/708714#M17004

somethingblue
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Jan 25, 2018

Thanks for letting us know!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events