2016-07-05 96 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服务器 - 右键单击​​ - >干净),然后它发布的罐子。