如何添加Maven exec任务以在"MVN测试"上执行 [英] How can I add a Maven exec task to execute on `mvn test`

查看:111
本文介绍了如何添加Maven exec任务以在"MVN测试"上执行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的pom中有以下exec任务:

I have the following exec task in my pom:

<plugins>
  <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>exec-maven-plugin</artifactId>
    <version>1.1</version>
    <executions>
      <execution>
        <goals>
          <goal>exec</goal>
        </goals>
      </execution>
    </executions>
    <configuration>
      <executable>${project.basedir}/src/test/javascript/EnvJasmine/bin/run_all_tests.sh</executable>
    </configuration>
  </plugin>
</plugins>

我跑步时效果很好

mvn exec:exec

但是我也希望它在执行时运行

But I also want it to run when I execute

mvn test

有人可以在这里帮助我吗?

Can anyone help me here?

推荐答案

知道了!您将<phase>添加到执行中!

Got it! You add <phase> to the execution!

<plugins>
  <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>exec-maven-plugin</artifactId>
    <version>1.1</version>
    <executions>
      <execution>
        <id>Jasmine Tests</id>
        <phase>test</phase>
        <goals>
          <goal>exec</goal>
        </goals>
      </execution>
    </executions>
    <configuration>
      <executable>${project.basedir}/src/test/javascript/EnvJasmine/bin/run_all_tests.sh</executable>
    </configuration>
  </plugin>
</plugins>

哇!

这篇关于如何添加Maven exec任务以在"MVN测试"上执行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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