Proper way to add dependency

Chien-Hao Chen October 19, 2017

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
Answer accepted
Aleksandr Zuevich
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.
October 20, 2017

Hi.

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

Chien-Hao Chen October 23, 2017

---

Chien-Hao Chen October 24, 2017

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