Upgrade Jira plugin version from 5 to 7.4

JosiUtfpr September 1, 2017

I tried to upgrade a plugin developed from jira 5 to jira 7, but when I start server there are several logs FileNotFoundException for many jars in the /container/tomcat8x/ cargo-jira-home/
Ex: jonas_timer.jar
carol.jar

When I run the project, it is rendered text/plain instead of html, there're relation to error logs?

What should I do to adjust this error?

5 answers

0 votes
JosiUtfpr September 8, 2017

I created a plugin customField, it was working on jira 5.
I'm sending the code, is it correct to Jira 7?

ApplicationProperties applicationProperties = ComponentAccessor.getApplicationProperties();
String baseurl = applicationProperties.getString(APKeys.JIRA_BASEURL);
String webEncoding = applicationProperties.getString(APKeys.JIRA_WEBWORK_ENCODING);
LOG.debug("baseurl: " + baseurl);
LOG.debug("webEncoding: " + webEncoding);

VelocityManager velocityManager = ComponentAccessor.getVelocityManager();

Map<String, Object> args = new HashMap<String, Object>();

CalendarioV3ViewBean calendarioV3ViewBean = iniciarProcessamento(issue, field);

if (calendarioV3ViewBean == null) {
LOG.debug("Processamento do SLA retornou null");
return null;
}

args.put("calendario", calendarioV3ViewBean);
args.put("number", new NumberTool());

String view = null;

try {
view = velocityManager.getEncodedBody("template/customfield/", "sla-v3-template.vm", baseurl, webEncoding, args);
} catch (VelocityException e) {
LOG.error("Erro durante o velocity encoded.", e);
}

return view;
0 votes
JosiUtfpr September 5, 2017

it's working, but is rendered text/plan, look the image below

 

ScreenShot039.bmp.png

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 5, 2017

That's another problem, your code is looking broken to me.

But the add-on loads and runs, so that's a start.  You should be able to take the generated .jar from there and use it on the target system to check that you get the same result.

0 votes
JosiUtfpr September 5, 2017

I  compile and run with command atlas-run, but I don't have much experience with Jira, analyzing logs, I didn't find nothing more  except the before reported 

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 5, 2017

Did the add-on work ok when you tested it in the JIRA that atlas-run set up for you?

0 votes
JosiUtfpr September 4, 2017

I think so, it follows the pom of the project

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

<!-- JIRA Plugin Version [major].[minor].[bugs].[build] -->


<name>name</name>
<description>decription</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>com.atlassian.jira</groupId>
<artifactId>jira-core</artifactId>
<version>${jira.version}</version>
<scope>provided</scope>
</dependency>

<!-- TESTS -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.atlassian.jira</groupId>
<artifactId>jira-tests</artifactId>
<version>${jira.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.atlassian.jira</groupId>
<artifactId>jira-func-tests</artifactId>
<version>${jira.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>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<scope>provided</scope>
<version>2.5</version>
</dependency>

<dependency>
<groupId>com.atlassian.plugins</groupId>
<artifactId>atlassian-plugins-webresource</artifactId>
<version>2.9.2</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>com.atlassian.templaterenderer</groupId>
<artifactId>atlassian-template-renderer-api</artifactId>
<version>1.3.1</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>com.atlassian.activeobjects</groupId>
<artifactId>activeobjects-plugin</artifactId>
<version>${ao.version}</version>
<scope>provided</scope>
</dependency>

<!-- SAL, the Active Objects plugin uses SAL's API for transactions -->
<dependency>
<groupId>com.atlassian.sal</groupId>
<artifactId>sal-api</artifactId>
<version>2.4.1</version>
<scope>provided</scope>
</dependency>

</dependencies>

<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.basedir}/src/main/resources/META-INF/lib</outputDirectory>
<!-- -->
<includeScope>compile</includeScope>
<includeGroupIds>
com.google.code.gson
</includeGroupIds>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<groupId>com.atlassian.maven.plugins</groupId>
<artifactId>maven-jira-plugin</artifactId>
<version>6.3.3</version>
<extensions>true</extensions>
<configuration>
<productVersion>${jira.version}</productVersion>
<productDataVersion>${jira.version}</productDataVersion>
<!-- <jvmArgs>-Xms256m -Xmx384m -XX:MaxPermSize=256m -XX:-UseGCOverheadLimit -server -Datlassian.plugins.enable.wait=120</jvmArgs> -->
<containerId>tomcat8x</containerId>
<systemPropertyVariables>
<atlassian.mail.senddisabled>false</atlassian.mail.senddisabled>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>

<pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>com.atlassian.maven.plugins</groupId>
<artifactId>maven-jira-plugin</artifactId>
<versionRange>[3.0.6,)</versionRange>
<goals>
<goal>copy-bundled-dependencies</goal>
<goal>filter-plugin-descriptor</goal>
<goal>generate-manifest</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>2.3</version>
</plugin>
</plugins>
</pluginManagement>
</build>

<properties>

<!-- Compila plugin JIRA 7 -->
<jira.version>7.4.2</jira.version>
<amps.version>6.2.14</amps.version>
<jira.data.version>7.4.2</jira.data.version>
<ao.version>0.19.7</ao.version>

<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

</properties>

</project>
0 votes
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 2, 2017

Did you recompile it against the latest versions of the libraries needed?

JosiUtfpr September 4, 2017

I think so, it follows the pom of the project

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

<!-- JIRA Plugin Version [major].[minor].[bugs].[build] -->


<name>name</name>
<description>decription</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>com.atlassian.jira</groupId>
<artifactId>jira-core</artifactId>
<version>${jira.version}</version>
<scope>provided</scope>
</dependency>

<!-- TESTS -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.atlassian.jira</groupId>
<artifactId>jira-tests</artifactId>
<version>${jira.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.atlassian.jira</groupId>
<artifactId>jira-func-tests</artifactId>
<version>${jira.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>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<scope>provided</scope>
<version>2.5</version>
</dependency>

<dependency>
<groupId>com.atlassian.plugins</groupId>
<artifactId>atlassian-plugins-webresource</artifactId>
<version>2.9.2</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>com.atlassian.templaterenderer</groupId>
<artifactId>atlassian-template-renderer-api</artifactId>
<version>1.3.1</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>com.atlassian.activeobjects</groupId>
<artifactId>activeobjects-plugin</artifactId>
<version>${ao.version}</version>
<scope>provided</scope>
</dependency>

<!-- SAL, the Active Objects plugin uses SAL's API for transactions -->
<dependency>
<groupId>com.atlassian.sal</groupId>
<artifactId>sal-api</artifactId>
<version>2.4.1</version>
<scope>provided</scope>
</dependency>

</dependencies>

<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.basedir}/src/main/resources/META-INF/lib</outputDirectory>
<!-- -->
<includeScope>compile</includeScope>
<includeGroupIds>
com.google.code.gson
</includeGroupIds>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<groupId>com.atlassian.maven.plugins</groupId>
<artifactId>maven-jira-plugin</artifactId>
<version>6.3.3</version>
<extensions>true</extensions>
<configuration>
<productVersion>${jira.version}</productVersion>
<productDataVersion>${jira.version}</productDataVersion>
<!-- <jvmArgs>-Xms256m -Xmx384m -XX:MaxPermSize=256m -XX:-UseGCOverheadLimit -server -Datlassian.plugins.enable.wait=120</jvmArgs> -->
<containerId>tomcat8x</containerId>
<systemPropertyVariables>
<atlassian.mail.senddisabled>false</atlassian.mail.senddisabled>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>

<pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>com.atlassian.maven.plugins</groupId>
<artifactId>maven-jira-plugin</artifactId>
<versionRange>[3.0.6,)</versionRange>
<goals>
<goal>copy-bundled-dependencies</goal>
<goal>filter-plugin-descriptor</goal>
<goal>generate-manifest</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>2.3</version>
</plugin>
</plugins>
</pluginManagement>
</build>

<properties>

<!-- Compila plugin JIRA 7 -->
<jira.version>7.4.2</jira.version>
<amps.version>6.2.14</amps.version>
<jira.data.version>7.4.2</jira.data.version>
<ao.version>0.19.7</ao.version>

<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

</properties>

</project>

 

JosiUtfpr September 4, 2017

I think so, it follows the pom of the project

 

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

<!-- JIRA Plugin Version [major].[minor].[bugs].[build] -->


<name>name</name>
<description>decription</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>com.atlassian.jira</groupId>
<artifactId>jira-core</artifactId>
<version>${jira.version}</version>
<scope>provided</scope>
</dependency>

<!-- TESTS -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.atlassian.jira</groupId>
<artifactId>jira-tests</artifactId>
<version>${jira.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.atlassian.jira</groupId>
<artifactId>jira-func-tests</artifactId>
<version>${jira.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>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<scope>provided</scope>
<version>2.5</version>
</dependency>

<dependency>
<groupId>com.atlassian.plugins</groupId>
<artifactId>atlassian-plugins-webresource</artifactId>
<version>2.9.2</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>com.atlassian.templaterenderer</groupId>
<artifactId>atlassian-template-renderer-api</artifactId>
<version>1.3.1</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>com.atlassian.activeobjects</groupId>
<artifactId>activeobjects-plugin</artifactId>
<version>${ao.version}</version>
<scope>provided</scope>
</dependency>

<!-- SAL, the Active Objects plugin uses SAL's API for transactions -->
<dependency>
<groupId>com.atlassian.sal</groupId>
<artifactId>sal-api</artifactId>
<version>2.4.1</version>
<scope>provided</scope>
</dependency>

</dependencies>

<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.basedir}/src/main/resources/META-INF/lib</outputDirectory>
<!-- -->
<includeScope>compile</includeScope>
<includeGroupIds>
com.google.code.gson
</includeGroupIds>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<groupId>com.atlassian.maven.plugins</groupId>
<artifactId>maven-jira-plugin</artifactId>
<version>6.3.3</version>
<extensions>true</extensions>
<configuration>
<productVersion>${jira.version}</productVersion>
<productDataVersion>${jira.version}</productDataVersion>
<!-- <jvmArgs>-Xms256m -Xmx384m -XX:MaxPermSize=256m -XX:-UseGCOverheadLimit -server -Datlassian.plugins.enable.wait=120</jvmArgs> -->
<containerId>tomcat8x</containerId>
<systemPropertyVariables>
<atlassian.mail.senddisabled>false</atlassian.mail.senddisabled>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>

<pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>com.atlassian.maven.plugins</groupId>
<artifactId>maven-jira-plugin</artifactId>
<versionRange>[3.0.6,)</versionRange>
<goals>
<goal>copy-bundled-dependencies</goal>
<goal>filter-plugin-descriptor</goal>
<goal>generate-manifest</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>2.3</version>
</plugin>
</plugins>
</pluginManagement>
</build>

<properties>

<!-- Compila plugin JIRA 7 -->
<jira.version>7.4.2</jira.version>
<amps.version>6.2.14</amps.version>
<jira.data.version>7.4.2</jira.data.version>
<ao.version>0.19.7</ao.version>

<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

</properties>

</project>
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 5, 2017

What happens when you compile and run this with the SDK?  (i.e. use atlas-run)

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events