2017-07-31 138 views
1

我正在嘗試使用DropWizard爲NLP庫(Illinois NER tagger)創建REST api服務器。以下是我.pom文件的內容:Maven的依賴關係收斂錯誤

<repositories> 
    <repository> 
     <id>sonatype-nexus-snapshots</id> 
     <name>Sonatype Nexus Snapshots</name> 
     <url>http://oss.sonatype.org/content/repositories/snapshots</url> 
    </repository> 
    <repository> 
     <id>CogcompSoftware</id> 
     <name>CogcompSoftware</name> 
     <url>http://cogcomp.cs.illinois.edu/m2repo/</url> 
    </repository> 
</repositories> 

<dependencyManagement> 
    <dependencies> 
     <dependency> 
      <groupId>io.dropwizard</groupId> 
      <artifactId>dropwizard-bom</artifactId> 
      <version>${project.version}</version> 
      <type>pom</type> 
      <scope>import</scope> 
     </dependency> 
    </dependencies> 
</dependencyManagement> 

<dependencies> 
    <dependency> 
     <groupId>edu.illinois.cs.cogcomp</groupId> 
     <artifactId>illinois-ner</artifactId> 
     <version>3.0.72</version> 
    </dependency> 
    <dependency> 
     <groupId>io.dropwizard</groupId> 
     <artifactId>dropwizard-core</artifactId> 
     <version>1.1.2</version> 
    </dependency> 
    <dependency> 
     <groupId>io.dropwizard</groupId> 
     <artifactId>dropwizard-http2</artifactId> 
     <version>1.1.2</version> 
    </dependency> 
    <dependency> 
     <groupId>io.dropwizard</groupId> 
     <artifactId>dropwizard-hibernate</artifactId> 
     <version>1.1.2</version> 
    </dependency> 
    <dependency> 
     <groupId>io.dropwizard</groupId> 
     <artifactId>dropwizard-metrics-graphite</artifactId> 
     <version>1.1.2</version> 
    </dependency> 
    <dependency> 
     <groupId>com.h2database</groupId> 
     <artifactId>h2</artifactId> 
     <version>1.4.196</version> 
    </dependency> 
</dependencies> 

在其上添加依賴標籤相對應伊利諾伊州庫的儲存庫標籤我的代碼與下面的錯誤上mvn package

[INFO] 
[INFO] --- maven-enforcer-plugin:1.4.1:enforce (enforce) @ dropwizard-example --- 
[WARNING] 
Dependency convergence error for edu.illinois.cs.cogcomp:illinois-core-utilities:3.0.72 paths to dependency are: 
+-io.dropwizard:dropwizard-example:1.2.0-SNAPSHOT 
    +-edu.illinois.cs.cogcomp:illinois-ner:3.0.72 
    +-edu.illinois.cs.cogcomp:illinois-tokenizer:3.0.72 
     +-edu.illinois.cs.cogcomp:illinois-core-utilities:3.0.72 
and 
+-io.dropwizard:dropwizard-example:1.2.0-SNAPSHOT 
    +-edu.illinois.cs.cogcomp:illinois-ner:3.0.72 
    +-edu.illinois.cs.cogcomp:illinois-core-utilities:3.0.72 
and 
+-io.dropwizard:dropwizard-example:1.2.0-SNAPSHOT 
    +-edu.illinois.cs.cogcomp:illinois-ner:3.0.72 
    +-edu.illinois.cs.cogcomp:LBJava:1.2.24 
     +-edu.illinois.cs.cogcomp:illinois-inference:0.6.0 
     +-edu.illinois.cs.cogcomp:illinois-core-utilities:3.0.51 
and 
+-io.dropwizard:dropwizard-example:1.2.0-SNAPSHOT 
    +-edu.illinois.cs.cogcomp:illinois-ner:3.0.72 
    +-edu.illinois.cs.cogcomp:LBJava:1.2.24 
     +-edu.illinois.cs.cogcomp:illinois-inference:0.6.0 
     +-edu.illinois.cs.cogcomp:illinois-sl-core:1.0.2 
      +-edu.illinois.cs.cogcomp:illinois-core-utilities:3.0.22 
and 
+-io.dropwizard:dropwizard-example:1.2.0-SNAPSHOT 
    +-edu.illinois.cs.cogcomp:illinois-ner:3.0.72 
    +-edu.illinois.cs.cogcomp:LBJava-NLP-tools:1.0.1 
     +-edu.illinois.cs.cogcomp:illinois-core-utilities:1.2.11 

[WARNING] 
Dependency convergence error for edu.illinois.cs.cogcomp:LBJava:1.2.24 paths to dependency are: 
+-io.dropwizard:dropwizard-example:1.2.0-SNAPSHOT 
    +-edu.illinois.cs.cogcomp:illinois-ner:3.0.72 
    +-edu.illinois.cs.cogcomp:LBJava:1.2.24 
and 
+-io.dropwizard:dropwizard-example:1.2.0-SNAPSHOT 
    +-edu.illinois.cs.cogcomp:illinois-ner:3.0.72 
    +-edu.illinois.cs.cogcomp:LBJava-NLP-tools:1.0.1 
     +-edu.illinois.cs.cogcomp:LBJava:1.1.0 

[WARNING] Rule 0: org.apache.maven.plugins.enforcer.DependencyConvergence failed with message: 
Failed while enforcing releasability the error(s) are [ 
Dependency convergence error for edu.illinois.cs.cogcomp:illinois-core-utilities:3.0.72 paths to dependency are: 
+-io.dropwizard:dropwizard-example:1.2.0-SNAPSHOT 
    +-edu.illinois.cs.cogcomp:illinois-ner:3.0.72 
    +-edu.illinois.cs.cogcomp:illinois-tokenizer:3.0.72 
     +-edu.illinois.cs.cogcomp:illinois-core-utilities:3.0.72 
and 
+-io.dropwizard:dropwizard-example:1.2.0-SNAPSHOT 
    +-edu.illinois.cs.cogcomp:illinois-ner:3.0.72 
    +-edu.illinois.cs.cogcomp:illinois-core-utilities:3.0.72 
and 
+-io.dropwizard:dropwizard-example:1.2.0-SNAPSHOT 
    +-edu.illinois.cs.cogcomp:illinois-ner:3.0.72 
    +-edu.illinois.cs.cogcomp:LBJava:1.2.24 
     +-edu.illinois.cs.cogcomp:illinois-inference:0.6.0 
     +-edu.illinois.cs.cogcomp:illinois-core-utilities:3.0.51 
and 
+-io.dropwizard:dropwizard-example:1.2.0-SNAPSHOT 
    +-edu.illinois.cs.cogcomp:illinois-ner:3.0.72 
    +-edu.illinois.cs.cogcomp:LBJava:1.2.24 
     +-edu.illinois.cs.cogcomp:illinois-inference:0.6.0 
     +-edu.illinois.cs.cogcomp:illinois-sl-core:1.0.2 
      +-edu.illinois.cs.cogcomp:illinois-core-utilities:3.0.22 
and 
+-io.dropwizard:dropwizard-example:1.2.0-SNAPSHOT 
    +-edu.illinois.cs.cogcomp:illinois-ner:3.0.72 
    +-edu.illinois.cs.cogcomp:LBJava-NLP-tools:1.0.1 
     +-edu.illinois.cs.cogcomp:illinois-core-utilities:1.2.11 
, 
Dependency convergence error for edu.illinois.cs.cogcomp:LBJava:1.2.24 paths to dependency are: 
+-io.dropwizard:dropwizard-example:1.2.0-SNAPSHOT 
    +-edu.illinois.cs.cogcomp:illinois-ner:3.0.72 
    +-edu.illinois.cs.cogcomp:LBJava:1.2.24 
and 
+-io.dropwizard:dropwizard-example:1.2.0-SNAPSHOT 
    +-edu.illinois.cs.cogcomp:illinois-ner:3.0.72 
    +-edu.illinois.cs.cogcomp:LBJava-NLP-tools:1.0.1 
     +-edu.illinois.cs.cogcomp:LBJava:1.1.0 
] 
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD FAILURE 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 38.047 s 
[INFO] Finished at: 2017-07-31T16:36:33+05:30 
[INFO] Final Memory: 27M/1517M 
[INFO] ------------------------------------------------------------------------ 
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:1.4.1:enforce (enforce) on project dropwizard-example: Some Enforcer rules have failed. Look above for specific messages explaining why the rule failed. -> [Help 1] 
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. 
[ERROR] Re-run Maven using the -X switch to enable full debug logging. 
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles: 
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException 

崩潰請幫我解決這個錯誤。

+0

您需要查找您的父pom並檢查您在dependencyManagement部分使用的庫依賴關係。由於你的pom上很多庫上沒有版本標籤。我建議你在你的項目中運行一個依賴樹,你可能使用了依賴於對方的不同版本的庫。 –

+0

我已經包含了我正在使用的庫的版本號,但仍然收到相同的錯誤。我從來沒有在maven中使用過parent和dependencyManagement標籤,你可以通過代碼展示它在這種情況下的使用方式嗎? –

回答

1

要解決此錯誤,您需要管理dependencyManagement部分中衝突工件的版本。

例如:要解決這一問題的edu.illinois.cs.cogcomp:illinois-core-utilities您需要在您的dependencyManagement部分像

<dependency> 
    <groupId>edu.illinois.cs.cogcomp</groupId> 
    <artifactId>illinois-core-utilities</artifactId> 
    <version>3.0.72</version> 
</dependency> 

的條目。

+0

pom文件中已經有一個dependencyManagement tage。請看看我已經更新了這個問題。你的建議沒有解決,你能提出其他建議嗎? –

+0

你是什麼意思:「沒有工作」?您是否真的將所有相互矛盾的依賴項(edu.illinois.cs.cogcomp:illinois-core-utilities,edu.illinois.cs.cogcomp:LBJava,...)添加到您的dependencyManagement作爲我向您展示的條目?然後請編輯問題並顯示完整的pom和你得到的錯誤。 –

+0

非常感謝!你的解決方案工作 –