您好我只想尝试使用maven运行一个简单的测试SOAP UI项目的简单任务。因此,我的简单项目在SOAP UI 5.0.0 IDE中运行时没有任何问题。我的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/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的事实。这是错误:
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 :(得分:3)
我找到了两个针对此问题的解决方案,一个基于插件默认设置,另一个基于自定义设置:
使用默认设置:
从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>
<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>
运行以下命令
mvn com.smartbear.soapui:soapui-maven-plugin:test
CUSTOM FILE NAME
将配置从执行部分移至插件部分。所以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>
运行以下命令
mvn com.smartbear.soapui:soapui-maven-plugin:test
答案 1 :(得分:0)
你有非Pro和一个简单的项目文件,以.xml结尾。所以你需要在你的pom中拥有以下两个:
<artifactId>soapui-maven-plugin</artifactId>
<projectFile>simple-test-soapui-project.xml</projectFile>
或者你有一个Pro简单的项目,在这种情况下你需要在你的pom中使用以下两个:
<artifactId>soapui-pro-maven-plugin</artifactId>
<projectFile>simple-test-soapui-project.xml</projectFile>
或者你有一个Pro复合项目,它以不结束.xml,在这种情况下你需要在你的pom中同时使用以下两个:
<artifactId>soapui-pro-maven-plugin</artifactId>
<projectFile>simple-test-soapui-project</projectFile>
在您的示例中,您使用的是非Pro Maven插件,并使用复合项目(不以.xml结尾),这绝对无效!请参阅SoapUI docs中的其他信息。
答案 2 :(得分:0)
您的项目文件需要具有.xml扩展名。请再试一次。我有类似的错误,发现文件路径不正确。如果你真的想调查更多,请使用GitHUb源代码。
答案 3 :(得分:0)
我面临同样的错误。但我可以运行mvn测试,它运行正常。
就像调用
时忽略projectFile元素一样>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: sun.misc.Launcher$AppClassLoader@107077e]
[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项目名称,我得到相同的结果:使用默认值
答案 4 :(得分:0)
我有类似的问题。如果将projectFile标记移动到依赖关闭标记之后和执行开始标记之前,事情可能会正确。