All SoapUI test are not executing from Maven build - maven

I have created a soapui test cases for testing rest webservice. All the steps are executing fine from SoapUI. But when i integrate it with maven and do build, not all steps are executing.
I am using groovy script to assert response.
Also using property transfers
Maven plugin config is like below:
<plugin>
<groupId>com.smartbear.soapui</groupId>
<artifactId>soapui-pro-maven-plugin</artifactId>
<version>4.6.1</version>
<executions>
<execution>
<id>QClearanceTest</id>
<goals>
<goal>test</goal>
</goals>
<phase>test</phase>
</execution>
</executions>
<configuration>
<projectFile>soapui/soapui-project.xml</projectFile>
<outputFolder>${project.build.directory}/surefire-reports</outputFolder>
<junitReport>true</junitReport>
<printReport>true</printReport>
<projectProperties>
<projectProperty>NameInsured=Company</projectProperty>
</projectProperties>
<settingsFile>soapui\soapui-settings.xml</settingsFile>
</configuration>
</plugin>
Thanks in advance.

It worked after upgrading the plugin and adding a dependency:
<plugin>
<groupId>com.smartbear.soapui</groupId>
<artifactId>soapui-maven-plugin</artifactId>
<version>5.5.0</version>
<executions>
<execution>
<id>QClearanceTest</id>
<goals>
<goal>test</goal>
</goals>
<phase>test</phase>
</execution>
</executions>
<configuration>
<projectFile>soapui/soapui-project.xml</projectFile>
<outputFolder>${project.build.directory}/surefire-reports</outputFolder>
<junitReport>true</junitReport>
<printReport>true</printReport>
<projectProperties>
<projectProperty>NameInsured=Company</projectProperty>
</projectProperties>
<settingsFile>soapui\soapui-settings.xml</settingsFile>
</configuration>
<dependencies>
<dependency>
<groupId>com.jgoodies</groupId>
<artifactId>forms</artifactId>
<version>1.0.7</version>
</dependency>
</dependencies>
</plugin>
soapui-settings.xml
<con:soapui-settings xmlns:con="http://eviware.com/soapui/config">
<con:setting id="HttpSettings#socket_timeout">200000</con:setting>
</con:soapui-settings>

Related

Kotlin Querydsl: cannot find javax.annotation.proceesing.Generated

I am following this example https://felixzett.com/articles/minimal-maven-kotlin-querydsl-example/ to implement querydsl in a Springboot Kotlin Maven project. Using the pom mentioned, I managed to generate the q classes after running mvn compile and can run mvn clean install successfully as well, but when I try to run the project locally, I get error in all the q classes.
java: cannot find symbol
symbol: class Generated
location: package javax.annotation.processing
I tried adding javax.annotation-api to the <annotationProcessPaths> element but it didn't work.
<annotationProcessorPath>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>1.3.2</version>
</annotationProcessorPath>
I also tried adding it as a dependency, within that <plugin> element or in the main <dependencies> element, but these didn't work as well.
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>1.3.2</version>
</dependency>
May I know if anyone has any idea how to solve this?
Update:
I have both kotlin-maven-plugin and maven-compiler-plugin in my pom. I realise if I comment out the maven-compiler-plugin then the error is gone. But I am not sure if other parts of the app will be affected if it doesn't have this plugin.
Does anyone know if it is ok to just have the kotlin-maven-plugin, or how I should modify maven-compiler-plugin for the 2 plugins to work together?
<plugin>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId>
<version>${kotlin.version}</version>
<executions>
<execution>
<id>compile</id>
<phase>process-sources</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>kapt</id>
<phase>generate-sources</phase>
<goals>
<goal>kapt</goal>
</goals>
<configuration>
<sourceDirs>
<sourceDir>src/main/kotlin</sourceDir>
</sourceDirs>
<annotationProcessorPaths>
<annotationProcessorPath>
<groupId>com.querydsl</groupId>
<artifactId>querydsl-apt</artifactId>
<version>${querydsl.version}</version>
<classifier>jpa</classifier>
</annotationProcessorPath>
</annotationProcessorPaths>
</configuration>
</execution>
<execution>
<id>test-compile</id>
<phase>test-compile</phase>
<goals>
<goal>test-compile</goal>
</goals>
<configuration>
<sourceDirs>
<sourceDir>src/test/kotlin</sourceDir>
<sourceDir>target/generated-sources/kapt/test</sourceDir>
</sourceDirs>
</configuration>
</execution>
</executions>
<configuration>
<args>
<arg>-Xjsr305=strict</arg>
</args>
<compilerPlugins>
<plugin>spring</plugin>
<plugin>jpa</plugin>
<plugin>all-open</plugin>
</compilerPlugins>
<pluginOptions>
<option>all-open:annotation=javax.persistence.Entity</option>
<option>all-open:annotation=javax.persistence.MappedSuperclass</option>
<option>all-open:annotation=javax.persistence.Embeddable</option>
</pluginOptions>
<jvmTarget>1.8</jvmTarget>
</configuration>
<dependencies>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-allopen</artifactId>
<version>${kotlin.version}</version>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-noarg</artifactId>
<version>${kotlin.version}</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<groupId>org.apache.maven.plugins</groupId>
<version>3.5.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
<executions>
<execution>
<id>default-compile</id>
<phase>none</phase>
</execution>
<execution>
<id>default-testCompile</id>
<phase>none</phase>
</execution>
<execution>
<id>java-compile</id>
<phase>process-sources</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>java-test-compile</id>
<phase>test-compile</phase>
<goals>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
</plugin>
It seems like it is due to the Java version in the maven-compiler-plugin. After I changed it from 1.8 to 11, I do not get the error even if I have both kotlin-maven-plugin and maven-compiler-plugin.
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
Also change the java version to 11 in the <properties> element.
<properties>
<java.version>11</java.version>
</properties>

How to generate jacoco report in maven test phase

I am using Mockito and Power Mockito in my unit test cases. I am able to generate the jacoco report when I run the profile code-coverage but
I am getting error when I try to generate Jacoco report in the test phase
Error
[ERROR] Failed to execute goal org.jacoco:jacoco-maven-plugin:0.8.2:report (default-report) on project testproject-api: An error has occurred in JaCoCo report generation.: Error while creating report: Error while analyzing d:\workspace\api\target\classes\pkg\ResponseBuilder.class. Cannot process instrumented class pkg\ResponseBuilder.class. Please supply original non-instrumented classes. -> [Help 1]
Code
Please find the code below
<profiles>
<profile>
<id>code-coverage</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<dependencies>
<dependency>
<groupId>org.jacoco</groupId>
<artifactId>org.jacoco.agent</artifactId>
<classifier>runtime</classifier>
<version>${jacocoVersion}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacocoVersion}</version>
<executions>
<!-- Off line instrumentation is needed to compute coverage for Power Mock tests -->
<execution>
<id>default-instrument</id>
<goals>
<goal>instrument</goal>
</goals>
</execution>
<execution>
<id>default-restore-instrumented-classes</id>
<goals>
<goal>restore-instrumented-classes</goal>
</goals>
</execution>
<execution>
<id>default-report</id>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven.surefire.plugin.version}</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit47</artifactId>
<version>${maven.surefire.plugin.version}</version>
</dependency>
</dependencies>
<configuration>
<!-- Workaround to https://code.google.com/p/powermock/issues/detail?id=504 -->
<argLine>-XX:-UseSplitVerifier</argLine>
<systemPropertyVariables>
<jacoco-agent.destfile>target/jacoco.exec</jacoco-agent.destfile>
</systemPropertyVariables>
<reuseForks>false</reuseForks>
</configuration>
</plugin>
</plugins>
</build>
</profile>
The issue has been resolved now. I need to add test phase for default-restore-instrumented-classes goal. Please find the updated code
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven.surefire.plugin.version}</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit47</artifactId>
<version>${maven.surefire.plugin.version}</version>
</dependency>
</dependencies>
<configuration>
<!-- Workaround to https://code.google.com/p/powermock/issues/detail?id=504 -->
<argLine>-XX:-UseSplitVerifier</argLine>
<systemPropertyVariables>
<jacoco-agent.destfile>target/jacoco.exec</jacoco-agent.destfile>
</systemPropertyVariables>
<reuseForks>false</reuseForks>
</configuration>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacocoVersion}</version>
<executions>
<execution>
<id>coverage-initialize</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>default-instrument</id>
<goals>
<goal>instrument</goal>
</goals>
</execution>
<execution>
<id>default-restore-instrumented-classes</id>
<phase>test</phase>
<goals>
<goal>restore-instrumented-classes</goal>
</goals>
</execution>
<execution>
<id>coverage-report</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>

kapt is not working even manually in IntelliJ with Maven

https://github.com/mapstruct/mapstruct-examples/tree/master/mapstruct-kotlin
I run above kotlin mapstruct project with maven but it emits below error.
Exception in thread "main" java.lang.RuntimeException: java.lang.ClassNotFoundException: Cannot find implementation for org.mapstruct.example.kotlin.converter.PersonConverter
at org.mapstruct.factory.Mappers.getMapper(Mappers.java:61)
at org.mapstruct.example.kotlin.MainKt.main(Main.kt:10)
Caused by: java.lang.ClassNotFoundException: Cannot find implementation for org.mapstruct.example.kotlin.converter.PersonConverter
at org.mapstruct.factory.Mappers.getMapper(Mappers.java:75)
at org.mapstruct.factory.Mappers.getMapper(Mappers.java:58)
... 1 more
It seems annotation processor is not working even I enabled annotation processing in the Settings.
https://kotlinlang.org/docs/kapt.html#using-in-cli
The Official kotlin document says:
Please note that kapt is still not supported for IntelliJ IDEA’s own build system. Launch the build from the “Maven Projects” toolbar whenever you want to re-run the annotation processing.
(related issue: https://youtrack.jetbrains.com/issue/KT-15040)
So I tried to conduct kapt manually.
However the output folders are still empty.
What's wrong with me?
I was able to do annotation processing in Java with Maven before.
Thanks in advance.
I found the answer.
Just push compile button in Maven project or mvn compile in command
before running your application whenever you need the annotation processing.
This is an excerpt from my answer to similar question:
You can configure pom.xml build file like this:
<dependencies>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib</artifactId>
<version>1.7.20</version>
</dependency>
<dependency>
<groupId>com.google.dagger</groupId>
<artifactId>dagger</artifactId>
<version>2.22</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId>
<version>${kotlin.version}</version>
<executions>
<execution>
<id>kapt</id>
<goals>
<goal>kapt</goal>
</goals>
<configuration>
<sourceDirs>
<sourceDir>src/main/kotlin</sourceDir>
<sourceDir>src/main/java</sourceDir>
</sourceDirs>
<annotationProcessorPaths>
<!-- Specify your annotation processors here. -->
<annotationProcessorPath>
<groupId>com.google.dagger</groupId>
<artifactId>dagger-compiler</artifactId>
<version>2.22</version>
</annotationProcessorPath>
</annotationProcessorPaths>
</configuration>
</execution>
<execution>
<id>compile</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<sourceDirs>
<sourceDir>src/main/kotlin</sourceDir>
<sourceDir>src/main/java</sourceDir>
</sourceDirs>
</configuration>
</execution>
<execution>
<id>test-compile</id>
<phase>test-compile</phase>
<goals>
<goal>test-compile</goal>
</goals>
<configuration>
<sourceDirs>
<sourceDir>src/test/kotlin</sourceDir>
<sourceDir>src/test/java</sourceDir>
</sourceDirs>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>11</source>
<target>11</target>
</configuration>
<executions>
<execution>
<id>default-compile</id>
<phase>none</phase>
</execution>
<execution>
<id>default-testCompile</id>
<phase>none</phase>
</execution>
<execution>
<id>java-compile</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>java-test-compile</id>
<phase>test-compile</phase>
<goals>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
These are the links usefull to read when you want to create maven project with java, kotlin and dagger:
https://www.baeldung.com/kotlin/maven-java-project
https://kotlinlang.org/docs/kapt.html#using-in-maven
https://github.com/google/dagger#installation

Configuring Findbugs in Jenkins

My goal is to fail jenkins build for my project in case bugs are reported by FindBugs plugin. For that I have integrated FindBugs config in the project's pom.xml & the execution part of the config is below
<executions>
<execution>
<id>analyze-compile</id>
<phase>compile</phase>
<goals><goal>check</goal></goals>
<configuration>
<threshold>High</threshold>
</configuration>
</execution>
</executions>
I found the above config from online sources & with this config, the project is not failing incase of bugs reported by FindBugs. Also I have tried other configs like below
<xmlOutput>true</xmlOutput>
<configuration>
<failOnError>${findbugs.failOnError}</failOnError>
<threshold>High</threshold>
</configuration>
<executions>
<execution>
<id>noFailOnError</id>
<phase>verify</phase>
<goals>
<goal>check</goal>
</goals>
<configuration>
<failOnError>false</failOnError>
</configuration>
</execution>
<execution>
<id>failOnError</id>
<phase>install</phase>
<goals>
<goal>check</goal>
</goals>
<configuration>
<failOnError>true</failOnError>
</configuration>
</execution>
</executions>
Can someone please let me know what is the correct execution which needs to be used for failing build in case of bugs in FindBugs ?
Below is the correct configuration for find-bugs in pom.xml. It does the following - Perform FindBugs check, Generate xml report during verify phase , Transform it to html & Fail build in case bugs are present during check
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>2.4.0</version>
<executions>
<execution>
<id>findbug</id>
<phase>verify</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
<configuration>
<effort>Max</effort>
<threshold>Low</threshold>
<findbugsXmlOutputDirectory>
${project.build.directory}/findbugs
</findbugsXmlOutputDirectory>
<failOnError>false</failOnError>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>xml-maven-plugin</artifactId>
<version>1.0</version>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>transform</goal>
</goals>
</execution>
</executions>
<configuration>
<transformationSets>
<transformationSet>
<dir>${project.build.directory}/findbugs</dir>
<outputDir>${project.build.directory}/findbugs</outputDir>
<stylesheet>fancy-hist.xsl</stylesheet>
<!--<stylesheet>default.xsl</stylesheet> -->
<!--<stylesheet>plain.xsl</stylesheet> -->
<!--<stylesheet>fancy.xsl</stylesheet> -->
<!--<stylesheet>summary.xsl</stylesheet> -->
<fileMappers>
<fileMapper
implementation="org.codehaus.plexus.components.io.filemappers.FileExtensionMapper">
<targetExtension>.html</targetExtension>
</fileMapper>
</fileMappers>
</transformationSet>
</transformationSets>
</configuration>
<dependencies>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>findbugs</artifactId>
<version>2.0.0</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>3.0.3</version>
<executions>
<execution>
<id>failing-on-high</id>
<phase>install</phase>
<goals>
<goal>findbugs</goal>
<goal>check</goal>
</goals>
<configuration>
<effort>Max</effort>
<threshold>Low</threshold>
<failOnError>true</failOnError>
</configuration>
</execution>
</executions>
</plugin>

Install Maven itself from Maven Central

I have a maven plugin I would like to test against different Maven versions (Ex.: 2.2.1 & 3.0.4). Ideally I don't want users running the build to have to install these exact versions manually.
Is it possible to install specific versions of Maven itself from Maven Central or some other source that would then cache them in the local Maven repo for subsequent builds?
Maven distributions are stored in Maven Central Repository, as you can see here:
http://mvnrepository.com/artifact/org.apache.maven/apache-maven
https://repository.sonatype.org/index.html#nexus-search;gav~org.apache.maven~apache-maven~~~~kw,versionexpand
Therefore, it can be used as a normal dependency with following coordinates:
tar.gz variant:
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>apache-maven</artifactId>
<version>3.0.4</version>
<classifier>bin</classifier>
<type>tar.gz</type>
</dependency>
zip variant:
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>apache-maven</artifactId>
<version>3.0.4</version>
<classifier>bin</classifier>
<type>zip</type>
</dependency>
The rest is quite standard - you will probably use it in integration test poms, and call them with maven-invoker-plugin as recommended by #khmarbaise.
Why don't you simply just install a Continuous Integration (CI) server such as Jenkins / Hudson / TeamCity / etc? CI servers allow you to run your build against different versions of an SDK.
If your plugin is OSS (and on GitHub), I believe you can get free Jenkins hosting from Cloudbees.
Downloading Maven itself from Maven Central is not possible. You can only download it from their site.
You could do a thing like the following:
<profile>
<id>run-its</id>
<build>
<!-- Download the different Maven versions -->
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>wagon-maven-plugin</artifactId>
<version>1.0-beta-3</version>
<executions>
<execution>
<id>download-maven-2.0.11</id>
<phase>prepare-package</phase>
<goals>
<goal>download-single</goal>
</goals>
<configuration>
<url>http://archive.apache.org/dist/maven/binaries/</url>
<fromFile>apache-maven-2.0.11-bin.tar.gz</fromFile>
<toDir>${project.build.directory}/maven/download/</toDir>
</configuration>
</execution>
<execution>
<id>download-maven-2.2.1</id>
<phase>prepare-package</phase>
<goals>
<goal>download-single</goal>
</goals>
<configuration>
<url>http://archive.apache.org/dist/maven/binaries/</url>
<fromFile>apache-maven-2.2.1-bin.tar.gz</fromFile>
<toDir>${project.build.directory}/maven/download/</toDir>
</configuration>
</execution>
<execution>
<id>download-maven-3.0.3</id>
<phase>prepare-package</phase>
<goals>
<goal>download-single</goal>
</goals>
<configuration>
<url>http://archive.apache.org/dist/maven/binaries/</url>
<fromFile>apache-maven-3.0.3-bin.tar.gz</fromFile>
<toDir>${project.build.directory}/maven/download/</toDir>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>truezip-maven-plugin</artifactId>
<version>1.0-beta-4</version>
<executions>
<execution>
<id>extract-maven-2.0.11</id>
<goals>
<goal>copy</goal>
</goals>
<phase>prepare-package</phase>
<configuration>
<fileset>
<directory>${project.build.directory}/maven/download/apache-maven-2.0.11-bin.tar.gz</directory>
<outputDirectory>${project.build.directory}/maven/tools/</outputDirectory>
</fileset>
</configuration>
</execution>
<execution>
<id>extract-maven-2.2.1</id>
<goals>
<goal>copy</goal>
</goals>
<phase>prepare-package</phase>
<configuration>
<fileset>
<directory>${project.build.directory}/maven/download/apache-maven-2.2.1-bin.tar.gz</directory>
<outputDirectory>${project.build.directory}/maven/tools/</outputDirectory>
</fileset>
</configuration>
</execution>
<execution>
<id>extract-maven-3.0.3</id>
<goals>
<goal>copy</goal>
</goals>
<phase>prepare-package</phase>
<configuration>
<fileset>
<directory>${project.build.directory}/maven/download/apache-maven-3.0.3-bin.tar.gz</directory>
<outputDirectory>${project.build.directory}/maven/tools/</outputDirectory>
</fileset>
</configuration>
</execution>
</executions>
</plugin>
<!--
This is currently needed due to a bug of the truezip-plugin cause it unpacks without permission!
see http://jira.codehaus.org/browse/MOJO-1796
-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>chmod-files</id>
<phase>package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<chmod file="${project.build.directory}/maven/tools/apache-maven-2.0.11/bin/mvn" perm="+x"/>
<chmod file="${project.build.directory}/maven/tools/apache-maven-2.2.1/bin/mvn" perm="+x"/>
<chmod file="${project.build.directory}/maven/tools/apache-maven-3.0.3/bin/mvn" perm="+x"/>
</target>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-invoker-plugin</artifactId>
<version>1.5</version>
<dependencies>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy</artifactId>
<version>1.8.4</version>
</dependency>
</dependencies>
<configuration>
<debug>false</debug>
<!-- src/it-ip as for integration tests invoker plugin for the time of transition to maven-invoker-plugin -->
<projectsDirectory>src/it</projectsDirectory>
<showVersion>true</showVersion>
<pomIncludes>
<pomInclude>*/pom.xml</pomInclude>
</pomIncludes>
<preBuildHookScript>setup</preBuildHookScript>
<postBuildHookScript>verify</postBuildHookScript>
<settingsFile>src/it/settings.xml</settingsFile>
</configuration>
<executions>
<execution>
<id>integration-test-maven-2.0.11</id>
<goals>
<goal>install</goal>
<goal>run</goal>
</goals>
<configuration>
<reportsDirectory>${project.build.directory}/invoker-reports-2.0.11</reportsDirectory>
<localRepositoryPath>${project.build.directory}/local-repo-2.0.11</localRepositoryPath>
<cloneProjectsTo>${project.build.directory}/it-2.0.11</cloneProjectsTo>
<mavenHome>${project.build.directory}/maven/tools/apache-maven-2.0.11</mavenHome>
<goals>
<goal>clean</goal>
<goal>test</goal>
</goals>
</configuration>
</execution>
<execution>
<id>integration-test-maven-2.2.1</id>
<goals>
<goal>install</goal>
<goal>run</goal>
</goals>
<configuration>
<reportsDirectory>${project.build.directory}/invoker-reports-2.2.1</reportsDirectory>
<localRepositoryPath>${project.build.directory}/local-repo-2.2.1</localRepositoryPath>
<cloneProjectsTo>${project.build.directory}/it-2.2.1</cloneProjectsTo>
<mavenHome>${project.build.directory}/maven/tools/apache-maven-2.2.1</mavenHome>
<goals>
<goal>clean</goal>
<goal>test</goal>
</goals>
</configuration>
</execution>
<execution>
<id>integration-test-maven-3.0.3</id>
<goals>
<goal>install</goal>
<goal>run</goal>
</goals>
<configuration>
<reportsDirectory>${project.build.directory}/invoker-reports-3.0.3</reportsDirectory>
<localRepositoryPath>${project.build.directory}/local-repo-3.0.3</localRepositoryPath>
<cloneProjectsTo>${project.build.directory}/it-3.0.3</cloneProjectsTo>
<mavenHome>${project.build.directory}/maven/tools/apache-maven-3.0.3</mavenHome>
<goals>
<goal>clean</goal>
<goal>test</goal>
</goals>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
This will download the different Maven version unpack the .tar.gz archives and make mvn executable and use maven-invoker-plugin to run all integration test with these different maven versions.
BUT i can't recommend that. The better way is to use a CI solution (as already mentioned) which contains the different installations of Maven. Than you can run the integration tests for each Maven version separately.

Resources