hook development in continuous integration environment

We have checked our stash hooks into a git repository. Upon checkin, the post-receive hook kicks off a build in our jenkins environment. When the build gets executed we get errors similar to the following:

[ERROR] 'dependencies.dependency.version' for com.atlassian.stash:stash-api:jar is missing. @ line 28, column 21

I have gone into https://maven.atlassian.com/content/groups/public/com/ and done a mvn install to install an appropriate jar file(the correct version 2.2.0) such as stash-api-2.2.0.jar

Is there a better way to get all of the correct dependencies installed? We are concerned that running atlas-create-stash-plugin from the atlassian-plugin-sdk-4.1.6 will overwrite other versions of packages we have installed.

4 answers

Hi Kevin,

I'm fairly certain that's related purely to your pom.xml configuration, and not the install dependencies. Have you specified the version of stash-api that you want? Your pom.xml should contain an entry like this:

<dependency>
    <groupId>com.atlassian.stash</groupId>
    <artifactId>stash-api</artifactId>
    <version>${stash.version}</version>
    <scope>provided</scope>
</dependency>

You might also want to take a look at some of our Stash plugin examples on Bitbucket which use the dependencyManagement to include stash-parent, which then allows you to omit the version on stash dependencies.

After that running the normal 'mvn package' or 'mvn install' should download all the required dependencies and then compile/test your hook.

I hope this helps. If not please post your pom.xml so we can take a look

Charles

Charles, thank you for looking at this.

Here is the pom. After a number of mvn installs, the build error on jenkins is a java stacktrace:

Building Stash 1.0
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-stash-plugin:4.1.6:copy-bundled-dependencies (default-copy-bundled-dependencies) @ Stash --- Apr 18, 2013 1:58:56 PM org.sonatype.guice.bean.reflect.Logs$JULSink warn
WARNING: Error injecting: com.atlassian.maven.plugins.stash.StashCopyBundledDependenciesMojo
java.lang.TypeNotPresentException: Type com.atlassian.maven.plugins.stash.StashCopyBundledDependenciesMojo not present
	at org.sonatype.guice.bean.reflect.URLClassSpace.loadClass(URLClassSpace.java:109)
.
.
Caused by: java.lang.NoClassDefFoundError: com/atlassian/maven/plugins/amps/CopyBundledDependenciesMojo

Here is our pom.xml

<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"><br< a="">> <modelVersion>4.0.0</modelVersion>
<groupId>oit.se.stash</groupId>
<artifactId>Stash</artifactId>
<version>1.0</version>
<organization>
<name>OITSE</name>
<url>edu/oit</url>
</organization>
<name>Stash</name>
<description>This is the Stash plugin for Atlassian Stash.</description>
<packaging>atlassian-plugin</packaging>

<dependencyManagement>
<dependencies>
<dependency>
...




































































































































Hi Kevin,

Hmm. That appears to work. What version of maven are you using BTW? You can/should use atlas-mvn instead, which is a wrapper around Maven 2.1.0.

Cheers,

Charles

Hi Charles

The jenkins box is using maven 3.0.4. Can you provide a suggestion how I would use atlas-mvn for this build?

Kevin

Hi Kevin,

Apologies, you don't actually need atlas-mvn in this case (it's really for client-side development). Just ensure you have Maven 2.1.0 installed on Jenkins and your plugin should build successfully.

Charles

Hi Charles,

that worked. thanks. we also added this parameter to the jenkins build for the compile goal.

DATLAS_HOME=/usr/local/atlassian_sdk_4.1.6/atlassian-plugin-sdk-4.1.6

thanks again,

Kevin

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Monday in Jira Software

How large do you think Jira Software can grow?

Hi Atlassian Community! My name is Shana, and I’m on the Jira Software team. One of the many reasons this Community exists is to connect you to others on similar product journeys or with comparabl...

419 views 6 10
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you