2016-07-21 77 views
-1

我在Eclipse的Maven項目中使用Cucumber來啓動SoapUI。pom.xml:無法識別的標記:'soapuiProperties'

當從Eclipse內運行時,我的POM.xml文件運行良好,測試完成且沒有錯誤。

然而,當我從 「MVN測試」 從命令行啓動我得到這個錯誤:

的pom.xml:無法識別的標籤: 'soapuiProperties'(位置:START_TAG看到... \ r \ n \ [R \ n ..

下面是pom.xml中

<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/xsd/maven-4.0.0.xsd"> 
    <modelVersion>4.0.0</modelVersion> 
    <groupId>Project_name</groupId> 
    <artifactId>Project_name</artifactId> 
    <version>0.0.1-SNAPSHOT</version> 
    <parent> 
     <groupId>com.smartbear</groupId> 
     <artifactId>ready-api</artifactId> 
     <version>1.7.0</version> 
    </parent> 
    <properties> 
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
     <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> 
    </properties> 
    <repositories> 
     <repository> 
      <id>SmartBearPluginRepository</id> 
      <url>http://www.soapui.org/repository/maven2/</url> 
     </repository> 
     <repository> 
      <id>maven2-repository.java.net</id> 
      <name>Java.net Repository for Maven</name> 
      <url>http://java.net/projects/maven-repository/</url> 
      <layout>default</layout> 
     </repository> 
    </repositories> 
    <!--Adding SoapUI Maven plugin--> 
    <pluginRepositories> 
     <pluginRepository> 
      <id>SmartBearPluginRepository</id> 
      <url>http://www.soapui.org/repository/maven2/</url> 
       <soapuiProperties> 
        <property> 
         <name>soapui.home</name> 
         <value>C:\Program Files\SmartBear\ReadyAPI\bin</value> 
        </property> 
       </soapuiProperties> 
     </pluginRepository> 
    </pluginRepositories>  

    <build> 
    <sourceDirectory>src</sourceDirectory>   
    <plugins> 
      <plugin> 
       <artifactId>maven-install-plugin</artifactId> 
       <version>2.3</version> 
       <configuration> 
        <createChecksum>true</createChecksum> 
        <updateReleaseInfo>true</updateReleaseInfo> 
        <tasks> 
         <copy file="pom.xml" 
           tofile="${project.build.directory}/ready-api-maven-plugin-${project.version}.pom"/> 
        </tasks> 
       </configuration> 
      </plugin>    
      <plugin> 
       <artifactId>maven-assembly-plugin</artifactId> 
       <executions> 
        <execution> 
         <phase>package</phase> 
         <goals> 
          <goal>single</goal> 
         </goals> 
        </execution> 
       </executions> 
       <configuration> 
        <outputDirectory>${assembly.build.directory}</outputDirectory> 
        <descriptors> 
         <descriptor>src/main/assembly/public-pom.xml</descriptor> 
        </descriptors> 
       </configuration> 
      </plugin> 
      <plugin> 
      <artifactId>maven-compiler-plugin</artifactId> 
      <version>3.5.1</version> 
      <configuration> 
       <source>1.8</source> 
       <target>1.8</target> 
      </configuration> 
     </plugin>   
    </plugins> 
    </build> 
    <dependencies> 
     <dependency> 
      <groupId>junit</groupId> 
      <artifactId>junit</artifactId> 
      <version>4.12</version> 
      <scope>test</scope> 
     </dependency> 
     <dependency> 
      <groupId>info.cukes</groupId> 
      <artifactId>cucumber-junit</artifactId> 
      <version>1.2.2</version> 
      <scope>test</scope> 
     </dependency> 
     <dependency> 
      <groupId>info.cukes</groupId> 
      <artifactId>cucumber-java</artifactId> 
      <version>1.2.2</version> 
      <scope>test</scope> 
     </dependency> 
     <dependency> 
      <groupId>com.smartbear.soapui</groupId> 
      <artifactId>soapui</artifactId> 
      <version>5.2.1</version> 
      <scope>compile</scope> 
      <!-- <executions> 
       <execution> 
        <phase>test 
        </phase> 
        <goals> 
         <goal>test 
         </goal> 
        </goals> 
        <configuration> 
         <projectFile>C:\\Users\\charles\\test-automation\\Soapui\\Project_name-REST-soapui-project.xml</projectFile> 
        </configuration> 
       </execution> 
      </executions> --> 
     </dependency> 
     <dependency> 
      <groupId>org.seleniumhq.selenium</groupId> 
      <artifactId>selenium-java</artifactId> 
      <version>2.53.1</version> 
     </dependency> 
    </dependencies> 
</project> 

任何想法,我需要怎麼解決POM?我試圖移動SoapUIproperties阻斷流入和流出的pluginrepsositories塊,但有水庫ult是一樣的。

+0

這是什麼'soapuiProperties'?它的用途是什麼? – Tunaki

+0

請根據官方文檔https://www.soapui.org/test-automation/maven/maven-2-x.html修復你的pom,或者解釋你想做什麼特別的事情!事實上,它根本沒有意義。 – SiKing

+0

我已經嘗試過soapui網站的各種POM文件,並且他們都沒有爲我工作,我已經在本地開發人員的幫助下開發了一個自定義POM。 –

回答

0

soapuiProperties不是pluginRepository元素的有效子元素。

pluginRepositories部分聲明maven將嘗試從中找到並下載插件。

它似乎沒有使用SoapUI插件,因此您可能會刪除pluginRepositories部分。

soapuiProperties的位置表明它未被測試使用,因此您可以刪除它。

0

錯誤

pom.xml: Unrecognised tag: 'soapuiProperties' (position: START_TAG seen ...\r\n \r\n ..

意味着你已經畸形的POM文件(pom.xml中)。換句話說,您已將soapuiProperties標籤放置在錯誤的地方。

您需要將soapuiProperties移動到build/plugins/plugin/configurationsoapui-maven-plugin。所以這裏是pom.xml應該如何正確的代碼片段:

<pluginRepositories> 
    <pluginRepository> 
     <id>smartbear-sweden-plugin-repository</id> 
     <url>http://www.soapui.org/repository/maven2/</url> 
    </pluginRepository> 
</pluginRepositories> 

<build> 
    <plugins> 
     <plugin> 
      <groupId>com.smartbear.soapui</groupId> 
      <artifactId>soapui-maven-plugin</artifactId> 
      <version>5.2.1</version> 
      <configuration> 
       <projectFile>soapui-tests.xml</projectFile>      
       <soapuiProperties> 
        <property> 
         <name>soapui.logroot</name> 
         <value>${project.build.directory}/soapui-logs/</value> 
        </property> 
       </soapuiProperties> 
      </configuration>     
     </plugin> 
    </plugins> 
相關問題