首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >maven构建ear -如何构建一个.ear文件而不构建分解的ear目录?

maven构建ear -如何构建一个.ear文件而不构建分解的ear目录?
EN

Stack Overflow用户
提问于 2017-02-20 18:56:45
回答 1查看 340关注 0票数 0

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

我不想要dir myEar (爆炸式ear版本)。

为了清楚起见,下面是我的构建输出:

代码语言:javascript
复制
20/02/2017  11:37    <DIR>          myEar
20/02/2017  11:37         7.985.535 myEar.ear

我只想要myEar.ear。

谢谢。

这是我的耳朵pom.xml:

代码语言:javascript
复制
    <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>

(...)

代码语言:javascript
复制
</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>
EN

回答 1

Stack Overflow用户

发布于 2017-02-20 20:56:40

我用maven-antrun-plugin修复了...maven内部的蚂蚁叫声。非常脏..。有人有更好的主意吗?

代码语言:javascript
复制
<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>
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/42342693

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档