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 does not work in jira 8.0.0 Edited

Hello. There is a simple plugin with rest api module. Built without errors, running on localhost debug jira 8.0.0.
Does not work when I install on a working jira updated to 8.0.0.

I can't understand the reasons, explain?

pom.xml

<?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>pl8</groupId>
<artifactId>pl8</artifactId>
<version>1.0.5</version>

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

<name>pl8</name>
<description>This is the pl8:pl8 plugin for Atlassian JIRA.</description>
<packaging>atlassian-plugin</packaging>

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

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.atlassian.plugin</groupId>
<artifactId>atlassian-spring-scanner-annotation</artifactId>
<version>${atlassian.spring.scanner.version}</version>
<scope>provided</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>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>com.atlassian.maven.plugins</groupId>
<artifactId>jira-maven-plugin</artifactId>
<version>${amps.version}</version>
<extensions>true</extensions>
<configuration>
<applications>
<application>
<applicationKey>jira-software</applicationKey>
<version>${jira.version}</version>
</application>
</applications>
<productVersion>${jira.version}</productVersion>
<productDataVersion>${jira.version}</productDataVersion>

<enableQuickReload>true</enableQuickReload>

<instructions>
<Atlassian-Plugin-Key>${atlassian.plugin.key}</Atlassian-Plugin-Key>

<Export-Package>
com.plugin.test.api.*,
</Export-Package>

<Import-Package>
org.springframework.osgi.*;resolution:="optional",
org.eclipse.gemini.blueprint.*;resolution:="optional",
*
</Import-Package>

<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>
<dependency>
<groupId>com.atlassian.plugin</groupId>
<artifactId>atlassian-spring-scanner-test-example-external-jar</artifactId>
</dependency>
</scannedDependencies>
<verbose>false</verbose>
<includeExclude>+com.atlassian.jira.plugins.issue.create.*</includeExclude>
<includeExclude>-com.atlassian.plugin.spring.scanner.annotation.*</includeExclude>
</configuration>
</plugin>
</plugins>
</build>

<properties>
<jira.version>8.0.0</jira.version>
<amps.version>8.0.0</amps.version>
<plugin.testrunner.version>2.0.1</plugin.testrunner.version>
<atlassian.spring.scanner.version>2.1.7</atlassian.spring.scanner.version>
<spring.version>5.0.10.RELEASE</spring.version>

<atlassian.plugin.key>${project.groupId}.${project.artifactId}</atlassian.plugin.key>

<testkit.version>6.3.11</testkit.version>
<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>

atlassian-plugin.xml

<atlassian-plugin key="${atlassian.plugin.key}" name="${project.name}" plugins-version="2">
...

<rest key="dataBodyConf" version="1.0" path="/data">
<description>Rest API</description>
</rest>

</atlassian-plugin>

class rest

package com.plugin.test;

import com.atlassian.jira.bc.filter.SearchRequestService;
import com.atlassian.jira.jql.parser.JqlQueryParser;
import com.atlassian.plugin.spring.scanner.annotation.imports.ComponentImport;
import com.atlassian.sal.api.user.UserManager;
import com.plugin.test.api.MyPluginComponent;
import org.springframework.beans.factory.annotation.Autowired;

import javax.inject.Inject;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;

@Path("/pl")
@Consumes({MediaType.APPLICATION_JSON})
@Produces({MediaType.APPLICATION_JSON})

public class RestField {

private final UserManager userManager;
private final SearchRequestService searchRequestService;
private final JqlQueryParser jqlQueryParser;
private final MyPluginComponent myPluginComponent;

public RestField(@ComponentImport UserManager userManager, @ComponentImport SearchRequestService searchRequestService,
@ComponentImport JqlQueryParser jqlQueryParser, final MyPluginComponent myPluginComponent) {
this.userManager = userManager;
this.searchRequestService = searchRequestService;
this.jqlQueryParser = jqlQueryParser;
this.myPluginComponent = myPluginComponent;
}

@GET
@Path("/test")
public Response test() {
return Response.ok("{\"test\" : \"ok\", \"qqq\" : \"" + myPluginComponent.getName() + "\"}").build();
}
} 

 

1 answer

Did you solve the issue? Could you please share the skeleton for jira plugin + spring? can't make it works :(  

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Jira

The add-in you’ve been waiting for: Jira Cloud for Excel 🙌

Introducing Jira Cloud for Excel Here at the product integrations team at Atlassian, we are thrilled to announce the new Jira Cloud for Excel add-in! This add-in lets you export Jira data directly ...

932 views 8 25
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