Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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

Thanks for letting us know!

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bamboo

Bamboo Data Center - Early Access Program

G’day Bamboo customers, The wait is almost over! We are in the final stages of work on the first release of Bamboo Data Center, our self-managed enterprise offering of Bamboo. This Data Center offe...

967 views 0 16
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you