Hi Team,
I am trying to create a skeleton plugin using this Jira Doc tutor after following step by step process & getting error stating:-
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile (default-compile) on project version-math-plugin: Compilation failure: Compilation failure:
[ERROR] /D:/GtNexusPlugins/VersionMath3/version-math-plugin/src/main/java/com/infornexus/plugins/IssueCreatedResolvedListener.java:[20,8] class, interface, or enum expected
[ERROR] /D:/GtNexusPlugins/VersionMath3/version-math-plugin/src/main/java/com/infornexus/plugins/IssueCreatedResolvedListener.java:[20,49] class, interface, or enum expected
[ERROR] /D:/GtNexusPlugins/VersionMath3/version-math-plugin/src/main/java/com/infornexus/plugins/IssueCreatedResolvedListener.java:[22,1] class, interface, or enum expected
[ERROR] /D:/GtNexusPlugins/VersionMath3/version-math-plugin/src/main/java/com/infornexus/plugins/IssueCreatedResolvedListener.java:[25,8] class, interface, or enum expected
[ERROR] /D:/GtNexusPlugins/VersionMath3/version-math-plugin/src/main/java/com/infornexus/plugins/IssueCreatedResolvedListener.java:[27,4] class, interface, or enum expected
[ERROR] /D:/GtNexusPlugins/VersionMath3/version-math-plugin/src/main/java/com/infornexus/plugins/IssueCreatedResolvedListener.java:[29,4] class, interface, or enum expected
[ERROR] /D:/GtNexusPlugins/VersionMath3/version-math-plugin/src/main/java/com/infornexus/plugins/IssueCreatedResolvedListener.java:[31,4] class, interface, or enum expected
[ERROR] /D:/GtNexusPlugins/VersionMath3/version-math-plugin/src/main/java/com/infornexus/plugins/IssueCreatedResolvedListener.java:[33,4] class, interface, or enum expected
[ERROR] /D:/GtNexusPlugins/VersionMath3/version-math-plugin/src/main/java/com/infornexus/plugins/IssueCreatedResolvedListener.java:[35,4] class, interface, or enum expected
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>com.infornexus.plugins</groupId>
<artifactId>version-math-plugin</artifactId>
<version>1.0.0-SNAPSHOT</version>
<organization>
<name>Infor</name>
<url>http://www.infor.com/</url>
</organization>
<name>version-math-plugin</name>
<description>This is the com.infornexus.plugins:version-math-plugin 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>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>4.3.6.RELEASE</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.jira</groupId>
<artifactId>jira-core</artifactId>
<version>${jira.version}</version>
<scope>provided</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>${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>
<!-- Uncomment to use TestKit in your project. Details at https://bitbucket.org/atlassian/jira-testkit -->
<!-- You can read more about TestKit at https://developer.atlassian.com/display/JIRADEV/Plugin+Tutorial+-+Smarter+integration+testing+with+TestKit -->
<!--
<dependency>
<groupId>com.atlassian.jira.tests</groupId>
<artifactId>jira-testkit-client</artifactId>
<version>${testkit.version}</version>
<scope>test</scope>
</dependency>
-->
</dependencies>
<build>
<plugins>
<plugin>
<groupId>com.atlassian.maven.plugins</groupId>
<artifactId>maven-jira-plugin</artifactId>
<version>${amps.version}</version>
<extensions>true</extensions>
<configuration>
<productVersion>${jira.version}</productVersion>
<productDataVersion>${jira.version}</productDataVersion>
<log4jProperties>src/aps/log4j.properties</log4jProperties>
<enableQuickReload>true</enableQuickReload>
<enableFastdev>false</enableFastdev>
<!-- Uncomment to install TestKit backdoor in JIRA. -->
<!--
<pluginArtifacts>
<pluginArtifact>
<groupId>com.atlassian.jira.tests</groupId>
<artifactId>jira-testkit-plugin</artifactId>
<version>${testkit.version}</version>
</pluginArtifact>
</pluginArtifacts>
-->
<instructions>
<Atlassian-Plugin-Key>${atlassian.plugin.key}</Atlassian-Plugin-Key>
<Export-Package>
com.example.tutorial.plugins.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>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<jira.version>7.5.1</jira.version>
<amps.version>5.1.18</amps.version>
<plugin.testrunner.version>1.2.3</plugin.testrunner.version>
<!-- TestKit version 6.x for JIRA 6.x -->
<testkit.version>6.3.11</testkit.version>
</properties>
</project>
IssueCreatedResolvedListener.java
.
package com.infornexus.plugins;
import com.atlassian.event.api.EventListener;
import com.atlassian.event.api.EventPublisher;
import com.atlassian.jira.event.issue.IssueEvent;
import com.atlassian.jira.event.type.EventType;
import com.atlassian.jira.issue.Issue;
import com.atlassian.plugin.spring.scanner.annotation.imports.JiraImport;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class IssueCreatedResolvedListener {
private static final Logger log = LoggerFactory.getLogger(IssueCreatedResolvedListener.class);
}
@Autowired
public IssueCreatedResolvedListener(@JiraImport EventPublisher eventPublisher) {
eventPublisher.register(this); // Demonstration only -- don't do this in real code!
}
@EventListener
public void onIssueEvent(IssueEvent issueEvent) {
Long eventTypeId = issueEvent.getEventTypeId();
Issue issue = issueEvent.getIssue();
if (eventTypeId.equals(EventType.ISSUE_CREATED_ID)) {
log.info("Issue {} has been created at {}.", issue.getKey(), issue.getCreated());
} else if (eventTypeId.equals(EventType.ISSUE_RESOLVED_ID)) {
log.info("Issue {} has been resolved at {}.", issue.getKey(), issue.getResolutionDate());
} else if (eventTypeId.equals(EventType.ISSUE_CLOSED_ID)) {
log.info("Issue {} has been closed at {}.", issue.getKey(), issue.getUpdated());
}
}
Can someone help what I have been doing wrong?
Regards
Tejas