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
Accepted answer
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
Community showcase
Published Wednesday in Jira

Make your Atlassian Cloud products more secure: our NEW admin security guide

Hey admins! I’m Dave, Principal Product Manager here at Atlassian working on our cloud platform and security products. Cloud security is a moving target. As you adopt more products, employees consta...

93 views 0 4
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