Proper way to add dependency Edited

I'm trying to use Stanford CoreNLP on my plugin module (Web-Panel), so I added the following dependencies to pom.xml:

<dependency> 
<groupId>edu.stanford.nlp</groupId>
<artifactId>stanford-corenlp</artifactId>
<version>${corenlp.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>edu.stanford.nlp</groupId>
<artifactId>stanford-corenlp</artifactId>
<version>${corenlp.version}</version>
<classifier>models</classifier>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>edu.stanford.nlp</groupId>
<artifactId>stanford-corenlp</artifactId>
<version>${corenlp.version}</version>
<classifier>models-spanish</classifier>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId>
<version>${slf4j.version}</version>
<scope>provided</scope>
</dependency>

where properties:

<properties>
<corenlp.version>3.8.0</corenlp.version>
<slf4j.version>1.7.25</slf4j.version>

<jira.version>7.2.2</jira.version>
<amps.version>6.2.11</amps.version>
<plugin.testrunner.version>1.2.3</plugin.testrunner.version>
<atlassian.spring.scanner.version>1.2.13</atlassian.spring.scanner.version>
<atlassian.plugin.key>${project.groupId}.${project.artifactId}</atlassian.plugin.key>
<testkit.version>6.3.11</testkit.version>
</properties>

 I also added it in Import-Package:

<Import-Package>
edu.stanford.*;resolution:="optional",
org.springframework.osgi.*;resolution:="optional",
org.eclipse.gemini.blueprint.*;resolution:="optional",
*;version="0";resolution:=optional
</Import-Package>

then I got this error message:

The following plugins failed to load:
web-panel-comment: A required class was missing: java.lang.Void. Please check that you have all of the required dependencies.<br/>edu/stanford/nlp/pipeline/Annotation

Did I miss something here?...

Sincerely,

1 answer

1 accepted

1 vote
Aleksandr Zuevich Community Champion Oct 20, 2017

Hi.

I suppose you need scope compile for edu.stanford.nlp dependencies.

Hi @Aleksandr Zuevich, thank you so much for the reply.

I had tried to use the scope compile, but got another message:

___ FAILED PLUGIN REPORT _____________________

1 plugin failed to load during JIRA startup.
'com.comment.plugins.nlp.web-panel-comment' - 'web-panel-comment' failed to load.
Unexpected exception parsing XML document from URL [bundle://167.0:0/META-INF/spring/plugin-context.xml]; nested exception is java.lang.LinkageError: loader constraint violation: loader (instance of org/apache/felix/framework/BundleWiringImpl$BundleClassLoaderJava5) previously initiated loading for a different type with name "org/w3c/dom/Element" loader constraint violation: loader (instance of org/apache/felix/framework/BundleWiringImpl$BundleClassLoaderJava5) previously initiated loading for a different type with name "org/w3c/dom/Element"

So I had to set exclussion on those Stanford CoreNLP dependencies:

<exclusions>
<exclusion>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
</exclusion>
</exclusions>

and after occured a problem with Java heap size...,  so I added the following JVM argument in com.atlassian.maven.plugins <configuration>:

<jvmArgs>-Xmx2g -XX:MaxPermSize=1g</jvmArgs>

Everything works fine now.
Thanks.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Monday in Jira Software

How large do you think Jira Software can grow?

Hi Atlassian Community! My name is Shana, and I’m on the Jira Software team. One of the many reasons this Community exists is to connect you to others on similar product journeys or with comparabl...

588 views 6 12
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you