多个maven插件运行阶段

时间:2017-10-16 18:35:17

标签: java maven plugins soapui ready-api

我正在做一个maven smartbear soapui项目。我有两个插件的依赖。 `

<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 个答案:

答案 0 :(得分:0)

  1. 在第二个插件中添加execute。
  2. 例如,如果你想在soapui-pro-maven-plugin之前执行maven-soapui-extension-plugin,你可以添加这个执行:

        <executions>
                  <execution>
                      <id>soapui-tests</id>
                      <phase>verify</phase>
                      <goals>
                       <goal>test</goal>
                      </goals>
              </execution>
            </executions>
    
  3. 只需执行安装&#39;,因为您已将执行附加到默认的Maven生命周期。

  4. 查看执行顺序中的默认Maven生命周期列表:validate,initialize,.. deploy(docs here)。