简体   繁体   English

EAR打包了WAR和JAR项目的两个副本

[英]EAR is packing two copies of WAR and JAR projects

My Maven EAR project packs my EAR with two copies of each of my libraries. 我的Maven EAR项目将我的EAR打包成每个库的两个副本。 One copy is always appended with the version (In my case 1.0-SNAPSHOT). 该版本始终附带一个副本(在我的情况下为1.0-SNAPSHOT)。 Is there something screwed up in my POMs? 我的POM中有东西搞砸了吗?

I keep getting these type of errors when i try and deploy to server: 当我尝试将其部署到服务器时,我不断收到这些类型的错误:

Servlet [blah...] and Servlet [blah..] have the same url pattern: [/RegistrationService_V10]. Servlet [blah ...]和Servlet [blah ..]具有相同的url模式:[/ RegistrationService_V10]。

在此处输入图片说明

My EAR project POM looks like this : 我的EAR项目POM看起来像这样:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <artifactId>AlmexOffice</artifactId>
        <groupId>com.huwag</groupId>
        <version>1.0-SNAPSHOT</version>
    </parent>
    <groupId>com.huwag</groupId>
    <artifactId>AlmexOffice-ear</artifactId>
    <packaging>ear</packaging>
    <version>1.0-SNAPSHOT</version>
    <name>AlmexOFfice-ear JavaEE6 Assembly</name>
    <url>http://maven.apache.org</url>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.0.2</version>
                <configuration>
                    <source>1.5</source>
                    <target>1.5</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-ear-plugin</artifactId>
                <version>2.4</version>
                <configuration>
                    <version>6</version>
                </configuration>
            </plugin>
        </plugins>
        <finalName>AlmexOffice-ear</finalName>
    </build>
    <dependencies>
        <dependency>
            <groupId>com.huwag</groupId>
            <artifactId>AlmexOffice-ejb</artifactId>
            <version>1.0-SNAPSHOT</version>
            <type>ejb</type>
        </dependency>
        <dependency>
            <groupId>com.huwag</groupId>
            <artifactId>AlmexOffice-web</artifactId>
            <version>1.0-SNAPSHOT</version>
            <type>war</type>
        </dependency>
    </dependencies>
</project>

In the maven-ear-plugin, you have to specify your ejbmodule and webmodule 在maven-ear-plugin中,您必须指定ejbmodule和webmodule

<plugin>
    <artifactId>maven-ear-plugin</artifactId>
    <version>2.8</version>
    <configuration>
      <modules>
        <ejbModule>
           <groupId>com.huwag</groupId>
           <artifactId>AlmexOffice-ejb</artifactId>
        </ejbModule>
        <webModule>
           <groupId>com.huwag</groupId>
           <artifactId>AlmexOffice-web</artifactId>
           <contextRoot>/custom-context-root</contextRoot>
         </webModule>
      </modules>
    </configuration>
</plugin>

Could you give us the feedback if it works better? 如果效果更好,您能给我们反馈吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM