【问题标题】:How to use maven-antrun-plugin for phase exec如何使用 maven-antrun-plugin 进行阶段执行
【发布时间】:2010-12-06 17:53:54
【问题描述】:

是否可以将 maven-antrun-plugin 用于执行阶段/目标。

目前我使用以下但不起作用:

  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-antrun-plugin</artifactId>
    <executions>
      <execution>
        <id>exec</id>
        <phase>exec</phase>
        <goals>
          <goal>run</goal>
        </goals>
        <configuration>
          <target
            name='Exec'
          >
            <exec
              executable='${env.COMSPEC}'
              osfamily='winnt'
            >
              <arg
                value='/c'
              ></arg>
              <arg
                value='src\\main\\scripts\\Exec.cmd'
              ></arg>
            </exec>
            <exec
              executable='src/main/scripts/Exec.command'
              osfamily='unix'
            ></exec>
          </target>
        </configuration>
      </execution>
    </executions>
  </plugin>

当然,如果有人知道如何绕过 Windows 上的 ${env.COMSPEC} hack,那也会受到欢迎。

【问题讨论】:

    标签: maven


    【解决方案1】:

    看起来该插件用于运行任意可执行文件,而不是ant task,理想情况下不应进行特定于操作系统的检查。

    也许你应该看看Exec Maven Plugin

    【讨论】:

    • 当然看的是exec-maven-plugin插件。 “for phase exec”是一个死的放弃;-) 顺便说一句:我不运行可执行文件,而是运行外部脚本文件。对于脚本,不仅脚本依赖于操作系统,而且调用本身以及 Windows 都不支持 shebang。为此,我正在远离 exec-maven-plugin。
    猜你喜欢
    • 1970-01-01
    • 2019-09-06
    • 2012-05-20
    • 1970-01-01
    • 2012-04-08
    • 1970-01-01
    • 2014-02-11
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多