e.g follow the instructions from the Confluence ‘Hello World’ Macro or Jira ‘Hello World’ Macro
open pom.xml file and change/add on the configuration of the maven plugin:
add your dependencies as normal - like:
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-collections4 -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
<version>4.4</version>
</dependency>
on this section:
<plugins>
<plugin>
<groupId>com.atlassian.maven.plugins</groupId>
<artifactId>confluence-maven-plugin</artifactId>
<version>${amps.version}</version>
<extensions>true</extensions>
<configuration>
- add
<extractDependencies>false</extractDependencies>
- remove the
<Import-Package>...</Import-Package>
(will be created automatically - that’s what maven is for…) - add
<Bundle-ClassPath>.,{maven-dependencies}</Bundle-ClassPath>
<Embed-Dependency>*;scope=runtime</Embed-Dependency>
<Embed-Directory>META-INF/lib</Embed-Directory>
result should look like this for conflunence:
<plugin>
<groupId>com.atlassian.maven.plugins</groupId>
<artifactId>confluence-maven-plugin</artifactId>
<version>${amps.version}</version>
<extensions>true</extensions>
<configuration>
<productVersion>${confluence.version}</productVersion>
<productDataVersion>${confluence.data.version}</productDataVersion>
<enableQuickReload>true</enableQuickReload>
<extractDependencies>false</extractDependencies>
<!-- 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.myown.api
</Export-Package>
-->
<!-- Add package import here -->
<Bundle-ClassPath>.,{maven-dependencies}</Bundle-ClassPath>
<Embed-Dependency>*;scope=runtime</Embed-Dependency>
<Embed-Directory>META-INF/lib</Embed-Directory>
<!-- Ensure plugin is spring powered -->
<Spring-Context>*</Spring-Context>
</instructions>
</configuration>
</plugin>
do the
atlas-clean
atlas-package
In the resulting jar / obr you will find all your dependencies inside jira-helloworld-1.0.0-SNAPSHOT.jar\META-INF\lib\ instead of unpacking and repackage in one new jar (NO GO!)
PS: This Managing dependencies (atlassian.com) results in a big mess of everything in one jar file