2013-01-07 89 views
0

我有一个配置文件,我想在所有模块的安装阶段完成后执行。 说我有maven正在执行独立于阶段的配置文件

<modules> 
    <a> 
    <b> 
    <c> 
</modules> 

然后,我已经定义了一个轮廓id为generate-reports

<profile> 
    <id>generate-reports</id> 
    <build> 
     <plugins> 
      <plugin> 
       <groupId>org.codehaus.mojo</groupId> 
       <artifactId>exec-maven-plugin</artifactId> 
       <version>1.2.1</version> 
       <executions> 
        <execution> 
        <id>run-cmd</id> 
        <!--DO NOT BIND WITH PHASE--> 
        <phase>install</phase> 
        <goals> 
         <goal>exec</goal> 
        </goals> 
        </execution> 
       </executions> 
       <configuration> 
        <executable>executable-name</executable> 
        <arguments> 
        <argument>-o</argument> 
        <argument>output.txt</argument> 
        </arguments> 
       </configuration> 
      </plugin> 
     </plugins> 
    </build> 
</profile> 

此配置文件是一个报告生成配置文件,它将进入每个模块并在那里生成报告。但问题在于,如果我想在运行每个报告的测试用例后生成报告。安装时不应该为每个模块调用此配置文件。只有在完成安装后,它才会被调用。 换句话说,我正在寻找类似 mvn install generate-reports 甚至 'mvn generate-reports'(假设我已经单独运行了mvn install)。 在所有我不想绑定与阶段的配置文件,并希望运行独立于阶段的配置文件。

有没有什么插件来完成这个?

回答

1

您只需通过调用目标的名字开始的任何目标,如:

mvn help:effective-pom 

你的情况,这应该是:

mvn exec:exec 

并按照上述方法>here<你也可以这样做:

mvn clean install exec:exec 

这应该在调用您的报表插件之前完成一个完整的“安装”。