我試圖用EJB和WAR創建EAR項目,但我遇到了一些問題。 我從原型創造的IntelliJ IDEA的主要項目:如何在maven中使用EJB和WAR構建EAR項目?
<dependency>
<groupId>org.codehaus.mojo.archetypes</groupId>
<artifactId>ear-javaee6</artifactId>
<version>1.5</version>
</dependency>
然後,我創建了從原型EJB模塊:
<dependency>
<groupId>org.codehaus.mojo.archetypes</groupId>
<artifactId>ejb-javaee6</artifactId>
<version>1.5</version>
</dependency>
然後我創建了從原型第二模塊:
<dependency>
<groupId>javax.faces</groupId>
<artifactId>javax.faces-war-archetype</artifactId>
<version>2.2</version>
</dependency>
然後我添加了對主要pom.xml的依賴關係:
<!-- Define the versions of your ear components here -->
<dependencies>
<dependency>
<groupId>QCforCC-main</groupId>
<artifactId>QCforCC-ejb</artifactId>
<version>1.0-SNAPSHOT</version>
<type>ejb</type>
</dependency>
<dependency>
<groupId>QCforCC-main</groupId>
<artifactId>QCforCC-war</artifactId>
<version>1.0-SNAPSHOT</version>
<type>war</type>
</dependency>
</dependencies>
然後我試圖建立項目 - 使用maven clean和instal。 但是我有一個錯誤:
[ERROR] The projects in the reactor contain a cyclic reference: Edge between 'Vertex{label='QCforCC-main:QCforCC-war:1.0-SNAPSHOT'}' and 'Vertex{label='QCforCC-main:QCforCC-ejb:1.0-SNAPSHOT'}' introduces to cycle in the graph QCforCC-main:QCforCC-ejb:1.0-SNAPSHOT --> QCforCC-main:QCforCC-war:1.0-SNAPSHOT --> QCforCC-main:QCforCC-ejb:1.0-SNAPSHOT -> [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/ProjectCycleException
Process finished with exit code 1
及入耳式pom.xml
我:
<modules>
<module>QCforCC-ejb</module>
<module>QCforCC-war</module>
</modules>
<packaging>pom</packaging>
但是,如果我改變<packaging>pom</packaging>
到<packaging>ear</packaging>
IDEA顯示錯誤彈出:
Some problems were encountered while processing the POMs: [WARNING] 'build.plugins.plugin.(groupId:artifactId)' must be unique but found duplicate declaration of plugin org.apache.maven.plugins:maven-ear-plugin @ line 41, column 21 [ERROR] 'packaging' with value 'ear' is invalid. Aggregator projects require 'pom' as packaging. @ line 12, column 16
是什麼和? –
Pavel
請參閱maven-ear-plugin的文檔:https://maven.apache.org/plugins/maven-ear-plugin/modules.html – sh0rug0ru
工件QCforCC-ear:ejb爆炸:java.io.IOException: com.sun.enterprise.admin.remote.RemoteFailureException:未識別C:\ app \ QCforCC-mainApp \ QCforCC-ear \ target \ QCforCC-ear-1.0-SNAPSHOT的存檔類型 – Pavel