Maven耳朵问题

时间:2011-07-27 12:53:34

标签: maven ear

我正在完成我的项目构建(使用maven),并且它工作得很好。现在我只需要“收拾它”,就像耳朵一样。

我需要做的就是打包3个依赖项,一个.jar和2.war。不要问我怎么样,这就是以前做过的方式(用蚂蚁),我把它翻译成maven - 接下来我会组织包裹,这样我们就可以提高工作效率。

但是,我遇到了一些问题。首先,该包名为null - $ {version} .ear。它将自身复制到存储库,但在目标文件夹中被错误地命名。其次,它正在复制所有其他软件包依赖项。我想知道如何处理null名称和复制包。

这是我的pom:

<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>
        <groupId>owner</groupId>
        <artifactId>coreisp</artifactId>
        <version>2.0</version>
    </parent>
    <groupId>owner</groupId>
    <artifactId>coreisp-app</artifactId>
    <packaging>ear</packaging>
    <version>2.0</version>
    <name>Projeto CoreISP</name>
    <dependencies>
        <dependency>
            <groupId>${pom.groupId}</groupId>
            <artifactId>coreisp-core</artifactId>
            <version>${pom.version}</version>
            <type>jar</type>
        </dependency>
        <dependency>
            <groupId>${pom.groupId}</groupId>
            <artifactId>coreisp-initializer</artifactId>
            <type>war</type>
            <version>${pom.version}</version>
        </dependency>
        <dependency>
            <groupId>${pom.groupId}</groupId>
            <artifactId>coreisp-site</artifactId>
            <type>war</type>
            <version>${pom.version}</version>
        </dependency>
    </dependencies>
    <build>
        <finalName>${application.id}-${pom.version}</finalName>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-ear-plugin</artifactId>
                <version>2.3</version>
                <configuration>
                    <modules>
                        <jarModule>
                            <groupId>owner</groupId>
                            <artifactId>coreisp-core</artifactId>
                            <includeInApplicationXml>
                            true
                            </includeInApplicationXml>
                            <bundleDir>/</bundleDir>
                        </jarModule>
                        <webModule>
                            <groupId>owner</groupId>
                            <artifactId>
                            coreisp-initializer
                            </artifactId>
                            <bundleDir>/</bundleDir>
                        </webModule>
                        <webModule>
                            <groupId>owner</groupId>
                            <artifactId>
                            coreisp-site
                            </artifactId>
                            <bundleDir>/</bundleDir>
                        </webModule>
                    </modules>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

1 个答案:

答案 0 :(得分:1)

首先从POM中删除元素,application.id属性为您提供“null”名称。

为了确保传递依赖关系不会在您的EAR中结束,我建议您在POM中明确指定您想要的以及您不想要的内容。为了保持依赖性,您需要做的就是在POM中使用提供的范围定义它。我知道这是一项痛苦的工作,但在我看来,这是值得的,以确保你得到你想要的。

相关问题