2016-07-05 45 views
0

我多模塊Maven項目:Maven的模塊罐子不添加到戰爭的lib

Parent 
    Core module 
    Web module 
    War Module 

時期和戰爭時期的POM我添加的Web和核心的依賴性:

<?xml version="1.0"?> 
<project 
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" 
    xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 
    <modelVersion>4.0.0</modelVersion> 
    <parent> 
     <groupId>com.team.hello</groupId> 
     <artifactId>helloParent</artifactId> 
     <version>0.0.1-SNAPSHOT</version> 
    </parent> 
    <artifactId>hello-war</artifactId> 
    <packaging>war</packaging> 
    <name>hello-war Maven Webapp</name> 
    <url>http://maven.apache.org</url> 
    <dependencies> 
     <dependency> 
      <groupId>junit</groupId> 
      <artifactId>junit</artifactId> 
      <version>3.8.1</version> 
      <scope>test</scope> 
     </dependency> 
     <dependency> 
      <groupId>com.team.hello</groupId> 
      <artifactId>hello-web</artifactId> 
      <version>0.0.1-SNAPSHOT</version> 
     </dependency> 
     <dependency> 
      <groupId>com.team.hello</groupId> 
      <artifactId>hello-core</artifactId> 
      <version>0.0.1-SNAPSHOT</version> 
     </dependency> 
    </dependencies> 
    <build> 
     <finalName>hello-war</finalName> 
     <pluginManagement> 
      <plugins> 
       <plugin> 
        <artifactId>maven-war-plugin</artifactId> 
        <version>2.6</version> 
        <configuration> 
         <packagingIcludes>WEB-INF/lib/*.jar</packagingIcludes> 
        </configuration> 
       </plugin> 
      </plugins> 
     </pluginManagement> 
    </build> 
</project> 

,並在網站的pom.xml我添加了Core模塊的依賴項。

在建設使用我看到在戰爭中的lib文件夾兩瓶,但同時發佈到JBoss的EAP它僅複製網頁的jar文件夾lib但不是核心的jar文件。

你能告訴我我哪裏錯了嗎?

+0

如果你打開這場戰爭,它裏面有什麼? – Taylor

+0

lib文件夾中的所有maven相關jar文件和hello-web-0-0-1-snapshot.jar文件,視圖等。但hello-core-0-0-1-sapshot.jar不會複製到lib文件夾 – Arat

+1

'packagingIcludes'有一個錯字,它應該是'packagingIncludes'。但爲什麼要使用它呢?刪除它,讓'maven-war-plugin'完成它的工作。 – Tunaki

回答

2

最後我找到了解決方案。我刪除了pluginmanagement,然後刪除了.settings和.project的war模塊,然後重新導入項目(檢查部署的程序集,它有核心和web和maven)清理過的jboss eclipse(在eclipse jboss服務器 - 右鍵單擊​​ - >乾淨),然後它發佈的罐子。

相關問題