1

我正在使用soapUI maven 插件来创建一个多模块maven-soapUi 项目。我有几个子 maven 项目,每个项目都有自己的 project.xml 和 pom.xml 文件。当我单独运行每个子项目时,它工作正常。但是当我运行父项目时,它会在父根目录而不是子目录中查找 project.xml 文件,因此失败了,有没有解决方案?

子 POM

    <project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
   <modelVersion>4.0.0</modelVersion>

   <parent>
         <groupId>com.project</groupId>
         <artifactId>project-test</artifactId>
         <version>1.0-SNAPSHOT</version>
         <relativePath>../pom.xml</relativePath>
   </parent>

   <name>submodule SoapUI tests</name>
   <groupId>com.prject</groupId>
   <artifactId>project-submodule-test</artifactId>
   <version>1.0-SNAPSHOT</version>
   <packaging>jar</packaging>
   <description>Submodule SoapUI tests</description>    
   <pluginRepositories>   
        <pluginRepository>      
            <id>eviwarePluginRepository</id>      
            <url>http://www.eviware.com/repository/maven2/</url>   
        </pluginRepository>
   </pluginRepositories> 
   <build>
      <plugins> 
         <plugin>
            <groupId>eviware</groupId>
            <artifactId>maven-soapui-pro-plugin</artifactId>
            <version>4.5.0</version>
            <dependencies>
            <dependency>
                <groupId>com.microsoft.sqlserver</groupId>               
                <artifactId>sqljdbc4</artifactId>               
                <version>3.0</version>   
            </dependency>
          </dependencies>
        <executions>
               <execution>
                  <id>soapUI</id>
                  <goals>
                     <goal>test</goal> 
                  </goals>
                  <phase>test</phase>           
               </execution>
            </executions>                       
            <configuration>
               <projectFile>submodule.xml</projectFile>
               <outputFolder>Reports</outputFolder>
               <junitReport>true</junitReport>
               <printReport>false</printReport>
               <projectProperties/>
            </configuration>
         </plugin>   
      </plugins>
   </build>          
</project>

父 POM

    <?xml version="1.0" encoding="UTF-8"?>
    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

    <modelVersion>4.0.0</modelVersion>
    <groupId>com.project</groupId>
    <artifactId>project-test</artifactId>
    <packaging>pom</packaging>
    <version>1.0-SNAPSHOT</version>
    <name>SoapUI tests</name>

    <modules>
            <module>submodule</module>
    </modules>
</project>
4

1 回答 1

2

子 pom.xml 中的一个小改动解决了这个问题。

更改项目文件路径

<projectFile>submodule.xml</projectFile>

<projectFile>{basedir}/submodule.xml</projectFile>

如果有人来这里寻找类似的解决方案......

于 2012-06-18T11:48:00.200 回答