JIRA Plugin : com.atlassian.plugin.web.conditions.ConditionLoadingException: Could not load 'com.atlassian.jira.plugin.webfragment.conditions.IsIssueEditableCondition'

Hello,

I manage a version upgrade from Jira 7 to Jira 8.2. I’m working on upgrading existing JIRA plugin written in the company.

In the atlassian-plugin.xml file, there are many atlassian conditions classes used :

<condition class="com.atlassian.jira.plugin.webfragment.conditions.IsIssueEditableCondition" />
<condition class="com.atlassian.jira.plugin.webfragment.conditions.SubTasksEnabledCondition" />
<condition class="com.atlassian.jira.plugin.webfragment.conditions.IsSubTaskCondition" invert="true" />
<condition class="com.atlassian.jira.plugin.webfragment.conditions.HasProjectPermissionCondition">
<param name="permission">create</param>
</condition>
<condition class="com.atlassian.jira.plugin.webfragment.conditions.HasSubTasksAvailableCondition" />

These classes are contained in the jira-core library.

First, I added in the POM file :

		 <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>

In the atlassian maven repository, I found the version :
https://packages.atlassian.com/mvn/maven-external/com/atlassian/jira/jira-core/8.2.3/

Second, still in POM, in the Import-Package section of jira-maven-plugin, I added :

<Import-Package>
                            *;version="0";resolution:=optional
                        </Import-Package>

Third, in the atlassian-plugin.xml file, in the plugin-info section, I added :

<bundle-instructions>
	<Import-Package>com.atlassian.jira.plugin.webfragment.conditions,*</Import-Package>
</bundle-instructions>

When I deploy the plugin into JIRA 8.2 instance, I get stacktrace exception :

2019-07-03 17:52:42,892 JIRA-Bootstrap There was an error loading the descriptor 'View Issue Ops Bar Create Subtask Link' of plugin 'fr.icdc.dei.dn1.DarwinPlugin'. Disabling.
java.lang.RuntimeException: Unable to enable web fragment
 ....
Caused by: com.atlassian.plugin.PluginParseException: Unable to load the module's display conditions: Could not load 'com.atlassian.jira.plugin.webfragment.conditions.IsIssueEditableCondition' in plugin fr.icdc.dei.dn1.DarwinPlugin
....
Caused by: com.atlassian.plugin.web.conditions.ConditionLoadingException: Could not load 'com.atlassian.jira.plugin.webfragment.conditions.IsIssueEditableCondition' in plugin fr.icdc.dei.dn1.DarwinPlugin
 ....
Caused by: java.lang.ClassNotFoundException: com.atlassian.jira.plugin.webfragment.conditions.IsIssueEditableCondition not found by fr.icdc.dei.dn1.DarwinPlugin [195]

I don’t find the jira-core library in the server instance directories.

How can I fix this problem ?

Thanks in advance for your help.

@ICDCInformatiqueCDC - can you share your entire XML file?

Because you have

*;version="0";resolution:=optional

under import-package, the bean is ignored until the class is called, which is why you’re getting ClassNotFoundException.

I believe this is answered here: Solved: Issue with including conditions to web items

TL;DR remove *;version="0";resolution:=optional from <import-package>
remove <bundle-instructions><import-package>
add com.atlassian.jira.plugin.webfragment.conditions to the standard <import-package>

Hello,

I followed your advices. At the end of the day, the error is still the same.

Below a fragment of the POM file :

<amps.version>8.0.2</amps.version>

<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>
					<instructions>
                        <Atlassian-Plugin-Key>${atlassian.plugin.key}</Atlassian-Plugin-Key>

                        <!-- Add package to export here -->
                        <Export-Package>
                            fr.icdc.dei.dn1,
                        </Export-Package>

                        <!-- Add package import here -->
                        <Import-Package>
                            org.springframework.osgi.*;resolution:="optional",
                            org.eclipse.gemini.blueprint.*;resolution:="optional",
                            com.atlassian.jira.workflow.condition.*,
                            com.atlassian.jira.plugin.workflow.*,
                            com.atlassian.jira.workflow.function.issue.*,
                            com.atlassian.jira.plugin.webfragment.conditions.*,
                            com.opensymphony.workflow.*,
                            *;resolution:="optional"
                        </Import-Package>
                        <!-- Ensure plugin is spring powered -->
                        <Spring-Context>*</Spring-Context>
                    </instructions>
				</configuration>
			</plugin>

Some idea ?

Thanks

Hello,

I tried to progress in this problem.

I upgraded some of my dependencies to match the versions included with JIRA 8.2.0. I qualified all the standard dependencies in “provided”. I refactored a little bit my code to get rid of a dependency that troubled me.

Below is the configuration of jira-maven-plugin :

<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>
					<instructions>
						<Atlassian-Plugin-Key>${atlassian.plugin.key}</Atlassian-Plugin-Key>

						<!-- Add package to export here -->
						<Export-Package>
							fr.icdc.dei.dn1,
						</Export-Package>

						<!-- Add package import here -->
						<Import-Package>
							com.atlassian.jira.plugin.webfragment.conditions,
							org.springframework.osgi.*;resolution:="optional",
							org.eclipse.gemini.blueprint.*;resolution:="optional",
							*;resolution:="optional"
						</Import-Package>
						<!-- Ensure plugin is spring powered -->
						<Spring-Context>*</Spring-Context>
					</instructions>
				</configuration>
			</plugin>

And now, the error I got is this :

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'com.atlassian.jira.plugin.webfragment.conditions.IsIssueEditableCondition': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.atlassian.jira.issue.IssueManager' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}

Thanks in advance for your interest.

Hello,

The existing code of the plugin has many calls to ComponentAccessor, for example ComponentAccessor.getCustomFieldManager(), ComponentAccessor.getApplicationProperties(), ComponentAccessor.getJiraAuthenticationContext(), ComponentAccessor.getIssueManager(). I don’t want to rewrite the code. There’s no dependency injection, so I don’t want to put annotations.

Below is the atlassian-plugin.xml file :

<?xml version="1.0" encoding="UTF-8"?>

<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="ApplicationAramisPlugin" />

	<web-resource key="darwinPlugin-js" name="javascript">
		<dependency>jira.webresources:global-static</dependency>
		<description>JavaScript</description>
		<resource name="darwinPlugin.js" type="download" location="/js/darwinPlugin.js" />
		<context>atl.general</context>
		<context>atl.admin</context>
	</web-resource>

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


	<!-- Condition -->
	<workflow-condition key="signataire-application-workflow-condition"
		name="Signataire Application Workflow Condition" i18n-name-key="signataire-application-workflow-condition.name"
		class="fr.icdc.dei.dn1.jira.workflow.WorkflowConditionFactoryImpl">
		<description key="signataire-application-workflow-condition.description">The Signataire Application Workflow
			Condition Plugin
		</description>
		<condition-class>fr.icdc.dei.dn1.jira.workflow.SignataireApplicationWorkflowCondition
		</condition-class>
		<resource type="velocity" name="view"
			location="templates/conditions/view-condition.vm" />
	</workflow-condition>

	<workflow-condition key="signataire-environnement-workflow-condition"
		name="Signataire Environnement Workflow Condition" i18n-name-key="signataire-environnement-workflow-condition.name"
		class="fr.icdc.dei.dn1.jira.workflow.WorkflowConditionFactoryImpl">
		<description key="signataire-environnement-workflow-condition.description">The Signataire Environnement Workflow
			Condition Plugin
		</description>
		<condition-class>fr.icdc.dei.dn1.jira.workflow.SignataireEnvironnementWorkflowCondition
		</condition-class>
		<resource type="velocity" name="view"
			location="templates/conditions/view-condition.vm" />
	</workflow-condition>

	<!-- Fonction -->

	<workflow-function key="signataire-mail-function"
		name="Signataire Mail Function" i18n-name-key="signataire-mail-function.name"
		class="fr.icdc.dei.dn1.jira.workflow.SignataireMailFunctionFactoryImpl">
		<description key="signataire-mail-function.description">The Signataire Mail Function Plugin
		</description>

		<function-class>fr.icdc.dei.dn1.jira.workflow.SignataireMailFunction
		</function-class>
		<orderable>false</orderable>
		<unique>true</unique>
		<deletable>true</deletable>
		<resource type="velocity" name="view"
			location="templates/postfunctions/signataire-mail-function.vm" />
		<resource type="velocity" name="input-parameters"
			location="templates/postfunctions/signataire-mail-function-input.vm" />
		<resource type="velocity" name="edit-parameters"
			location="templates/postfunctions/signataire-mail-function-input.vm" />
	</workflow-function>


	<workflow-function key="dcir-valideur-mail-function"
		name="DCIR Validateur Mail Function" i18n-name-key="dcir-valideur-mail-function.name"
		class="fr.icdc.dei.dn1.jira.workflow.DcirValidateurMailFunctionFactoryImpl">
		<description key="dcir-valideur-mail-function.description">The DCIR Validateur Mail Function Plugin
		</description>

		<function-class>fr.icdc.dei.dn1.jira.workflow.DcirValidateurMailFunction
		</function-class>
		<orderable>false</orderable>
		<unique>true</unique>
		<deletable>true</deletable>
		<resource type="velocity" name="view"
			location="templates/postfunctions/signataire-mail-function.vm" />
		<resource type="velocity" name="input-parameters"
			location="templates/postfunctions/signataire-mail-function-input.vm" />
		<resource type="velocity" name="edit-parameters"
			location="templates/postfunctions/signataire-mail-function-input.vm" />
	</workflow-function>

	<workflow-function key="reinit-function" name="reinit Function"
		i18n-name-key="reinit-function.name"
		class="fr.icdc.dei.dn1.jira.workflow.ReinitFunctionFactoryImpl">
		<description key="reinit-function.description">Reinitialisation Function Plugin
		</description>
		<function-class>fr.icdc.dei.dn1.jira.workflow.ReinitFunction
		</function-class>
		<orderable>false</orderable>
		<unique>false</unique>
		<deletable>true</deletable>
		<resource type="velocity" name="view"
			location="templates/postfunctions/reinit-function.vm" />
		<resource type="velocity" name="input-parameters"
			location="templates/postfunctions/reinit-function-input.vm" />
		<resource type="velocity" name="edit-parameters"
			location="templates/postfunctions/reinit-function-input.vm" />
	</workflow-function>

	<workflow-function key="clone-function" name="Clone Function"
		i18n-name-key="clone-function"
		class="com.atlassian.jira.plugin.workflow.WorkflowNoInputPluginFactory">
		<description key="clone-function.description">Clone Function Plugin</description>
		<function-class>fr.icdc.dei.dn1.jira.workflow.CloneFunction
		</function-class>
		<orderable>false</orderable>
		<unique>false</unique>
		<deletable>true</deletable>
		<resource type="velocity" name="view"
			location="templates/postfunctions/clone-function.vm" />
	</workflow-function>

	<workflow-function key="parent-copy-function" name="Parent copy Function"
		i18n-name-key="parent-copy-function.name"
		class="com.atlassian.jira.plugin.workflow.WorkflowNoInputPluginFactory">
		<description key="parent-copy-function.description">Copie certains champs de la tache parent
			vers la sous tache
		</description>
		<function-class>fr.icdc.dei.dn1.jira.workflow.ParentCopyFunction
		</function-class>
		<orderable>false</orderable>
		<unique>true</unique>
		<deletable>true</deletable>
	</workflow-function>

	<!-- validateur -->

	<workflow-validator key="application-validator"
		name="Application Validator" class="fr.icdc.dei.dn1.jira.workflow.ValidatorFactoryImpl">
		<description>Valide qu'une application est selectionnee dans une
			demande globale pour une facturation de mode projet
		</description>
		<longDescription>test</longDescription>
		<validator-class>
			fr.icdc.dei.dn1.jira.workflow.ApplicationValidator
		</validator-class>
		<resource type="velocity" name="view"
			location="templates/validators/view-validator.vm" />
	</workflow-validator>

	<workflow-validator key="application-conplete-validator"
		i18n-name-key="application-conplete-validator.name" name="Application Complete Validator"
		class="fr.icdc.dei.dn1.jira.workflow.ValidatorFactoryImpl">
		<description key="application-conplete-validator.description">Valide qu'une application est renseignee
			correctement
		</description>
		<validator-class>
			fr.icdc.dei.dn1.jira.workflow.ApplicationCompleteValidator
		</validator-class>
		<resource type="velocity" name="view"
			location="templates/validators/view-validator.vm" />
	</workflow-validator>

	<workflow-validator key="comment-validator" name="Comment Validator"
		i18n-name-key="comment-validator.name" class="fr.icdc.dei.dn1.jira.workflow.ValidatorFactoryImpl">
		<description key="comment-validator.description">Valide que le commentaire est bien
			renseigne
		</description>
		<validator-class>
			fr.icdc.dei.dn1.jira.workflow.CommentRequiredValidator
		</validator-class>
		<resource type="velocity" name="view"
			location="templates/validators/view-validator.vm" />
	</workflow-validator>

	<workflow-validator key="composant-validator" name="Composant Validator"
		i18n-name-key="composant-validator.name" class="fr.icdc.dei.dn1.jira.workflow.ValidatorFactoryImpl">
		<description key="composant-validator.description">Valide
			que le composant est bien renseigne</description>
		<validator-class>
			fr.icdc.dei.dn1.jira.workflow.ComposantRequiredValidador
		</validator-class>
		<resource type="velocity" name="view"
			location="templates/validators/view-validator.vm" />
	</workflow-validator>

	<workflow-validator key="codeconvention-validator"
		i18n-name-key="codeconvention-validator.name" name="Code convention Validator"
		class="fr.icdc.dei.dn1.jira.workflow.ValidatorFactoryImpl">
		<description key="codeconvention-validator.description">Valide
			que le code convention est obligatoire pour un projet
		</description>
		<validator-class>
			fr.icdc.dei.dn1.jira.workflow.CodeConventionValidator
		</validator-class>
		<resource type="velocity" name="view"
			location="templates/validators/view-validator.vm" />
	</workflow-validator>

	<workflow-validator key="modegestion-validator"
		i18n-name-key="modegestion-validator.name" name="Mode de gestion Validator"
		class="fr.icdc.dei.dn1.jira.workflow.ValidatorFactoryImpl">
		<description key="modegestion-validator.description">Valide
			que le mode de gestion est utilisable pour cette demande et ce type
			de projet
		</description>
		<validator-class>
			fr.icdc.dei.dn1.jira.workflow.ModeDeGestionValidator
		</validator-class>
		<resource type="velocity" name="view"
			location="templates/validators/view-validator.vm" />
	</workflow-validator>

	<workflow-validator key="suivitemp-validator" name="Suivi Temporel Validator"
		i18n-name-key="suivitemp-validator.name" class="fr.icdc.dei.dn1.jira.workflow.ValidatorFactoryImpl">
		<description key="suivitemp-validator.description">Valide
			qu au moins un des trois champs (jour, heure,
			minute) est renseigne
		</description>
		<validator-class>
			fr.icdc.dei.dn1.jira.workflow.SuiviTemporelValidator
		</validator-class>
		<resource type="velocity" name="view"
			location="templates/validators/view-validator.vm" />
	</workflow-validator>

	<workflow-validator key="demandeur-validator" name="Demandeur
		Validator"
		i18n-name-key="demandeur-validator.name" class="fr.icdc.dei.dn1.jira.workflow.ValidatorFactoryImpl">
		<description key="demandeur-validator.description">Valide
			que le proprietaire est
			obligatoire pour un environnement exploitation
		</description>
		<validator-class> fr.icdc.dei.dn1.jira.workflow.DemandeurValidator
		</validator-class>
		<resource type="velocity" name="view"
			location="templates/validators/view-validator.vm" />
	</workflow-validator>

	<web-section key="section_aide" name="Section aide"
		location="lien_aide" weight="10" />

	<web-item key="lien_aide" name="Lien aide" section="system.top.navigation.bar"
		weight="47">
		<label>Aide en ligne</label>
		<link linkId="my_links_link" absolute="false">javascript:window.open('/documentation/',
			'atlassian_win').focus();
		</link>
	</web-item>

	<web-section name="Sous tâches"
		i18n-name-key="webfragments.view.issue.opsbar.operations.subtasks"
		key="sstache" weight="50" location="op-sstache" />
	<web-item name="Créer une sous tâche"
		i18n-name-key="webfragments.view.issue.opsbar.operations.subtasks.create"
		key="op-sstache" weight="10" section="transitions-all">
		<label>Créer une sous-tâche</label>
		<tooltip key="admin.issue.operations.plugin.create.subtask.name" />
		<styleClass>issueaction-create-subtask</styleClass>
		<link linkId="create-subtask">
			/secure/CreateSubTaskIssue!default.jspa?parentIssueId=${issueId}
		</link>
		<condition
			class="com.atlassian.jira.plugin.webfragment.conditions.IsIssueEditableCondition" />
		<condition
			class="com.atlassian.jira.plugin.webfragment.conditions.SubTasksEnabledCondition" />
		<condition
			class="com.atlassian.jira.plugin.webfragment.conditions.IsSubTaskCondition"
			invert="true" />
		<condition
			class="com.atlassian.jira.plugin.webfragment.conditions.HasProjectPermissionCondition">
			<param name="permission">create</param>
		</condition>
		<condition
			class="com.atlassian.jira.plugin.webfragment.conditions.HasSubTasksAvailableCondition" />
	</web-item>


</atlassian-plugin>

Below is the POM.xml file :

<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>

	<parent>
		<groupId>fr.icdc.usine.pom.parent.pom</groupId>
		<artifactId>pom-parent</artifactId>
		<version>1</version>
	</parent>

	<groupId>fr.icdc.dei.dn1</groupId>
	<artifactId>DarwinPlugin</artifactId>
	<name>DarwinPlugin</name>
	<description>This is the DarwinPlugin plugin for Atlassian JIRA.</description>
	<packaging>atlassian-plugin</packaging>
	<version>7.0.10.3-SNAPSHOT</version>

	<properties>
		<maven.compiler.source>1.8</maven.compiler.source>
		<maven.compiler.target>1.8</maven.compiler.target>
		<maven.compiler.encoding>UTF-8</maven.compiler.encoding>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<jira.version>8.2.3</jira.version>
		<amps.version>8.0.2</amps.version>
		<mysql-version>5.1.47</mysql-version>
		<dbcp-version>1.4</dbcp-version>
		<crowd.version>2.10.5-j11</crowd.version>
		<plugin.testrunner.version>2.0.1</plugin.testrunner.version>
		<atlassian.spring.scanner.version>1.2.13</atlassian.spring.scanner.version>
		<!-- This key is used to keep the consistency between the key in atlassian-plugin.xml 
			and the key to generate bundle. -->
		<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>

	</properties>

	<dependencyManagement>
		<dependencies>
			<dependency>
				<groupId>fr.icdc.dei.dn1</groupId>
				<artifactId>DarwinCore</artifactId>
				<version>1.2.10-SNAPSHOT</version>
			</dependency>
			<dependency>
				<groupId>org.apache.commons</groupId>
				<artifactId>commons-dbcp2</artifactId>
				<version>2.1</version>
				<scope>provided</scope>
			</dependency>

			<dependency>
				<groupId>mysql</groupId>
				<artifactId>mysql-connector-java</artifactId>
				<version>${mysql-version}</version>
				<scope>provided</scope>
			</dependency>

			<dependency>
				<groupId>com.atlassian.jira</groupId>
				<artifactId>jira-tests</artifactId>
				<version>${jira.version}</version>
				<scope>test</scope>
				<exclusions>
					<exclusion>
						<groupId>org.powermock.api</groupId>
						<artifactId>powermock-api-easymock</artifactId>
					</exclusion>

					<exclusion>
						<groupId>org.easymock</groupId>
						<artifactId>easymockclassextension</artifactId>
					</exclusion>

					<exclusion>
						<groupId>org.easymock</groupId>
						<artifactId>easymock</artifactId>
					</exclusion>

					<exclusion>
						<groupId>org.hamcrest</groupId>
						<artifactId>hamcrest-library</artifactId>
					</exclusion>
				</exclusions>

			</dependency>

			<dependency>
				<groupId>junit</groupId>
				<artifactId>junit</artifactId>
				<version>4.12</version>
				<scope>test</scope>
			</dependency>

			<dependency>
				<groupId>org.mockito</groupId>
				<artifactId>mockito-all</artifactId>
				<version>1.9.5</version>
				<type>jar</type>
				<scope>test</scope>
				<optional>false</optional>
			</dependency>

			<dependency>
				<groupId>org.powermock</groupId>
				<artifactId>powermock-api-mockito</artifactId>
				<version>1.4.12</version>
				<scope>test</scope>
			</dependency>

			<dependency>
				<groupId>org.powermock</groupId>
				<artifactId>powermock-module-junit4</artifactId>
				<version>1.4.12</version>
				<exclusions>
					<exclusion>
						<groupId>junit</groupId>
						<artifactId>junit</artifactId>
					</exclusion>
					<exclusion>
						<groupId>org.powermock</groupId>
						<artifactId>powermock-core</artifactId>
					</exclusion>
					<exclusion>
						<groupId>org.powermock</groupId>
						<artifactId>powermock-reflect</artifactId>
					</exclusion>
				</exclusions>
				<scope>test</scope>
			</dependency>
		</dependencies>
	</dependencyManagement>

	<dependencies>

		<dependency>
			<groupId>fr.icdc.dei.dn1</groupId>
			<artifactId>DarwinCore</artifactId>
		</dependency>

		<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>
			<exclusions>
				<exclusion>
					<groupId>axis</groupId>
					<artifactId>axis</artifactId>
				</exclusion>
			</exclusions>
		</dependency>

		<dependency>
			<groupId>javax.inject</groupId>
			<artifactId>javax.inject</artifactId>
			<version>1</version>
			<scope>provided</scope>
		</dependency>

		<dependency>
			<groupId>com.atlassian.event</groupId>
			<artifactId>atlassian-event</artifactId>
			<version>4.0.0</version>
			<scope>provided</scope>
		</dependency>

		<dependency>
			<groupId>com.atlassian.mail</groupId>
			<artifactId>atlassian-mail</artifactId>
			<version>5.0.0</version>
			<scope>provided</scope>
		</dependency>

		<dependency>
			<groupId>com.atlassian.sal</groupId>
			<artifactId>sal-api</artifactId>
			<version>4.0.0</version>
			<scope>provided</scope>
		</dependency>

		<dependency>
			<groupId>com.atlassian.ofbiz</groupId>
			<artifactId>entityengine</artifactId>
			<version>1.4.0</version>
			<scope>provided</scope>
		</dependency>

		<dependency>
			<groupId>com.atlassian.ofbiz</groupId>
			<artifactId>entityengine-share</artifactId>
			<version>1.4.0</version>
			<scope>provided</scope>
		</dependency>

		<dependency>
			<groupId>com.atlassian.crowd</groupId>
			<artifactId>embedded-crowd-api</artifactId>
			<version>${crowd.version}</version>
			<scope>provided</scope>
		</dependency>

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

		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-context</artifactId>
			<version>5.0.10.RELEASE</version>
			<scope>provided</scope>
		</dependency>

		<dependency>
			<groupId>opensymphony</groupId>
			<artifactId>propertyset</artifactId>
			<version>1.5</version>
			<scope>provided</scope>
		</dependency>

		<dependency>
			<groupId>opensymphony</groupId>
			<artifactId>oscore</artifactId>
			<version>2.2.7-atlassian-1</version>
			<scope>provided</scope>
		</dependency>

		<dependency>
			<groupId>commons-lang</groupId>
			<artifactId>commons-lang</artifactId>
			<version>2.6</version>
			<scope>provided</scope>
		</dependency>

		<dependency>
			<groupId>org.apache.commons</groupId>
			<artifactId>commons-lang3</artifactId>
			<version>3.8</version>
			<scope>provided</scope>
		</dependency>

		<dependency>
			<groupId>commons-collections</groupId>
			<artifactId>commons-collections</artifactId>
			<version>3.2.2</version>
			<scope>provided</scope>
		</dependency>

		<dependency>
			<groupId>osworkflow</groupId>
			<artifactId>osworkflow</artifactId>
			<version>2.9.0-atlassian-1</version>
			<scope>provided</scope>
		</dependency>

		<dependency>
			<groupId>xerces</groupId>
			<artifactId>xercesImpl</artifactId>
			<version>2.9.1</version>
			<scope>compile</scope>
		</dependency>

		<!-- test -->
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.mockito</groupId>
			<artifactId>mockito-all</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.powermock</groupId>
			<artifactId>powermock-api-mockito</artifactId>
			<scope>test</scope>
		</dependency>

		<dependency>
			<groupId>org.powermock</groupId>
			<artifactId>powermock-module-junit4</artifactId>
			<scope>test</scope>
		</dependency>

		<dependency>
			<groupId>log4j</groupId>
			<artifactId>log4j</artifactId>
			<scope>test</scope>
		</dependency>

		<dependency>
			<groupId>com.atlassian.jira</groupId>
			<artifactId>jira-tests</artifactId>
			<scope>test</scope>
			<exclusions>
				<exclusion>
					<groupId>org.powermock.api</groupId>
					<artifactId>powermock-api-easymock</artifactId>
				</exclusion>

				<exclusion>
					<groupId>org.easymock</groupId>
					<artifactId>easymockclassextension</artifactId>
				</exclusion>

				<exclusion>
					<groupId>org.easymock</groupId>
					<artifactId>easymock</artifactId>
				</exclusion>

				<exclusion>
					<groupId>org.hamcrest</groupId>
					<artifactId>hamcrest-library</artifactId>
				</exclusion>
			</exclusions>
		</dependency>

		<!-- PLUGIN DEPENDENCIES BEGIN -->
		<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.3.1</version>
			<scope>provided</scope>
		</dependency>

		<!-- For legacy version END -->

		<!-- Herite du parent BEGIN -->
		<dependency>
			<groupId>mysql</groupId>
			<artifactId>mysql-connector-java</artifactId>
		</dependency>
		<!-- PLUGIN FOR CUSTOM FIELD END -->

		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-api</artifactId>
			<version>1.7.26</version>
			<type>jar</type>
			<scope>provided</scope>
		</dependency>

	</dependencies>

	<build>

		<pluginManagement>
			<plugins>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-compiler-plugin</artifactId>
					<version>3.8.1</version>
					<configuration>
						<source>${maven.compiler.source}</source>
						<target>${maven.compiler.target}</target>
						<encoding>${maven.compiler.encoding}</encoding>
					</configuration>
				</plugin>

				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-surefire-plugin</artifactId>
					<version>3.0.0-M3</version>
					<configuration>
						<argLine>-XX:-UseSplitVerifier</argLine>
					</configuration>
				</plugin>

			</plugins>
		</pluginManagement>

		<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>
					<instructions>
						<Atlassian-Plugin-Key>${atlassian.plugin.key}</Atlassian-Plugin-Key>

						<!-- Add package to export here -->
						<Export-Package>
							fr.icdc.dei.dn1,
						</Export-Package>

						<!-- Add package import here -->
						<Import-Package>
							com.atlassian.jira.plugin.webfragment.conditions,
							org.springframework.osgi.*;resolution:="optional",
							org.eclipse.gemini.blueprint.*;resolution:="optional",
							*;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>
					<scannedDependencies>
						<dependency>
							<groupId>com.atlassian.plugin</groupId>
							<artifactId>atlassian-spring-scanner-external-jar</artifactId>
						</dependency>
					</scannedDependencies>
					<verbose>true</verbose>
				</configuration>
			</plugin>

			<plugin>
				<artifactId>maven-jar-plugin</artifactId>
				<version>3.1.2</version>
				<configuration>
					<archive>
						<manifestFile>
							${project.build.outputDirectory}/META-INF/MANIFEST.MF
						</manifestFile>
					</archive>
				</configuration>
			</plugin>

			<plugin>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>3.8.1</version>
				<configuration>
					<source>${maven.compiler.source}</source>
					<target>${maven.compiler.target}</target>
					<encoding>${maven.compiler.encoding}</encoding>
				</configuration>
				<dependencies>
					<dependency>
						<groupId>mysql</groupId>
						<artifactId>mysql-connector-java</artifactId>
						<version>${mysql-version}</version>
					</dependency>
				</dependencies>
			</plugin>
		</plugins>
	</build>

</project>

Please help me.

I finally solved my problem.

  1. I added META-INF/spring/plugin-context.xml, with :
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:atlassian-scanner="http://www.atlassian.com/schema/atlassian-scanner"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
        http://www.atlassian.com/schema/atlassian-scanner/2
        http://www.atlassian.com/schema/atlassian-scanner/2/atlassian-scanner.xsd">
    <atlassian-scanner:scan-indexes/>
</beans>
  1. I added the class JiraImportBidon with :
package fr.icdc.dei.dn1;

import javax.inject.Inject;
import javax.inject.Named;

import com.atlassian.jira.config.SubTaskManager;
import com.atlassian.jira.issue.IssueManager;
import com.atlassian.jira.issue.fields.FieldManager;
import com.atlassian.jira.security.PermissionManager;
import com.atlassian.plugin.spring.scanner.annotation.imports.ComponentImport;

@Named
public class JiraImportBidon {

	@Inject
	public JiraImportBidon(@ComponentImport IssueManager issueManager,
							@ComponentImport SubTaskManager stm,
							@ComponentImport PermissionManager pm,
							@ComponentImport FieldManager fm) {
		
	}
}
  1. the jira-maven-plugin configuration :
<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>
							fr.icdc.dei.dn1,
						</Export-Package>

						<!-- Add package import here -->
						<Import-Package>
							com.atlassian.jira.plugin.webfragment.conditions,
							org.springframework.osgi.*;resolution:="optional",
							org.eclipse.gemini.blueprint.*;resolution:="optional",
							*;resolution:="optional"
						</Import-Package>
						<!-- Ensure plugin is spring powered -->
						<Spring-Context>*</Spring-Context>
					</instructions>
				</configuration>
			</plugin>

Now, it works.
I hope it will help.

1 Like

Thanks for this – fixed it for me as well. I’ve been stuck on this for hours.