作为最后一步运行maven exec-maven-plugin [英] run maven exec-maven-plugin as last step

查看:99
本文介绍了作为最后一步运行maven exec-maven-plugin的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在"MVN测试"之后使用exec-maven-plugin执行命令行脚本.如何在pom.xml下进行设置?

I want to execute a command line script with exec-maven-plugin after "mvn test" How do I set this up under pom.xml?

推荐答案

您可以仅从项目网站获取示例,而必须在执行过程中添加一个阶段.我刚刚在下面用此pom进行了测试,效果很好.

You can just take the example from the project website and have to add a phase to the execution. I've just tested with this pom below and it works fine.

    <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>
  <groupId>com.stackoverflow</groupId>
  <artifactId>q5110133</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <build>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>exec-maven-plugin</artifactId>
        <version>1.2</version>
        <executions>
          <execution>
            <id>Test.bat</id>
            <phase>test</phase>
            <goals>
              <goal>exec</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <executable>c:\temp\test.bat</executable>
          <!-- optional -->
          <workingDirectory>C:\temp</workingDirectory>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>

这篇关于作为最后一步运行maven exec-maven-plugin的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆