【问题标题】:maven build ear - how I can build just a .ear file and not the exploded ear dir?maven build ear - 我如何只构建一个 .ear 文件而不是爆炸的 ear 目录?
【发布时间】:2017-02-20 20:56:40
【问题描述】:

我只需要一个 myEar.ear 文件作为我的 maven 构建的输出。

我不想要 dir myEar(爆炸耳朵版本)。

明确地说,这是我的构建输出:

20/02/2017  11:37    <DIR>          myEar
20/02/2017  11:37         7.985.535 myEar.ear

我只想要 myEar.ear。

谢谢。

这是我耳朵的 pom.xml:

    <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/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <name>myEar</name>
  <description>myEar</description>

  <groupId>com.foo</groupId>
  <artifactId>myEar</artifactId>
  <version>1.0</version>
  <packaging>ear</packaging>

    <parent>
    </parent>

  <properties>
  </properties>

  <dependencies>

(...)

</dependencies>

  <build>
    <plugins>


      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-ear-plugin</artifactId>
        <version>2.8</version>
        <configuration>
            <defaultLibBundleDir>lib</defaultLibBundleDir>
            <generatedDescriptorLocation>${basedir}/src/main/application/META-INF</generatedDescriptorLocation>
            <modules>
                <webModule>
                    <groupId>com.foo</groupId>
                    <artifactId>myWeb</artifactId>                    
                    <contextRoot>/myWeb</contextRoot>
                </webModule>
                 <webModule>
                    <groupId>com.foo</groupId>
                    <artifactId>myWS</artifactId>                     
                    <contextRoot>/</contextRoot>
                </webModule>
            </modules>
                <archive>
                    <addMavenDescriptor>false</addMavenDescriptor>
                </archive>
        </configuration>
      </plugin>
    </plugins>

       <directory>${basedir}/../target/diraliases/EARHOMEDIR1036</directory>
       <finalName>myEar</finalName>

   </build>

</project>

【问题讨论】:

  • 为什么要配置&lt;directory&gt;${basedir}/..?在当前模块之外?你检查过myEAR 文件夹里面的内容吗?
  • 说来话长……我需要倾听该目录的信息,才能抱怨我公司的变更管理。无论如何 .ear 和文件夹具有相同的内容。

标签: maven build ear


【解决方案1】:

我用 maven-antrun-plugin 修复了...在 maven 中调用 ant...非常脏...有人有更好的主意吗?

<plugin>
    <artifactId>maven-antrun-plugin</artifactId>
    <executions>
        <execution>
            <id>deleteDir</id>
            <phase>package</phase>
            <configuration>
                <tasks>
                    <delete dir="${basedir}/../target/diraliases/EARHOMEDIR1036/myEar"/> 
                </tasks>
            </configuration>
            <goals>
                <goal>run</goal>
            </goals>
        </execution>
    </executions>
</plugin>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-04-26
    • 2017-06-02
    • 1970-01-01
    • 1970-01-01
    • 2019-06-04
    • 1970-01-01
    • 1970-01-01
    • 2013-07-07
    相关资源
    最近更新 更多