【问题标题】:How to copy .war file to another directory with maven?如何使用 Maven 将 .war 文件复制到另一个目录?
【发布时间】:2015-09-23 14:36:48
【问题描述】:

我需要将我从目标目录构建的 .war 文件复制到部署目录。我知道怎么用 Ant 做,但是在这个项目中使用 Maven,我不知道怎么做。

感谢您的回答!

【问题讨论】:

标签: file maven deployment ant copy


【解决方案1】:

在 War 插件配置中,您需要为插件提供一个输出目录。例如:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <version>2.3</version>
    <configuration>
        <warName>[the name you want for your war file]</warName>
        <outputDirectory>[the output directory you want the war in]       </outputDirectory>
    </configuration>
</plugin>

只需将括号和文字替换为您想要的内容

【讨论】:

    【解决方案2】:

    相信前面的回答放置,而不是将指定名称的WAR文件复制到指定目录。所以 WAR 文件不会出现在默认的 target/ 目录中。我尝试添加第二个块,希望 Maven 将文件放在两个目录中,这导致 Maven 忽略第一个。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-01-23
      • 1970-01-01
      • 1970-01-01
      • 2011-08-11
      • 1970-01-01
      • 2012-02-15
      • 2017-11-18
      相关资源
      最近更新 更多