I try to access the ServiceDeskPermissionService in a Plugin but is always returns the Exception java.lang.ClassNotFoundException: com.atlassian.servicedesk.api.permission.ServiceDeskPermissionService
This is my POM:
<dependencies>
<dependency>
<groupId>com.atlassian.jira</groupId>
<artifactId>jira-api</artifactId>
<version>${jira.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.atlassian.jira</groupId>
<artifactId>jira-core</artifactId>
<version>${jira.version}</version>
<scope>provided</scope>
</dependency>
<!-- Add dependency on jira-core if you want access to JIRA implementation classes as well as the sanctioned API. -->
<!-- This is not normally recommended, but may be required eg when migrating a plugin originally developed against JIRA 4.x -->
<dependency>
<groupId>com.atlassian.servicedesk</groupId>
<artifactId>jira-servicedesk-api</artifactId>
<version>4.7.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.konghq</groupId>
<artifactId>unirest-java</artifactId>
<version>3.6.01</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<scope>test</scope>
</dependency>
<!-- WIRED TEST RUNNER DEPENDENCIES -->
<dependency>
<groupId>com.atlassian.plugins</groupId>
<artifactId>atlassian-plugins-osgi-testrunner</artifactId>
<version>2.0.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<version>1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
<version>2.1.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.10</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
<version>4.5.10</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.4.12</version>
<scope>provided</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.8.6</version>
</dependency>
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>8.2.1.jre8</version>
<scope>provided</scope>
</dependency>
<!-- Added for Authenticator -->
<dependency>
<groupId>com.atlassian.crowd</groupId>
<artifactId>embedded-crowd-api</artifactId>
<version>2.10.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.atlassian.seraph</groupId>
<artifactId>atlassian-seraph</artifactId>
<version>2.6.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.10.19</version>
<scope>test</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-servicedesk</applicationKey>
<version>${servicedesk.version}</version>
</application>
</applications>
<allowGoogleTracking>false</allowGoogleTracking>
<extractDependencies>true</extractDependencies>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<jira.version>8.7.1</jira.version>
<amps.version>8.1.0</amps.version>
<servicedesk.version>4.7.1</servicedesk.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>
And this is how I try to access the ServiceDeskPermissionService
ServiceDeskPermissionService serviceDeskPermissionService = ComponentAccessor.getOSGiComponentInstanceOfType(ServiceDeskPermissionService.class);
The same happens when i try to access the CustomerService.
I also tried to access the ServiceDesk api by spring scanner
@ComponentImport
private final ApplicationProperties applicationProperties;
@ComponentImport
private final UserService userService;
@ComponentImport
private final CustomerService customerService;
@ComponentImport
private final UserManager userManager;
@ComponentImport
private final ServiceDeskManager serviceDeskManager;
@Inject
public HSETUAuthenticatorComponentImpl(final ApplicationProperties applicationProperties, final UserService userService, final CustomerService customerService, final UserManager userManager, final ServiceDeskManager serviceDeskManager)
{
this.applicationProperties = applicationProperties;
this.userService = userService;
this.customerService = customerService;
this.userManager = userManager;
this.serviceDeskManager = serviceDeskManager;
}
CustomerService will not be injected, and returns a classdefnotfoundexpection
POM excerpt:
<dependency>
<groupId>com.atlassian.servicedesk</groupId>
<artifactId>jira-servicedesk-api</artifactId>
<version>4.7.1</version>
<scope>provided</scope>
</dependency>
I use the jiraservicedesk from here https://www.atlassian.com/de/software/jira/service-desk/download, Version 4.7.1
I hope this information is sufficient to solve the problem. If further information is necessary I will gladly provide it.