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

Getting maven build errors when trying to run atlassian plugin

Hi,

I'm new to Atlassian plugins so I thought I would start by compiling and running the hello world plugin that atlassian provides as a tutorial: https://developer.atlassian.com/server/framework/atlassian-sdk/create-a-helloworld-plugin-project/

 

I have JDK 9 and MVN 3.3 running. I've followed all the instructions on that tutorial, however, I am presented with the following errors and am unable to understand what is going wrong:

[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[WARNING] The POM for com.atlassian.maven.plugins:maven-confluence-plugin:jar:6.3.15 is missing, no dependency information available
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[ERROR] Unresolveable build extension: Plugin com.atlassian.maven.plugins:maven-confluence-plugin:6.3.15 or one of its dependencies could not be resolved: Failure to find com.atlassian.maven.plugins:maven-confluence-plugin:jar:6.3.15 in https:/
/repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced @
[ERROR] Unknown packaging: atlassian-plugin @ line 19, column 16

 Below is my POM file: 

 <?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>com.atlassian.test</groupId>
<artifactId>myPlugin</artifactId>
<version>1.0.0-SNAPSHOT</version>

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

<name>myPlugin</name>
<description>This is the com.atlassian.test:myPlugin plugin for Atlassian Confluence.</description>
<packaging>atlassian-plugin</packaging>

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.atlassian.confluence</groupId>
<artifactId>confluence</artifactId>
<version>${confluence.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>

<!-- WIRED TEST RUNNER DEPENDENCIES -->
<dependency>
<groupId>com.atlassian.plugins</groupId>
<artifactId>atlassian-plugins-osgi-testrunner</artifactId>
<version>${plugin.testrunner.version}</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-confluence-plugin</artifactId>
<version>${amps.version}</version>
<extensions>true</extensions>
<configuration>
<productVersion>${confluence.version}</productVersion>
<productDataVersion>${confluence.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>
com.atlassian.test.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>

<properties>
<confluence.version>6.7.1</confluence.version>
<confluence.data.version>6.7.1</confluence.data.version>
<amps.version>6.3.15</amps.version>
<plugin.testrunner.version>1.2.3</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>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>

</project>

 Any help would be appreciated, thanks!

1 answer

1 accepted

6 votes
Answer accepted

Figured out that I needed to switch to JDK 1.8 and have the following in my pom.xml:


<repositories>
<repository>
<releases>
<enabled>true</enabled>
<checksumPolicy>warn</checksumPolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
<checksumPolicy>warn</checksumPolicy>
</snapshots>
<id>atlassian-public</id>
<url>https://maven.atlassian.com/repository/public</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<releases>
<enabled>true</enabled>
<checksumPolicy>warn</checksumPolicy>
</releases>
<snapshots>
<updatePolicy>never</updatePolicy>
<checksumPolicy>warn</checksumPolicy>
</snapshots>
<id>atlassian-public</id>
<url>https://maven.atlassian.com/repository/public</url>
</pluginRepository>
</pluginRepositories>


<dependency>
<groupId>com.atlassian.sal</groupId>
<artifactId>sal-api</artifactId>
<version>2.0.17</version>
<scope>provided</scope>
</dependency>

  and added this to my atlassian-plugin.xml file (in src/main/resources and under plugin-info tag) for good measure:

<bundle-instructions>
<Import-Package>
com.atlassian.plugin.osgi.bridge.external,
com.atlassian.sal.api,
com.atlassian.sal.api.auth,
com.atlassian.sal.api.pluginsettings,
com.atlassian.sal.api.transaction,
com.atlassian.sal.api.user,
com.atlassian.templaterenderer;resolution:="optional",
com.atlassian.templaterenderer.velocity.one.six,
com.blackducksoftware.integration.build;resolution:="optional",
com.blackducksoftware.integration.build.extractor;resolution:="optional",
com.sun.net.httpserver;resolution:="optional",
com.thoughtworks.xstream;resolution:="optional",
com.thoughtworks.xstream.io;resolution:="optional",
com.thoughtworks.xstream.io.xml;resolution:="optional",
javax.crypto;resolution:="optional",
javax.net.ssl;resolution:="optional",
javax.net;resolution:="optional",
javax.security.auth.x500;resolution:="optional",
javax.servlet;resolution:="optional",
javax.servlet.http;resolution:="optional",
javax.ws.rs;resolution:="optional",
javax.ws.rs.core;resolution:="optional",
javax.xml.bind.annotation;resolution:="optional",
javax.xml.namespace;resolution:="optional",
javax.xml.parsers;resolution:="optional",
javax.xml.transform;resolution:="optional",
javax.xml.transform.sax;resolution:="optional",
javax.xml.transform.stream;resolution:="optional",
javax.xml.xpath;resolution:="optional",
org.w3c.dom;resolution:="optional",
org.w3c.dom.ls;resolution:="optional",
org.xml.sax;resolution:="optional",
org.xml.sax.ext;resolution:="optional",
org.xml.sax.helpers;resolution:="optional",
sun.misc;resolution:="optional"
</Import-Package>
</bundle-instructions>

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Posted in Confluence

What project did you transition or start on Confluence with the shift to remote work?

It’s been great to hear from fellow users over the last few weeks about the best tips and fun moments you’ve had working on Confluence since the transition to working remote. I’d love to keep the c...

109 views 3 7
Join discussion

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