Can we use stream api when builgind add-on for JIRA?

safaksahin November 3, 2017

Hi,

I am currently using atlassian-plugin-sdk-6.12.14 for developing add-ons.

I tried to use Stream API in my code and when i tried the re-package maven gives me this error:

Foo.java[2,77] method references are not supported in -source 1.5

Bold area is error line :

List<Project> allProjectList = ComponentAccessor.getProjectManager().getProjectObjects();

       Map<String, Object context = allProjectList.stream().collect(Collectors.toMap(Project::getName, Function.identity()));

 

 

1 answer

1 accepted

1 vote
Answer accepted
Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 3, 2017

Put the following lines in pom.xml

<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>

 If you already have them but with different versions of source and target change the versions to 1.8

safaksahin November 5, 2017

Hi Alexey,

Thanks for help.

I've done that still same.

Here is my plugin tag:

<plugin>
<groupId>com.atlassian.maven.plugins</groupId>
<artifactId>maven-jira-plugin</artifactId>
<version>${amps.version}</version>
<extensions>true</extensions>
<configuration>
<source>1.8</source>
<target>1.8</target>
<productVersion>${jira.version}</productVersion>
<productDataVersion>${jira.version}</productDataVersion>
<!-- 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>
-->
<enableQuickReload>true</enableQuickReload>
<enableFastdev>false</enableFastdev>
<!-- See here for an explanation of default instructions: -->
<!-- https://developer.atlassian.com/docs/advanced-topics/configuration-of-instructions-in-atlassian-plugins -->
<instructions>
<Atlassian-Plugin-Key>${atlassian.plugin.key}</Atlassian-Plugin-Key>
<!-- Add package to export here -->
<Export-Package>tr.com.obss.plugin.sdlctools.api,</Export-Package>
<!-- Add package import here -->
<Import-Package>org.springframework.osgi.*;resolution:="optional", org.eclipse.gemini.blueprint.*;resolution:="optional", *</Import-Package>
<!-- Ensure plugin is spring powered -->
<Spring-Context>*</Spring-Context>
</instructions>
</configuration>
</plugin>

Suggest an answer

Log in or Sign up to answer