2017-09-05 70 views
2
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-ear- 
    plugin:2.6:generate-application-xml (default-generate-application-xml) 
    on project itaras-ear: Artifact[war:org.apache.maven.plugins:maven-war- 
    plugin] is not a dependency of the project. 

首先我建了一個WAR文件爲我的應用程序的依賴。現在我正在構建我的EAR文件,該文件應該具有WAR作爲依賴關係。Maven的錯誤:神器不是項目

當我收到上面提到的錯誤信息時,我已經運行了帶有m2e插件的ITARAS-EAR模塊。

模塊WAR的pom.xml如下。

<parent> 
    <groupId>itaras</groupId> 
    <artifactId>itaras</artifactId> 
    <version>1.0-SNAPSHOT</version> 
    </parent> 
<groupId>itaras-war</groupId> 
<artifactId>itaras-war</artifactId> 
<packaging>war</packaging> 
    <build> 
<plugins> 
    <plugin>    
    <groupId>org.apache.maven.plugins</groupId> 
    <artifactId>maven-war-plugin</artifactId> 
    <configuration> 
     <webXml>src\main\webapp\WEB-INF\web.xml</webXml>   
     </configuration> 
    </plugin> 
    </plugins> 
     </build> 
    </project> 

模塊EAR的pom.xml就在這裏。

<parent> 
    <groupId>itaras</groupId> 
    <artifactId>itaras</artifactId> 
    <version>1.0-SNAPSHOT</version> 
    </parent> 
<artifactId>itaras-ear</artifactId> 
<packaging>ear</packaging> 
    <dependencies> 
    <dependency> 
     <groupId>itaras-war</groupId> 
     <artifactId>itaras-war</artifactId> 

     <type>war</type> 
     <version>${project.version}</version> 
    </dependency> 

    </dependencies> 
    <build> 
    <plugins> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
     <artifactId>maven-ear-plugin</artifactId> 
     <version>2.6</version> 
     <configuration> 
       <defaultLibBundleDir>lib</defaultLibBundleDir> 
      <applicationXML>src/main/application/META- 
     INF/application.xml</applicationXML> 
     </configuration> 
    </plugin> 
    </plugins> 
    </build> 
    <groupId>itaras-ear</groupId> 
    </project> 

在此先感謝。請糾正我,如果我去了根本性的錯誤:)

+0

PS:我試圖做不知道它做什麼確切的東西。只需通過搜索來嘗試一些東西 – SRKprakash

回答

2

你的戰爭項目有2組id

<parent> 
    <groupId>itaras</groupId> 
    <artifactId>itaras</artifactId> 
    <version>1.0-SNAPSHOT</version> 
    </parent> 
*** <groupId>itaras-war</groupId> **** 
<artifactId>itaras-war</artifactId> 
<packaging>war</packaging> 

刪除groupId和允許它拿起它的groupId從父。只能從父級指定artifactId,version和groupId。

然後你的依賴在你的耳朵項目戰爭:

<dependencies> 
    <dependency> 
     <groupId>itaras</groupId> 
     <artifactId>itaras-war</artifactId> 
     <type>war</type> 
     <version>${project.version}</version> 
    </dependency> 
</dependencies> 
+0

感謝您的糾正。但仍然錯誤仍然存​​在..還有什麼我必須做的? – SRKprakash