2014-07-21 51 views
0

嗨,我只是想實現一個簡單的任務,即使用maven運行一個簡單的測試SOAP UI項目。所以我的簡單項目在SOAP UI 5.0.0 IDE中運行時沒有任何問題。我的POM文件是:「無法加載sopaui項目文件」與maven

<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>com.smartbear.samples</groupId> 
    <artifactId>soapui-maven2-plugin</artifactId> 
    <packaging>jar</packaging> 
    <version>1.0-SNAPSHOT</version> 
    <name>Maven 2 SoapUI Sample</name> 
    <url>http://maven.apache.org</url> 
    <pluginRepositories> 
     <pluginRepository> 
      <id>SmartBearPluginRepository</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.0.0</version> 
       <dependencies> 
        <dependency> 
         <groupId>mysql</groupId> 
         <artifactId>mysql-connector-java</artifactId> 
         <version>5.1.6</version> 
        </dependency> 
       </dependencies>  
       <executions> 
        <execution> 
         <phase>test</phase> 
         <goals> 
          <goal>test</goal> 
         </goals> 
         <configuration> 
          <projectFile>${project.basedir}/Test-soapui-project</projectFile> 
         </configuration> 
        </execution> 
       </executions> 
      </plugin> 
     </plugins> 
    </build> 
</project> 

出於某種原因,該插件使用默認的項目文件名,甚至是id指定的事實配置/項目文件paramenter內。這是錯誤:

C:\Users\Carlos\maven-soapui>mvn com.smartbear.soapui:soapui-maven-plugin:5.0.0:test 
[INFO] Scanning for projects... 
[INFO] 
[INFO] ------------------------------------------------------------------------ 
[INFO] Building Maven 2 SoapUI Sample 1.0-SNAPSHOT 
[INFO] ------------------------------------------------------------------------ 
[INFO] 
[INFO] --- soapui-maven-plugin:5.0.0:test (default-cli) @ soapui-maven2-plugin --- 
SoapUI 5.0.0 Maven2 TestCase Runner 
17:13:13,910 WARN [SoapUI] Missing folder [C:\Users\Carlos\maven-soapui\ext] for external libraries 
17:13:14,061 INFO [DefaultSoapUICore] initialized soapui-settings from [C:\Users\Carlos\soapui-settings.xml] 
17:13:16,807 INFO [SoapUI] File [C:\Users\Carlos\maven-soapui\soapui-maven2-plugin-soapui-project.xml] does not exist, tryin 
g URL instead 
17:13:16,808 ERROR [SoapUI] An error occurred [no protocol: soapui-maven2-plugin-soapui-project.xml], see error log for detai 
ls 
java.net.MalformedURLException: no protocol: soapui-maven2-plugin-soapui-project.xml 
     at java.net.URL.<init>(URL.java:585) 
     at java.net.URL.<init>(URL.java:482) 
     at java.net.URL.<init>(URL.java:431) 
     at com.eviware.soapui.impl.wsdl.WsdlProject.<init>(WsdlProject.java:236) 
     at com.eviware.soapui.impl.wsdl.WsdlProjectFactory.createNew(WsdlProjectFactory.java:45) 
     at com.eviware.soapui.impl.wsdl.WsdlProjectFactory.createNew(WsdlProjectFactory.java:28) 
     at com.eviware.soapui.tools.SoapUITestCaseRunner.runRunner(SoapUITestCaseRunner.java:341) 
     at com.eviware.soapui.tools.AbstractSoapUIRunner.run(AbstractSoapUIRunner.java:162) 
     at com.eviware.soapui.maven2.TestMojo.execute(TestMojo.java:117) 
     at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:106) 
     at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208) 
     at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) 
     at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) 
     at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84) 
     at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59) 
     at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183) 
     at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161) 
     at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:318) 
     at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:153) 
     at org.apache.maven.cli.MavenCli.execute(MavenCli.java:555) 
     at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214) 
     at org.apache.maven.cli.MavenCli.main(MavenCli.java:158) 
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
     at java.lang.reflect.Method.invoke(Method.java:601) 
     at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290) 
     at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230) 
     at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:414) 
     at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:357) 
[ERROR] java.lang.Exception: Failed to load SoapUI project file [soapui-maven2-plugin-soapui-project.xml] 
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD FAILURE 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 3.920s 
[INFO] Finished at: Mon Jul 21 17:13:16 BOT 2014 
[INFO] Final Memory: 15M/244M 
[INFO] ------------------------------------------------------------------------ 
[ERROR] Failed to execute goal com.smartbear.soapui:soapui-maven-plugin:5.0.0:test (default-cli) on project soapui-maven2-plu 
gin: SoapUI Test(s) failed: SoapUI Test(s) failed: 
[ERROR] Failed to load SoapUI project file [soapui-maven2-plugin-soapui-project.xml] 
[ERROR] -> [Help 1] 
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. 
[ERROR] Re-run Maven using the -X switch to enable full debug logging. 
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles: 
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException 

任何人都可以指出我在哪裏,這可能是什麼?

回答

0

您可能有非Pro和一個簡單的項目文件,它以.xml結尾。所以,你需要有兩個在你的pom如下:

<artifactId>soapui-maven-plugin</artifactId> 
<projectFile>simple-test-soapui-project.xml</projectFile> 

或者你有一個臨簡單的項目,在這種情況下,你需要兩者的在你的pom如下:

<artifactId>soapui-pro-maven-plugin</artifactId> 
<projectFile>simple-test-soapui-project.xml</projectFile> 

或者你有一個專業的複合項目,該項目確實爲.xml 結束,在這種情況下,你都需要在你的pom如下:

<artifactId>soapui-pro-maven-plugin</artifactId> 
<projectFile>simple-test-soapui-project</projectFile> 

在你的榜樣,你是使用非Pro Maven插件,並使用複合項目(不以.xml結尾),這絕對是無效的!請參閱SoapUI docs中的其他信息。

+0

謝謝回覆!我有一個非Pro項目。項目文件在基本目錄下出現名爲Test-soapui.project.xml。我確實修改了POM: ' soapui-maven-plugin Test-soapui-project.xml' 仍給我同樣的錯誤。 – carlosgmercado

+0

你可以試試以前的版本嗎? – SiKing

+0

你的意思是插件的另一個版本?我確實看到4.6.1到4.6.4可用,任何特定的? T – carlosgmercado

0

您的項目文件需要擴展名爲.xml。請再試一次。我有類似的錯誤,發現文件路徑不正確。如果你真的想調查更多使用GitHUb源代碼可用。

+0

感謝您的反饋!我測試了使用項目名稱加上xml擴展名(projectname.xml)值,並沒有工作。你指的是哪個github源代碼? – carlosgmercado

+0

請使用此博文來查找詳細信息。 http://warunaperera.blogspot.com/2014/08/run-soapui-project-using-maven-plugin.html –

0

我面臨同樣的錯誤。但我可以運行一個mvn測試,它工作正常。

它就像project文件元素調用

>mvn com.smartbear.soapui:soapui-maven-plugin:5.0.0:test 

對我來說,當被忽略,它只是串接Maven項目的根文件夾與SOAPUI項目的名稱。

以下是日誌摘錄。你可以看到projectFile配置得很好。

[DEBUG] ----------------------------------------------------------------------- 
[DEBUG] Goal:   com.smartbear.soapui:soapui-maven-plugin:5.0.0:test (A) 
[DEBUG] Style:   Regular 
[DEBUG] Configuration: <?xml version="1.0" encoding="UTF-8"?> 

<configuration> 
    <domain>${soapui.domain}</domain> 
    <endpoint>${soapui.endpoint}</endpoint> 
    <exportAll>${soapui.exportAll}</exportAll> 
    <globalProperties>${soapui.globalProperties}</globalProperties> 
    <host>${soapui.host}</host> 
    <interactive>${soapui.interactive}</interactive> 
    <junitReport>true</junitReport> 
    <outputFolder>${soapui.outputFolder}</outputFolder> 
    <password>${soapui.password}</password> 
    <printReport>${soapui.printReport}</printReport> 
    <projectFile default-value="${project.artifactId}-soapui-project.xml">C:/workspace/StockQuote/resources/test/StockQuote-soapui-project.xml</projectFile> 
    <projectPassword>${soapui.project.password}</projectPassword> 
    <projectProperties>${soapui.projectProperties}</projectProperties> 
    <saveAfterRun>${}</saveAfterRun> 
    <settingsFile>${soapui.settingsFile}</settingsFile> 
    <settingsPassword>${soapui.settingsFile.password}</settingsPassword> 
    <skip>${soapui.skip}</skip> 
    <soapuiProperties>${soapuiProperties}</soapuiProperties> 
    <testCase>${soapui.testcase}</testCase> 
    <testFailIgnore>${soapui.testFailIgnore}</testFailIgnore> 
    <testSuite>${soapui.testsuite}</testSuite> 
    <username>${soapui.username}</username> 
    <wssPasswordType>${soapui.wssPasswordType}</wssPasswordType> 
</configuration> 

向下滾動日誌,我發現,最終還是使用默認值:

[DEBUG] Configuring mojo com.smartbear.soapui:soapui-maven-plugin:5.0.0:test from plugin realm ClassRealm[plugin>com.smartbear.soapui:soapui-maven-plugin:5.0.0, parent: [email protected]] 
[DEBUG] Configuring mojo 'com.smartbear.soapui:soapui-maven-plugin:5.0.0:test' with basic configurator --> 
[DEBUG] (f) globalProperties = [] 
[DEBUG] (f) projectFile = StockQuote-soapui-project.xml 
[DEBUG] (f) projectProperties = [] 
[DEBUG] (f) soapuiProperties = {} 
[DEBUG] -- end configuration -- 

我也試着設置不同的soapUI項目的名字,我也得到相同的結果:使用默認值

+0

「對我來說,它只是將Maven項目的根文件夾與Soapui項目名稱連接起來。」實際上它只是查看當前的工作目錄,而不是在項目的根目錄中。這是我的另一個問題... – Frans

0

我有類似的問題。如果你將projectFile標籤移動到依賴項關閉標籤之後和執行開始標籤之前,事情可能會出現。

3

我已經找到了此問題的兩種解決方法,一是基於插件的默認設置和一個自定義設置:

使用默認設置:

  1. 名字你用肥皂的UI項目文件在以下模式: [YOUR-NAME] -soapui-project.xml。使用[YOUR-NAME]作爲工件ID。
  2. ,在同一位置文件作爲pom.xml文件從pom.xml文件
  3. 刪除配置部分將下面的命令

    MVN COM

    <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>com.smartbear.samples</groupId> 
    <artifactId>[YOUR-NAME]</artifactId> 
    <packaging>jar</packaging> 
    <version>1.0-SNAPSHOT</version> 
    <name>Maven 2 SoapUI Sample</name> 
    <url>http://maven.apache.org</url> 
    <pluginRepositories> 
        <pluginRepository> 
         <id>SmartBearPluginRepository</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.0.0</version> 
          <dependencies> 
           <dependency> 
            <groupId>mysql</groupId> 
            <artifactId>mysql-connector-java</artifactId> 
            <version>5.1.6</version> 
           </dependency> 
          </dependencies>  
          <executions> 
           <execution> 
            <phase>test</phase> 
            <goals> 
             <goal>test</goal> 
            </goals>        
           </execution> 
          </executions> 
         </plugin> 
        </plugins> 
    </build> 
    

  4. 運行。 smartbear.soapui:soapui-maven-plugin:測試

從執行部

CUSTOM FILE NAME

  1. 移動配置插件部分。所以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>com.smartbear.samples</groupId> 
    <artifactId>[YOUR-NAME]</artifactId> 
    <packaging>jar</packaging> 
    <version>1.0-SNAPSHOT</version> 
    <name>Maven 2 SoapUI Sample</name> 
    <url>http://maven.apache.org</url> 
    <pluginRepositories> 
        <pluginRepository> 
         <id>SmartBearPluginRepository</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.0.0</version> 
          <configuration> 
           <projectFile>[PATH_TO_YOUR_FILE]</projectFile>   
          </configuration>  
          <dependencies> 
           <dependency> 
            <groupId>mysql</groupId> 
            <artifactId>mysql-connector-java</artifactId> 
            <version>5.1.6</version> 
           </dependency> 
          </dependencies>  
          <executions> 
           <execution> 
            <phase>test</phase> 
            <goals> 
             <goal>test</goal> 
            </goals>        
           </execution> 
          </executions> 
         </plugin> 
        </plugins> 
    </build> 
    

  2. 運行以下命令

    MVN com.smartbear.soapui:soapUI的,Maven的插件:測試

+0

將配置從執行中移出,直接作爲''元素的子元素爲我工作。儘管如此,SoapUI傢伙應該更好地記錄這一點。 – Frans

相關問題