2016-04-14 7 views
0

Ich versuche, ein benutzerdefiniertes Plugin für Jira, 6.3.15 auf 7.1.4 zu aktualisieren, aber wenn ich das Plugin auf eine jira Testumgebung dann und catalina.out fehlschlagen ist:Plugin erfordert nur Erlaubnis [], die nicht 'execute_java' (JIRA Server 7.1.4) enthält

Plugin only requires permission [] which doesn't include 'execute_java', yet has some java code (classes, libs, spring context, etc), making it un- loadable. 

googeln ich sehe, dass: https://docs.atlassian.com/atlassian-plugins-api/4.0.0-m004/atlassian-plugins-api/apidocs/com/atlassian/plugin/Permissions.html#addPermission(com.atlassian.plugin.Plugin,%20java.lang.String,%20com.atlassian.plugin.InstallationMode)

aber ich verstehe nicht, wie es zu lösen, eine Idee?

Plugin:

import java.util.Date; 

import com.atlassian.jira.component.ComponentAccessor; 
import com.atlassian.jira.event.issue.IssueEvent; 
import com.atlassian.jira.event.type.EventType; 
import com.atlassian.jira.issue.Issue; 
import com.atlassian.jira.issue.worklog.Worklog; 
import com.atlassian.jira.issue.worklog.WorklogImpl; 
import com.atlassian.jira.issue.worklog.WorklogManager; 

import com.atlassian.jira.event.issue.IssueEventListener; 
import org.slf4j.Logger; 
import org.slf4j.LoggerFactory; 

public class AsignedListenerWorklog implements IssueEventListener { 

    private static final Logger logger = LoggerFactory.getLogger(AsignedListenerWorklog.class); 
    protected WorklogManager worklogManager = ComponentAccessor.getWorklogManager(); 

    public void workflowEvent(IssueEvent event) { 
     if (event.getEventTypeId() != EventType.ISSUE_DELETED_ID) { 
      onAssigned(event); 
     } 
    } 
    public boolean isOktoAssign(Issue issue) { 
     if (issue.getAssignee() != null) { 
      for (Worklog w : worklogManager.getByIssue(issue)) { 
       if (w.getUpdateAuthorKey().equals(issue.getAssignee().getName().toLowerCase())) { 
        return false; 
       } 
      } 
      return true; 
     } 
     logger.error("Issue Assigment null"); 
     return false; 
    } 

    public void onAssigned(IssueEvent event) { 
     Issue issue = event.getIssue(); 
     if (isOktoAssign(issue)) { 
      WorklogImpl worklog = new WorklogImpl(
        worklogManager, 
        issue, 
        issue.getId(), 
        issue.getAssignee().getName().toLowerCase(), 
        issue.getSummary(), 
        new Date(), 
        null, 
        null, 
        60L 
      ); 
      logger.info("Add 1m " + worklog.getUpdateAuthor() + " at issue " + issue.getKey()); 
      worklogManager.create(issue.getAssignee(), worklog, 0L, false); 
     } 
    } 
} 

Und POM:

<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>xxx.xxxx</groupId> 
    <artifactId>jira-worklog-plugin</artifactId> 
    <name>Worklog Plugin</name> 
    <version>3.0</version> 
    <description>Plugin</description> 
    <repositories> 
     <repository> 
      <id>atlassian</id> 
      <url>https://maven.atlassian.com/content/repositories/atlassian-public</url> 
     </repository> 
     <repository> 
      <id>antoher</id> 
      <url>https://maven.atlassian.com/content/groups/public</url> 
     </repository> 
     <repository> 
      <id>public</id> 
      <url>nexus</url> 
     </repository> 
    </repositories> 
    <dependencies> 
     <dependency> 
      <groupId>com.atlassian.jira</groupId> 
      <artifactId>jira-api</artifactId> 
      <version>7.1.4</version> 
      <scope>provided</scope> 
     </dependency> 
     <dependency> 
      <groupId>com.atlassian.jira</groupId> 
      <artifactId>jira-core</artifactId> 
      <version>7.1.4</version> 
      <scope>provided</scope> 
     </dependency> 
    </dependencies> 
    <distributionManagement> 
     <repository> 
      <id>releases</id> 
      <url>nexus</url> 
     </repository> 
    </distributionManagement> 
</project> 

atlassian-plugin.xml:

<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>xxx.xxx</groupId> 
    <artifactId>jira-worklog-plugin</artifactId> 
    <name>Worklog Plugin</name> 
    <version>3.0</version> 
    <description>Plugin for update workflow on assigned issue</description> 
    <repositories> 
     <repository> 
      <id>atlassian</id> 
      <url>https://maven.atlassian.com/content/repositories/atlassian-public</url> 
     </repository> 
     <repository> 
      <id>antoher</id> 
      <url>https://maven.atlassian.com/content/groups/public</url> 
     </repository> 
     <repository> 
      <id>public</id> 
      <url>nexus</url> 
     </repository> 
    </repositories> 
    <dependencies> 
     <dependency> 
      <groupId>com.atlassian.jira</groupId> 
      <artifactId>jira-api</artifactId> 
      <version>7.1.4</version> 
      <scope>provided</scope> 
     </dependency> 
     <dependency> 
      <groupId>com.atlassian.jira</groupId> 
      <artifactId>jira-core</artifactId> 
      <version>7.1.4</version> 
      <scope>provided</scope> 
     </dependency> 
    </dependencies> 
    <distributionManagement> 
     <repository> 
      <id>releases</id> 
      <url>nexus</url> 
     </repository> 
    </distributionManagement> 
</project> 
+0

Bitte poste deine 'atlassian-plugin.xml'. Auch, ist Ihre JIRA Testumgebung auf einem lokalen Rechner (und nicht sagen wir JIRA Cloud?) –

+0

Ich habe atlassian-plugin.xml hinzugefügt, und JIRA Testumgebung ist auf anderen Server isnt Wolke –

+1

Ich denke, Sie pomed zweimal pom statt die atlassian-plugin.xml. –

Antwort

0

ich die Pom geändert:

<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>xxx.xxx</groupId> 
    <artifactId>jira-worklog-plugin</artifactId> 
    <name>Worklog Plugin</name> 
    <version>3.0</version> 
    <description>Plugin for update workflow on assigned issue</description> 
    <repositories> 
     <repository> 
      <id>atlassian</id> 
      <url>https://maven.atlassian.com/content/repositories/atlassian-public</url> 
     </repository> 
     <repository> 
      <id>antoher</id> 
      <url>https://maven.atlassian.com/content/groups/public</url> 
     </repository> 
     <repository> 
      <id>public</id> 
      <url>nexus</url> 
     </repository> 
    </repositories> 
    <dependencies> 
     <dependency> 
      <groupId>com.atlassian.jira</groupId> 
      <artifactId>jira-api</artifactId> 
      <version>7.1.4</version> 
      <scope>provided</scope> 
     </dependency> 
     <dependency> 
      <groupId>com.atlassian.jira</groupId> 
      <artifactId>jira-core</artifactId> 
      <version>7.1.4</version> 
      <scope>provided</scope> 
     </dependency> 
    </dependencies> 
    <distributionManagement> 
     <repository> 
      <id>releases</id> 
      <url>nexus</url> 
     </repository> 
    </distributionManagement> 
</project> 

und die atlassian-plugin.xml auf Ressourcen:

<atlassian-plugin key="${atlassian.plugin.key}" name="${project.name}" plugins-version="2"> 
    <plugin-info> 
     <description>${project.description}</description> 
     <version>${project.version}</version> 
     <vendor name="${project.organization.name}" url="${project.organization.url}"/> 
     <param name="plugin-icon">images/pluginIcon.png</param> 
     <param name="plugin-logo">images/pluginLogo.png</param> 
    </plugin-info> 

    <!-- add our i18n resource --> 
    <resource type="i18n" name="i18n" location="jira-xxx-plugin"/> 

    <!-- add our web resources --> 
    <web-resource key="jira-xxx-plugin-resources" name="jira-xxx-plugin Web Resources"> 
     <dependency>com.atlassian.auiplugin:ajs</dependency> 
     <resource type="download" name="jira-xxx-plugin.css" location="/css/jira-xxx-plugin.css"/> 
     <resource type="download" name="jira-xxx-plugin.js" location="/js/jira-xxx-plugin.js"/> 
     <resource type="download" name="images/" location="/images"/> 
     <context>jira-xxx-plugin</context> 
    </web-resource> 

</atlassian-plugin> 

und es funktioniert!