使用maven-ear-plugin创建war文件并将其定义在一个pom.xml中

|| 我处于Maven使用入门级别。我希望我可以清楚地解释我的问题,我想创建一个包含war文件的ear文件。我计划一开始就使用它来创建战争文件。我也想在我的项目的pom.xml中执行此操作,并且只有一个pom.xml,这就是问题所在; 我可以在一个pom.xml文件中创建包含在同一时间创建的战争的ear文件吗? 当我尝试在webmodule标签中创建war文件时,这是我遇到的问题“ Artifact [war:denem.denem:denem]不是项目的依赖项。”我明白了,所以这就是为什么我添加了该文件在同一pom.xml中的依赖关系,但是这次我遇到了该问题 (通过我的命令来构建此pom的方式是\“ mvn clean package \”) \“缺少1个必需的工件。 对于工件:
com.denem.denem:com.denem.de2:ear:v0.1\"
它试图找到该战争文件,但我想创建它而不是找到它。这里的代码在我的pom.xml文件中;
<parent>
    <groupId>denem.denem</groupId>
    <artifactId>com.denem.denem</artifactId>
    <version>v0.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>denem.denem</groupId>
<artifactId>com.denem.de2</artifactId>
<version>v0.1</version>

<packaging>ear</packaging>

<properties>
    <cxf.version>2.2.5</cxf.version>
</properties>
<dependencies>
    <dependency>
        <groupId>denem.denem</groupId>
        <artifactId>denem</artifactId>
        <version>v0.1</version>
        <type>war</type>
    </dependency>
</dependencies>
<build>
    <plugins>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-ear-plugin</artifactId>
            <version>2.5</version>
            <configuration>
                <finalName>edu</finalName>
                <defaultLibBundleDir>lib</defaultLibBundleDir>
                <modules>
                    <webModule>
                        <groupId>denem.denem</groupId>
                        <artifactId>denem</artifactId>
                        <contextRoot>/WebContent</contextRoot>
                    </webModule>
                </modules>
            </configuration>
        </plugin>

    </plugins>
</build>
我想我做错了很多事。但是,如果您能帮助我,我会很高兴。还是很感谢你。     
已邀请:
您需要创建一个模块化项目。 创建: 类型为“ pom”的父项目; “ war”类型的子项目; 如果需要,子类型为“ ejb”的子项目; 如果需要,子类型为“ jar”的子项目(公共库); 一个类型为“ ear”的项目,具有以上所有内容。 在后者中,您需要配置ear插件,以放置所需的所有模块。     

要回复问题请先登录注册