首页 文章

eclipse Maven和lib文件夹

提问于
浏览
-1

我已经编辑了这篇文章进一步研究 . 我是maven的新手 . 我创建了一个多模块maven项目,包括父,战,耳 . 所有的jar,war和ear文件都是按照预期使用Maven构建的 . .ear文件ear包装包含war文件 . 我正在运行的问题是所有依赖的jar都打包在web-inf / lib文件夹而不是最终的xxx.ear / lib如何让依赖的jar存储在xxx.ear / lib而不是web-inf / lib中 .

http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>com.xxx.xxx</groupId>
    <artifactId>com.xxx.xxx</artifactId>
    <version>0.1.0.BUILD-SNAPSHOT</version>
    <relativePath>..</relativePath>
  </parent>
  <artifactId>com.xxx.xxx.ear</artifactId>
  <packaging>ear</packaging>
            <groupId>com.xxx.xxxx</groupId>
        <artifactId>com.xxx.xxx.relatedtoweb</artifactId>
        <version>0.1.0.BUILD-SNAPSHOT</version>
        <type>war</type>
    </dependency>
  </dependencies>
  <build>
  <finalName>xxx</finalName>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-ear-plugin</artifactId>
        <configuration>
          <defaultJavaBundleDir>lib/</defaultJavaBundleDir>
           <modules>
             <webModule>
                <groupId>com.xxx.xxx</groupId>
                <artifactId>com.xxx.xxx.relatedtoweb</artifactId>
                <contextRoot>/xxx</contextRoot>
                <uri>com.xxx.xxx.relatedtoweb.war</uri>
             </webModule>
          </modules>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>

1 回答

  • 0

    尝试将skinnyWars添加到配置中

    <configuration>
              <skinnyWars>true</skinnyWars>
              <defaultLibBundleDir>lib/</defaultLibBundleDir>
               <modules>
                 <webModule>
                    <groupId>com.xxx.xxx</groupId>
                    <artifactId>com.xxx.xxx.relatedtoweb</artifactId>
                    <contextRoot>/xxx</contextRoot>
                    <uri>com.xxx.xxx.relatedtoweb.war</uri>
                 </webModule>
              </modules>
    </configuration>
    

相关问题