Java 如何添加Maven exec任务以在“mvn测试”上执行`

Java 如何添加Maven exec任务以在“mvn测试”上执行`,java,testing,maven,exec,Java,Testing,Maven,Exec,我的pom中有以下exec任务: <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <version>1.1</version> <executions> <execution>

我的pom中有以下exec任务:

<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 test
有人能帮我吗?

明白了!您将
添加到执行中

<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>

org.codehaus.mojo
execmaven插件
1.1
茉莉花试验
测试
执行官
${project.basedir}/src/test/javascript/EnvJasmine/bin/run_all_tests.sh

呜呼

具体来说,要在
测试
阶段执行,您需要在
元素中添加一个
测试
绑定项。我已经开发了execmaven插件来运行外部命令。此命令运行用于集成测试的服务器。我的问题是maven被这个命令卡住了,所以我永远无法运行测试。我想知道你们中的一些人是否已经弄明白了。
<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>