首页 > 解决方案 > Using SoapUI maven plugin with GitLab - dependencies could not be resolved

问题描述

I've been having some difficulties setting up my SoapUI test in Gitlab pipeline. At first I was successful getting them to run in principle. By now I've added my real tests into the project and got into some problems with JDBC steps. I have both Oracle and Postgres connections in my steps. Can some of you tell me what I'm doing wrong?

At first I was getting connection errors left and right. Then I realized I probably need to add dependencies. I added

              <dependency>
                <groupId>org.postgresql</groupId>
                <artifactId>postgresql</artifactId>
                <version>42.2.8</version>
              </dependency>

but nothing changed. I also added oracle driver but now I'm getting

[ERROR] Failed to execute goal com.smartbear.soapui:soapui-maven-plugin:5.5.0:test (default) on project dsa-otsusetugi-soapui-tests: Execution default of goal com.smartbear.soapui:soapui-maven-plugin:5.5.0:test failed: Plugin com.smartbear.soapui:soapui-maven-plugin:5.5.0 or one of its dependencies could not be resolved: Failed to collect dependencies at com.smartbear.soapui:soapui-maven-plugin:jar:5.5.0 -> com.oracle:ojdbc8:jar:12.2.0.1.0: Failed to read artifact descriptor for com.oracle:ojdbc8:jar:12.2.0.1.0: Could not transfer artifact com.oracle:ojdbc8:pom:12.2.0.1.0 from/to rmv_repo (http://repo.rmv/nexus/repository/maven-public/): Transfer failed for http://repo.rmv/nexus/repository/maven-public/com/oracle/ojdbc8/12.2.0.1.0/ojdbc8-12.2.0.1.0.pom: Unknown host repo.rmv: Name or service not known -> [Help 1]

What's interesting that I don't get any errors during the download phase.. https://pastebin.com/1HGXytJk

Currently my pom file containing dependencies looks like this:

<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>blaa.blaah</groupId>
<artifactId>blaa-blaah</artifactId>
<version>1.0-SNAPSHOT</version>
<name>BLAAHSoapUITests</name>

<properties>
    <maven.compiler.source>${java.version}</maven.compiler.source>
    <maven.compiler.target>${java.version}</maven.compiler.target>
    <maven.version>3.0.0</maven.version>
    <soapui.version>5.5.0</soapui.version>
    <surefire.version>2.20</surefire.version>
</properties>
<pluginRepositories>
    <pluginRepository>
        <id>SmartBearPluginRepository</id>
        <url>http://smartbearsoftware.com/repository/maven2/</url>
    </pluginRepository>
</pluginRepositories>
    <build>
    <plugins>
      <plugin>
         <groupId>org.codehaus.mojo</groupId>
         <artifactId>properties-maven-plugin</artifactId>
         <version>1.0.0</version>
         <executions>
           <execution>
             <phase>initialize</phase>
             <goals>
               <goal>read-project-properties</goal>
             </goals>
             <configuration>
               <files>
                 <file>${project.basedir}/test.properties</file>
               </files>
             </configuration>
           </execution>
         </executions>
      </plugin>
        <plugin>
            <groupId>com.smartbear.soapui</groupId>
            <artifactId>soapui-maven-plugin</artifactId>
            <version>${soapui.version}</version>
            <configuration>
              <soapuiProperties>
                    <property>
                    <name>soapui.logroot</name>
                    <value>${project.basedir}/build-testlog/build-testlog-</value>
                    </property>
              </soapuiProperties>
                <projectFile>${project.basedir}/${projectfile}</projectFile>
                <projectProperties>
                    <value>END_POINT=${END_POINT}</value>
                    <value>USER_ID=${USER_ID}</value>
                </projectProperties>
                <outputFolder>${project.basedir}/build-testlog</outputFolder>
                <printReport>true</printReport>
                <junitReport>true</junitReport>
            </configuration>
            <dependencies>
              <dependency>
                  <groupId>com.smartbear.soapui</groupId>
                  <artifactId>soapui</artifactId>
                  <version>${soapui.version}</version>
                  <exclusions>
                      <exclusion>
                          <groupId>javafx</groupId>
                          <artifactId>jfxrt</artifactId>
                      </exclusion>
                  </exclusions>
              </dependency>
              <dependency>
                  <groupId>com.oracle</groupId>
                  <artifactId>ojdbc8</artifactId>
                  <version>12.2.0.1.0</version>
              </dependency>
              <dependency>
                <groupId>org.postgresql</groupId>
                <artifactId>postgresql</artifactId>
                <version>42.2.8</version>
              </dependency>
              <dependency>
                 <groupId>com.jgoodies</groupId>
                 <artifactId>forms</artifactId>
                 <version>1.2.1</version>
             </dependency>
            </dependencies>
            <executions>
                <execution>
                    <phase>test</phase>
                    <goals>
                        <goal>test</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>
<reporting>
    <outputDirectory>${project.basedir}/build/reports/html</outputDirectory>
</reporting>

Am I doing something wrong? Am I using wrong dependencies?

Thanks in advance.

标签: oraclepostgresqlmavensoapui

解决方案


如果有人面临类似的情况,那么我的问题是,事实证明,Gitlab 运行程序没有访问 postgres 数据库的权限。它确实获得了驱动程序,但由于安全设置而无法连接。

无论如何,我仍然对 oracle 驱动程序有问题,因为它没有在 smartbear 存储库中公开。我所做的是在本教程的帮助下在本地添加了驱动程序:https ://gist.github.com/timmolderez/92bea7cc90201cd3273a07cf21d119eb

所以最后我的pom看起来像这样:

<pluginRepositories>
    <pluginRepository>
        <id>SmartBearPluginRepository</id>
        <url>https://rapi.tools.ops.smartbear.io/nexus/content/groups/public/</url>
    </pluginRepository>
    <pluginRepository>
        <id>in-project</id>
        <name>In Project Repo</name>
        <url>file://${project.basedir}/lib</url>
    </pluginRepository>
</pluginRepositories>

             <dependency>
                 <groupId>oracle</groupId>
                 <artifactId>ojdbc</artifactId>
                 <version>6.0</version>
             </dependency>

groupId、artifactId 和版本(当然还有文件夹名称和 jar、pom 文件)命名如教程所述。


推荐阅读