Forum Discussion

parxier's avatar
parxier
Occasional Contributor
15 years ago

How to add extra classpath entry to SoapUI plugin execution?

I'm running SoapUI plugin with Maven2 like this:

<plugin>
<groupId>eviware</groupId>
<artifactId>maven-soapui-plugin</artifactId>
<version>3.6.1</version>
<configuration>
<settingsFile>${basedir}/src/test/resources/soapui-settings.xml</settingsFile>
<projectFile>${basedir}/src/test/resources/sifWS-soapui-project.xml</projectFile>
<outputFolder>${project.build.directory}/soapui-output</outputFolder>
<printReport>true</printReport>
<junitReport>true</junitReport>
<exportAll>true</exportAll>
<soapuiProperties>
<property>
<name>soapui.logroot</name>
<value>${project.build.directory}/soapui-logs/</value>
</property>
</soapuiProperties>
</configuration>
</plugin>


It works perfectly and puts all soapui log files into ${project.build.directory}/soapui-logs/ with one exception: global-groovy.log which goes into basedir (seems to be bug in SoapUI log4j configuration).

I need an option to override soapui-log4j.xml file that comes with SoapUi maven plugin and fix GLOBAL_GROOVY_LOG appender from:

<param name="File" value="global-groovy.log"/>


to this:

<param name="File" value="${soapui.logroot}global-groovy.log"/>


In the past I ran SoapUI test programmatically from JUnit test and just placed updated soapui-log4j.xml file into src/test/resources/com/eviware/soapui/resources/conf/soapui-log4j.xml and it worked. Maven copies it into target/test-classes and adds that path to classpath to run unit tests.

Now the problem with SoapUI maven plugin is that I don't know how to add src/test/resources/com/eviware/soapui/resources/conf/soapui-log4j.xml to plugin's classpath. Is there anything similar to Surefire's additionalClasspathElements configuration option?

2 Replies

  • Hi,
    I have face the same problem. So 4 solutions :
    1 - use a repository between you and internet (nexus, artifactory...) with the patched soapui version. The free opensource version allow you to do that.
    2 - add a ant plugin task with maven that move this file to his desired location after the test soapui are done
    3 - use soapui-3.6.2-SNAPSHOT. This bug was already corrected :
     <appender name="GLOBAL_GROOVY_LOG" class="org.apache.log4j.FileAppender">
    <errorHandler class="org.apache.log4j.helpers.OnlyOnceErrorHandler"/>
    <param name="File" value="${soapui.logroot}global-groovy.log"/>

    4 - a) don't give a damn of the global-groovy.log. location. It will not add supervalue & consume too much time.(see : pareto method) Problem: it will not be erased in the clean phase.
    b) Solution: use the clean plugin to remove it during the clean phase.

    I'm using right now solution 4 a). Solution 3 introduce new bugs in others place (registering jdbcDriver, proxy not working...) I'm using 3.5.1 under windows and linux devian.


    Omar
  • parxier's avatar
    parxier
    Occasional Contributor
    Thanks, mlenosgrande.

    Another option would be adding dependencies element to soapUI maven plugin execution. From the POM reference:

    Additional dependencies that this project needs to introduce to the plugin's classloader.


    In this particular case I packed updated soapui-log4j.xml into soapUILog4jConfig.jar and uploaded it into my maven repo, then in pom I added:

    <plugin>
    <groupId>eviware</groupId>
    <artifactId>maven-soapui-plugin</artifactId>
    <version>3.6.1</version>
    <configuration>
    <settingsFile>${basedir}/src/test/resources/soapui-settings.xml</settingsFile>
    <projectFile>${basedir}/src/test/resources/sifWS-soapui-project.xml</projectFile>
    <outputFolder>${project.build.directory}/soapui-output</outputFolder>
    <printReport>true</printReport>
    <junitReport>true</junitReport>
    <exportAll>true</exportAll>
    <soapuiProperties>
    <property>
    <name>soapui.logroot</name>
    <value>${project.build.directory}/soapui-logs/</value>
    </property>
    </soapuiProperties>
    </configuration>
    <dependencies>
    <dependency>
    <groupId>com.company</groupId>
    <artifactId>soapUILog4jConfig</artifactId>
    <version>1.0-SNAPSHOT</version>
    </dependency>
    </dependencies>
    </plugin>


    Notice that new dependencies element added.

    Thanks to Magne from Stackoverflow.