2011-04-12 52 views
2

我处于maven使用的入门级别。我希望我能清楚地解释我的问题,我想创建一个包含war文件的ear文件。而且我打算从一开始就用它来创建一个战争文件。另外我想在我的项目中的pom.xml中做到这一点,并且只有一个pom.xml,这是问题;使用maven-ear-plugin创建war文件并将其定义在一个pom.xml中

  1. 我可以创建ear文件,并且其中包含我在一个pom.xml文件中同时创建的这个war文件吗?
  2. 当我尝试在webmodule标记中创建war文件时,这里是我遇到的问题“Artifact [war:denem.denem:denem]不是项目的依赖项。”我明白这就是为什么我添加依赖本文件中的相同的pom.xml但这次我遇到的问题

(顺便说一下我的命令来建立这个POM是“MVN清洁套装”)

“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> 

我想我做的很多事情是错误的。但如果你能帮助我,我会很高兴。不管怎样,谢谢你。

回答

2

您需要创建一个模块化项目。 创建:

  1. “pom”类型的父项目;
  2. 类型为“战争”的儿童项目;
  3. 如果需要,子类型为“ejb”的项目;
  4. 如果需要的话,类型为“jar”的子项目(公共库);
  5. “耳朵”类型的一个项目,具有上述所有依赖关系。

在后者中,您需要配置耳塞插入您需要的所有模块。

相关问题