多个maven插件运行阶段

问题描述:

我正在做一个maven smartbear soapui项目。我有依赖两个插件。 `多个maven插件运行阶段

<build> 
    <plugins> 
     <plugin> 
     <groupId>com.smartbear.soapui</groupId> 
     <artifactId>soapui-pro-maven-plugin</artifactId> 
     <version>5.1.2</version> 
     <executions> 
      <execution> 
      <id>pro</id> 
      <phase>test</phase> 
      <goals> 
       <goal>test</goal> 
      </goals> 
      <configuration> 
       <projectFile>${projectFile}</projectFile> 
       <outputFolder>${basedir}/target/surefire-reports</outputFolder> 
       <junitReport>true</junitReport> 
       <exportAll>true</exportAll> 
       <printReport>true</printReport> 
       <testFailIgnore>true</testFailIgnore> 
      </configuration> 
      </execution> 
     </executions> 
     <configuration> 
      <soapuiProperties> 
      <property> 
       <name>soapui.logroot</name> 
       <value>${project.build.directory}/surefire-reports/</value> 
      </property> 
      <property> 
       <name>soapui.https.protocols</name> 
       <value>TLSv1.2,SSLv3</value> 
      </property> 
      </soapuiProperties> 
     </configuration> 

     <dependencies> 
      <dependency> 
      <groupId>junit</groupId> 
      <artifactId>junit</artifactId> 
      <version>3.8.1</version> 
      </dependency> 
      <dependency> 
      <groupId>org.reflections</groupId> 
      <artifactId>reflections</artifactId> 
      <version>0.9.9-RC1</version> 
      </dependency> 
      <dependency> 
      <groupId>org.reflections</groupId> 
      <artifactId>reflections</artifactId> 
      <version>0.9.9-RC1</version> 
      </dependency> 
      <dependency> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-surefire-report-plugin</artifactId> 
      <version>2.19.1</version> 
      <type>maven-plugin</type> 
      </dependency> 
     </dependencies> 
     </plugin> 
     <plugin> 
     <groupId>com.github.redfish4ktc.soapui</groupId> 
     <artifactId>maven-soapui-extension-plugin</artifactId> 
     <version>4.6.4.2</version> 
     <executions> 
      <execution> 
      <id>redfish</id> 
      <phase>test</phase> 
      <configuration> 
       <testSuiteProperties> 
       <properties> 
        <property>PropertyCode=${propertyCode}</property> 
        <property>Environment=${environment}</property> 
        <Gateway>Gateway=${gateway}</Gateway> 
       </properties> 
       </testSuiteProperties> 
      </configuration> 
      </execution> 
     </executions> 
     </plugin> 
    </plugins> 
    </build>` 

我的测试需要有依赖插件redfish,因为它支持soapuiTestSuite属性配置。

现在,当我试图运行这个mvn install test时,构建开始运行第一个插件,并失败,因为它没有下载第二个插件,然后再次运行下载第二个插件但失败。在运行目标之前,我需要同时拥有插件和整个配置设置。

我是新来的Maven结构。

  1. 在第二个插件添加执行。
  2. 例如,如果你想的soapUI-PRO-Maven的插件之前执行的maven-soapUI的扩展,插件,你可以添加此执行:

    <executions> 
           <execution> 
            <id>soapui-tests</id> 
            <phase>verify</phase> 
            <goals> 
            <goal>test</goal> 
            </goals> 
          </execution> 
         </executions> 
    
  3. 而只是 'MVN安装',因为你有执行连接到默认的Maven生命周期。

看看默认的Maven生命周期的执行顺序列表:验证,初始化..部署(docs here)。

+0

我的项目取决于两个插件。根据你的陈述,只有一个插件会被正确执行? – ChanChow

+0

不,将每个插件附加到一个阶段以掌握这些插件的执行顺序 –