J Fabian Meier
J Fabian Meier

Reputation: 35785

Adding dependency for Jira plugin

With the SDK 6.3.10, I am trying to develop a plugin for Jira 7.x.

This plugin should use an external Java dependency named "svnkit". I added it as dependency in the pom (this should be enough if I understood https://developer.atlassian.com/server/framework/atlassian-sdk/managing-dependencies/ correctly):

<dependency>
  <groupId>com.svnkit</groupId>
  <artifactId>svnkit</artifactId>
  <version>1.1.0</version>
</dependency>

Now I get the message in the atlas-run logs:

[INFO] [talledLocalContainer] 2018-07-04 16:50:55,310 http-nio-2990-exec-3 ERROR anonymous 1010x2x1 - 0:0:0:0:0:0:0:1 /secure/DemoAction!default.jspa [c.a.j.web
.dispatcher.JiraWebworkActionDispatcher] Exception thrown from action 'DemoAction!default', returning 404
[INFO] [talledLocalContainer] WebworkConfigurationNotFoundException{class=class webwork.config.XMLActionConfiguration, message='No such view mapping', name='Dem
oAction.actionRoles.actionRoles'}

The plugin itself returns a 404 page in the browser. Without the svnkit, everything works in the browser. Note that I have not used svnkit in the Java code.

I haven't got the slightest clue what this message means or where I such search for a remedy.

Upvotes: 2

Views: 1138

Answers (1)

Bazyl
Bazyl

Reputation: 78

First, you need to know exactly where and when the svnkit library to be used, and what is the purpose this library in your project. With the information you provide, I can only distantly guide you to the right solution.

In JIRA/OSGI world you have basically two options:

  1. You compile the library together with your code so that bytecode of your project and bytecode of library you used got packed together into JAR file as a result of atlas-package (mvn package). I skipped any other resources for clarity.
  2. You compile your project but final JAR contains only bytecode of your project plus explicit information that the dependent library will already be present in the environment that the JAR was launched.

In your case, I presume svnkit library is not present in JIRA that you want to run your plugin/JAR. That mean, you need to provide it by yourself. The pretty/recommended way is to:

  1. Prepare svnkit to be OSGI ready, the JAR needs to be valid OSGI bundle. (You can find such bundle already prepared somewhere in Atlassian maven repository or somewhere in the Internet)
  2. In your pom.xml add this dependency with scope provided: eg.:

    <dependency>
        <groupId>com.svnkit</groupId>
        <artifactId>svnkit</artifactId>
        <version>1.1.0</version>
        <scope>provided</scope>
    </dependency>
    
  3. Add configuration for maven-amps-plugin (maven-jira-plugin) to pack svnkit as an OSGI bundle dependency

    <build>
        <plugins>
            <plugin>
                <groupId>com.atlassian.maven.plugins</groupId>
                <artifactId>maven-jira-plugin</artifactId>
                <version>${amps.version}</version>
                <configuration>
                    <extractDependencies>false</extractDependencies>
                    <pluginDependencies>
                        <pluginDependency>
                            <groupId>...</groupId>
                            <artifactId>...</artifactId>
                        </pluginDependency>
                    </pluginDependencies>
                ...
                </configuration>
            </plugin>
        </plugins>
    </build>
    

    In that way atlas-package will produce also an OBR file which will contain your project JAR plus svnkit bundle See also: https://developer.atlassian.com/server/framework/atlassian-sdk/bundling-extra-dependencies-in-an-obr/

And be warned that this:

    <dependency>
        <groupId>com.svnkit</groupId>
        <artifactId>svnkit</artifactId>
        <version>1.1.0</version>
    </dependency>

means exactly the same as:

    <dependency>
        <groupId>com.svnkit</groupId>
        <artifactId>svnkit</artifactId>
        <version>1.1.0</version>
        <scope>compile</scope>
    </dependency>

which means that svnkit will be included in your JAR straight or as sub-JAR (JAR in JAR)

Your logs, on the other hand, points out that you have misconfigured your DemoAction. It would be better if you provide pom.xml together with atlassian-plugin.xml to let us better understand your problem.

Upvotes: 2

Related Questions