I am trying to build a modified version of select (multiple choices), however class is not available even after enabling jira-core deps in pom file
referred to this
https://community.atlassian.com/forums/Jira-questions/Not-able-to-import-quot-MultiSelectCFType-quot/qaq-p/1051794
however could not solve the issue.
Any help here is appreciated!
Could you share your pom.xml's related part as well as the stack trace that you are getting?
Did you try using your own wrapper class?
I mean instead of referencing com.atlassian.jira.issue.customfields.impl.MultiSelectCFType directly in atlassian-plugin.xml, create your own class that extends it (as below)
MyCustomMultiSelectCFType extends MultiSelectCFType
Then use it in your atlassian-plugin.xml.
Additionally, I am not 100% sure but you may need to import com.atlassian.jira.issue.customfields.impl in your OSGi Import-Package if it's not being resolved automatically.
<Import-Package>
com.atlassian.jira.issue.customfields.impl,
...
</Import-Package>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Tuncay Senturk I did try to build a psedu class for this , however intellij says it is not able to resolve the import
I tried adding it to OSGi Import Package , however it did not solve.
If you have any good github repo or other reference source it would be great help!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
is it possible that intellij is not able to resolve , but class can be still imported ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I don't have a github repo but I used that class in some of my private plugins and they worked fine. However, when adding the dependency "jira-core" I used to get a library conflict problem which I solved by adding an exclusion as below
<dependency>
<groupId>com.atlassian.jira</groupId>
<artifactId>jira-core</artifactId>
<version>${jira.version}</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</exclusion>
</exclusions>
</dependency>
However, I don't think that's the cause of your case. Can you see that class in the jira-core library that was downloaded to m2? Could that jar file be corrupted? Sometimes, running atlas-clean or deleting the library and allowing atlas-package to download it again can solve some problems.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Tuncay Senturk adding import for osgi did resolve the issue
however it lead to this error , look like there are more deps and requirements to using this class, please let me know if you have any clue on this
Thanks in adv
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Did you try to inject the OptionsManager using the constructor?
import com.atlassian.jira.issue.customfields.manager.OptionsManager;
YourClass(final OptionsManager optionsManager) {
this.optionsManager = optionsManager;
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Tuncay Senturk
adding this to pom.xml helped solve imports
<Import-Package>
org.springframework.osgi.*;resolution:="optional",
org.eclipse.gemini.blueprint.*;resolution:="optional",
com.atlassian.jira.issue.customfields.impl,
com.atlassian.jira.issue.customfields,
com.atlassian.jira.imports.project.customfield,
com.atlassian.jira.issue.fields.rest,
com.atlassian.jira.issue.export.customfield,
*
</Import-Package>
and using ComponentImport here helped replicate multiselect
package mypath;
import com.atlassian.jira.issue.customfields.impl.MultiSelectCFType;
import com.atlassian.jira.issue.customfields.manager.OptionsManager;
import com.atlassian.jira.issue.customfields.persistence.CustomFieldValuePersister;
import com.atlassian.jira.issue.customfields.manager.GenericConfigManager;
import com.atlassian.jira.issue.fields.rest.json.beans.JiraBaseUrls;
import com.atlassian.jira.bc.issue.search.SearchService;
import com.atlassian.jira.config.FeatureManager;
import com.atlassian.jira.security.JiraAuthenticationContext;
import org.springframework.stereotype.Component;
import com.atlassian.plugin.spring.scanner.annotation.imports.ComponentImport;
import org.springframework.beans.factory.annotation.Autowired;
import javax.inject.Inject;
import javax.inject.Named;
@Named
public class main extends MultiSelectCFType {
private final OptionsManager optionsManager;
@Autowired
@Inject
public main(@ComponentImport OptionsManager optionsManager,
@ComponentImport CustomFieldValuePersister customFieldValuePersister,
@ComponentImport GenericConfigManager genericConfigManager,
@ComponentImport JiraBaseUrls jiraBaseUrls,
@ComponentImport SearchService searchService,
@ComponentImport FeatureManager featureManager,
@ComponentImport JiraAuthenticationContext jiraAuthenticationContext) {
super(optionsManager,
customFieldValuePersister,
genericConfigManager,
jiraBaseUrls,
searchService,
featureManager,
jiraAuthenticationContext);
// Store the injected OptionsManager object in a field for later use
this.optionsManager = optionsManager;
}
}
& jira-core deps enabled
Thanks for the help here , able to achieve what was intended
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Tuncay Senturk thanks for the quick response
here is my pom file , upon running atlas-package , it was not able to find jndi file , hence I have external downloaded it from the web and copied the files in m2 maven directory
<?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.zscaler</groupId>
<artifactId>select-new</artifactId>
<version>1.0.0-SNAPSHOT</version>
<organization>
<name>Example Company</name>
<url>http://www.example.com/</url>
</organization>
<name>select-new</name>
<description>This is the com.zscaler:select-new 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>
<!-- 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>
<dependency>
<groupId>com.atlassian.plugin</groupId>
<artifactId>atlassian-spring-scanner-annotation</artifactId>
<version>${atlassian.spring.scanner.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<version>1</version>
<scope>provided</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>
<!-- 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>jira-maven-plugin</artifactId>
<version>${amps.version}</version>
<extensions>true</extensions>
<configuration>
<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>
<!-- 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>
com.zscaler.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>
<plugin>
<groupId>com.atlassian.plugin</groupId>
<artifactId>atlassian-spring-scanner-maven-plugin</artifactId>
<version>${atlassian.spring.scanner.version}</version>
<executions>
<execution>
<goals>
<goal>atlassian-spring-scanner</goal>
</goals>
<phase>process-classes</phase>
</execution>
</executions>
<configuration>
<verbose>false</verbose>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<jira.version>9.12.2</jira.version>
<amps.version>9.1.1</amps.version>
<plugin.testrunner.version>2.0.9</plugin.testrunner.version>
<atlassian.spring.scanner.version>2.2.4</atlassian.spring.scanner.version>
<!-- This property ensures consistency between the key in atlassian-plugin.xml and the OSGi bundle's key. -->
<atlassian.plugin.key>${project.groupId}.${project.artifactId}</atlassian.plugin.key>
<!-- TestKit version 6.x for JIRA 6.x -->
<testkit.version>6.3.11</testkit.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>
</project>
additionally there isn't much on the stack trace side , it is not able to find
class MutliSelectCFType when creating a customfield type derived from original custom field
atlassian-plugin.xml
<customfield-type key="rajit" name="Rajit"
i18n-name-key="my.plugin.name"
class="com.atlassian.jira.issue.customfields.impl.MultiSelectCFType">
<description key="admin.customfield.type.multiselect.desc">Choose multiple values in a select list.</description>
<resource type="download" name="customfieldpreview.png" location="/images/customfieldpreview/multiselect.png">
<param name="source" value="webContextStatic"/>
</resource>
<resource type="velocity" name="view" location="templates/plugins/fields/view/view-multiselect.vm"/>
<resource type="velocity" name="edit" location="templates/plugins/fields/edit/edit-multiselect.vm"/>
<resource type="velocity" name="xml" location="templates/plugins/fields/xml/xml-multiselect.vm"/>
</customfield-type>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.