2011-07-27 107 views
1

我正在完成我的项目构建(使用maven),它的工作效果很好。现在我只需要“打包”,如同一只耳朵。Maven耳朵问题

我需要做的就是打包3个依赖关系,一个.jar和2个.war。不要问我是怎么做的,这是以前的做法(用蚂蚁做的),我将它翻译成maven - 接下来我将组织这些软件包,这样我们可以提高生产力。

但是,我遇到了一些问题。首先,该软件包名为null - $ {version} .ear。它将自己的权限复制到存储库,但在目标文件夹中被错误地命名。其次,它正在复制所有其他软件包依赖关系。我想知道我能做些什么关于空名称和软件包的复制。

这里是我的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> 
+0

null来自你的定义 ...(为什么你试试这个,不使用约定?)。此外,您正在使用$ {pom.groupId},它已经过时了,您应该使用$ {project.groupId}等来代替(不会maven对此产生警告?)。你为什么不使用SNAPSHOT版本? – khmarbaise

+0

我从另一个项目中复制了pom,它从头开始作为一个maven项目。我试图翻译这一个。谢谢,我做了你的所有建议!快照,它是旧的代码基础版本。 –

+0

我们是否必须在耳朵中指定依赖关系?为什么我不能使用父类的依赖关系? – Muky

回答

1

首先从你的POM删除元素,在application.id属性是什么给你“空”名称。

至于确保传递依赖不会在您的EAR中结束,我建议您在POM中明确指定您想要的和您不想要的。为了保持依赖关系,您只需在提供的范围内将其定义在您的POM中。我知道这是一件痛苦的工作,但在我看来这是值得的,以确保你得到你想要的东西。

+0

非常感谢,工作!我认为把它们提供给他们不会把它们包装在最后的耳朵里。非常感谢! –

+0

只是解释我的意思:我把提供的依赖关系,但他们的依赖没有进入包,而他们做。再次感谢。 –