Properly binding maven exec plugin to test phase - maven

In a Maven project I use maven-exec-plugin to launch my Grunt tests. It goes like this:
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<phase>test</phase>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>cmd</executable>
<workingDirectory>${project.basedir}/src/main/webapp</workingDirectory>
<arguments>
<argument>/C</argument>
<argument>grunt --no-color test</argument>
</arguments>
</configuration>
</plugin>
</plugins>
</build>
With that I can run mvn test and my grunt test task will be executed: if the tests pass, the maven build pass and if the tests fail the maven build fail. When some tests fail I have the following output:
............................................. 1 failing
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.496s
[INFO] Finished at: ** ** ** **:**:** CEST ****
[INFO] Final Memory: *M/*M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (default) on project *****: Command execution failed. Process exited with an error: 6 (Exit value: 6) -> [Help 1]
I would like to know if it is possible to have the 'usual' maven output for failing tests. Something like: Build failure, there are failing tests.
Thanks

Not easily. The build failure message shows the exception thrown by the failing plugin; in exec-maven-plugin's case, that will only ever be the report of the exit code. It won't consider anything else in the command's behaviour.
If you were determined, you could rewrite or extend exec-maven-plugin, or perhaps write something similar in Groovy to throw an exception with a more specific message.
(A grunt-maven-plugin exists, but it also delegates to exec-maven-plugin.)

Related

Injecting a variable into pom.xml from Jenkinsfile

I am trying to configure SCM for my maven release plugin. However, the issue is: the pom.xml in my archetype, I dont want to hardcode a single scm variable but rather a parametrized version. In my jenkinsfile, we have a proprietary tool that fills the scm url, so I want to substitute that url into my pom.xml once I setup the project from my archetype. See code snippet below.
<developerConnection>scm:git:${myVariable}</developerConnection>
In my Jenkinsfile, I pull out this value like this (this works correctly):
node {
stage 'Checkout'
checkout scm
def myVariable= sh(returnStdout: true, script: 'git config remote.origin.url').trim()
So, to recap, I want to know how the value from Jenkins can get substituted into the pom.xml?
Right now, I am getting this error:
[INFO] fetch url: ${myVariable}
[INFO] push url: ${myVariable}
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.755 s
[INFO] Finished at: 2017-07-17T16:21:00+00:00
[INFO] Final Memory: 20M/784M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.5.3:prepare (default-cli) on project newSeedService: An error is occurred in the checkin process: Exception while executing SCM command. JGit checkin failure! ${myVariable}: not found. -> [Help 1]
Thank you
if you want to isolate these properties from the project POM, you can use properties file, you will have to use Properties Maven plugin, and run it's read-project-properties goal in the initialize phase of the Maven lifecycle. The example from the plugin page is reproduced here:
<project>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0-alpha-2</version>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>read-project-properties</goal>
</goals>
<configuration>
<files>
<file>etc/config/dev.properties</file>
</files>
</configuration>
</execution>
</executions>
</plugin>
</plugins>

Maven Invoker Plugin not detecting failed test

As part of a root parent pom project, several integration tests have been added to test it on sample projects.
The structure of the project folder is as following:
-root-maven-parent-project
|- src
| |-it
| |-sample-project-test1
| |-sample-project-test2
| |-sample-project-test3
| |-settings.xml
|- pom.xml
The main issue is: although the build of sample-project-test2 is wrongly failing (it should not), the build is SUCCESSFUL for the Invoker plugin and the overall build does not fail.
Here is the concerned maven-invoker-plugin configuration:
<profile>
<id>it-tests</id>
<build>
<plugins>
<!-- Integration tests configuration -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-invoker-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<streamLogs>true</streamLogs>
<goals>
<goal>clean</goal>
<goal>generate-sources</goal>
</goals>
<settingsFile>src/it/settings.xml</settingsFile>
<failIfNoProjects>true</failIfNoProjects>
</configuration>
<executions>
<execution>
<id>integration-test-release</id>
<goals>
<goal>install</goal>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
<configuration>
<cloneProjectsTo>${project.build.directory}/its/sample-project-test1</cloneProjectsTo>
<pom>src/it/sample-project-test1/pom.xml</pom>
<properties>
<scmBranch>release-something</scmBranch>
</properties>
</configuration>
</execution>
<execution>
<id>integration-test-hotfix</id>
<goals>
<goal>install</goal>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
<configuration>
<cloneProjectsTo>${project.build.directory}/its/sample-project-test2</cloneProjectsTo>
<pom>src/it/sample-project-test2/pom.xml</pom>
<properties>
<scmBranch>hotfix-something</scmBranch>
</properties>
</configuration>
</execution>
<execution>
<id>integration-test-master</id>
<goals>
<goal>install</goal>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
<configuration>
<cloneProjectsTo>${project.build.directory}/its/sample-project-test3</cloneProjectsTo>
<pom>src/it/sample-project-test3/pom.xml</pom>
<properties>
<scmBranch>master</scmBranch>
</properties>
</configuration>
</execution>
</plugin>
</plugins>
</build>
</profile>
As you can see, multiple executions are configured because each execution would need its own properties. Each execution is also pointing at its own integration test project and pom.
The build is clearly failing for a specific execution:
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] BUILD FAILURE
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] Total time: 2.337 s
[INFO] [INFO] Finished at: 2017-07-04T17:35:49+02:00
[INFO] [INFO] Final Memory: 12M/220M
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [ERROR] Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:1.4.1:enforce (enforce-snapshot-management) on project cmp-sample-project-test2: Some Enforcer rules have failed. Look above for specific messages explaining why the rule failed. -> [Help 1]
[INFO] [ERROR]
[INFO] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[INFO] [ERROR] Re-run Maven using the -X switch to enable full debug logging.
[INFO] [ERROR]
[INFO] [ERROR] For more information about the errors and possible solutions, please read the following articles:
[INFO] [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[INFO] pom.xml .......................................... FAILED (4.1 s)
[INFO] The build exited with code 1. See C:\data\git-repositories\root-maven-parent\target\its\sample-project-test2\build.log for details.
However, at the bottom of the build we see that the verify goal of the maven-invoker-plugin aggregated the results, flagged the concerned test as Passed and made the build SUCCESS:
[INFO]
[INFO] --- maven-invoker-plugin:3.0.0:verify (integration-test-release) # root-maven-parent ---
[INFO] -------------------------------------------------
[INFO] Build Summary:
[INFO] Passed: 1, Failed: 0, Errors: 0, Skipped: 0
[INFO] -------------------------------------------------
[INFO]
[INFO] --- maven-invoker-plugin:3.0.0:verify (integration-test-hotfix) # root-maven-parent ---
[INFO] -------------------------------------------------
[INFO] Build Summary:
[INFO] Passed: 1, Failed: 0, Errors: 0, Skipped: 0
[INFO] -------------------------------------------------
[INFO]
[INFO] --- maven-invoker-plugin:3.0.0:verify (integration-test-master) # root-maven-parent ---
[INFO] -------------------------------------------------
[INFO] Build Summary:
[INFO] Passed: 1, Failed: 0, Errors: 0, Skipped: 0
[INFO] -------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
Moreover, by only running the failing test from command line as:
mvn invoker:integration-test#integration-test-hotfix invoker:verify -Pit-tests
The sub-build of the test project fails, the output is correctly marked as Failed in the test summary, and the build is correctly ending with FAILURE.
Question: why when executing multiple integration tests using the maven-invoker-plugin, although a test is failed, it is marked as Passed in the test summary and the build does not fail, while running only the isolated test everything fails correctly?
Note: no invoker property file is used.
Issue solved with the following explanation, although I think something could be improved in the behavior of the plugin (see below).
The whole maven-invoker-plugin was reduced to the following configuration:
<profile>
<id>it-tests</id>
<build>
<plugins>
<!-- Integration tests configuration -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-invoker-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<streamLogs>true</streamLogs>
<goals>
<goal>clean</goal>
<goal>generate-sources</goal>
</goals>
<settingsFile>src/it/settings.xml</settingsFile>
<failIfNoProjects>true</failIfNoProjects>
<cloneProjectsTo>${project.build.directory}/its</cloneProjectsTo>
</configuration>
<executions>
<execution>
<id>integration-test-release</id>
<goals>
<goal>install</goal>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
Basically: only one plugin execution, instead of an execution per test, which indeed was verbose and non scalable, but forced by the need of having different values for the same property in each integration test. Apparently, this is not possible via pom configuration and only achievable - unless I am not mistaken - via a test.properties file.
Hence, as a complement to the configuration above, I added in each and every integration test project folder a test.properties file with the following content e.g.:
scmBranch=master
De facto replacing what in the pom.xml file was (as part of an execution of the maven-invoker-plugin:
<properties>
<scmBranch>master</scmBranch>
</properties>
This mechanism (single execution of the plugin + test properties file per test folder) fixed the issue, allowing the build to have multiple integration tests each with its own different value for the same property. Hopefully this solution may help troubleshooting similar issues.
Here is the final result from the build correctly aggregating tests and effectively respecting their sub-build output (while before the build was generating 6 Build Summary of Passed: 1 each time, although not correct).
[INFO] --- maven-invoker-plugin:3.0.0:verify (pom-integration-test) # root-maven-parent ---
[INFO] -------------------------------------------------
[INFO] Build Summary:
[INFO] Passed: 6, Failed: 0, Errors: 0, Skipped: 0
[INFO] -------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
However, some questions remain:
Without using the test.properties file, how to achieve the same via pom.xml configuration? Normally, it should only be an alternative, not a mandatory and only possible solution. That's why this is rather a uncomplete feature (a bug?) to me.
Having multiple execution of the plugin results in test summaries at the end of the build which correctly follow the executions order, the number of tests executed (always 1 per execution, in this case), but apparently do not reflect the effective result of each sub-build. Why? This is rather a bug or a misbehavior of the plugin due to an unexpected usage of it, perhaps.
use this configuration :-
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.0</version>
<configuration>
<rules>
<banDuplicateClasses>
<findAllDuplicates>true</findAllDuplicates>
</banDuplicateClasses>
</rules>
<fail>false</fail>
</configuration>
<dependencies>
<dependency>
<groupId>org.codehaus.mojo</groupId>
<artifactId>extra-enforcer-rules</artifactId>
<version>1.0-alpha-1</version>
</dependency>
</dependencies>
</plugin>
for more refer this link :
http://maven.apache.org/enforcer/maven-enforcer-plugin/

How to echo in Maven without Antrun plugin?

How can I print to the console while executing a mvn command (in a phase/goal), but not using Maven Antrun plugin?
Why I reject Antrun solutions:
The overhead in code to print a single message is massiv.
The output is no formated like maven output
I cannot attach a severity to the message (e.g. DEBUG, INFO, ERROR, etc)
Currently an Ant-echo looks like this (see line with "hello world"):
[INFO] --- maven-antrun-plugin:1.7:run (default) # ejpd-alertmanager-ear ---
[WARNING] Parameter tasks is deprecated, use target instead
[INFO] Executing tasks
main:
[echo] hello world
[INFO] Executed tasks
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
However, I expect it to look like this (see line with "hello world").
[INFO] --- maven-antrun-plugin:1.7:run (default) # ejpd-alertmanager-ear ---
[WARNING] Parameter tasks is deprecated, use target instead
[INFO] Executing tasks
[INFO] hello world
[INFO] Executed tasks
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
I'm positive, I am missing something here, since I cannot be the first to raise this demand. Thank you for any smart hint.
You should try the Maven Echo plugin:
<plugin>
<groupId>com.soebes.maven.plugins</groupId>
<artifactId>maven-echo-plugin</artifactId>
<version>0.1</version>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>echo</goal>
</goals>
</execution>
</executions>
<configuration>
<echos>
<echo>This is the Text which will be printed out.</echo>
</echos>
</configuration>
</plugin>
Or furthermore take a deeper look into the integration test of the plugin.
which is available via Maven Central. BTW: If you have further requests/improvements just file in an issue.
You can use Björn Ekryd's Echo Maven Plugin, which is published in Maven Central.
It has a normal amount of XML required for a Maven plugin, the output is formatted like the other Maven log lines, and you can assign a severity level to your message (default is INFO).
<plugin>
<groupId>com.github.ekryd.echo-maven-plugin</groupId>
<artifactId>echo-maven-plugin</artifactId>
<version>1.2.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>echo</goal>
</goals>
<configuration>
<message>war has changed</message>
<level>INFO</level>
</configuration>
</execution>
</executions>
</plugin>
[INFO] --- maven-war-plugin:2.4:war (default-war) # mymodule ---
[INFO] Packaging webapp
[INFO] Processing war project
[INFO]
[INFO] --- echo-maven-plugin:1.2.0:echo (default) # mymodule ---
[INFO] war has changed
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
Also, this plugin has 95% code coverage, which is pretty cool.
You can use Groovy Maven Plugin for this.
<plugin>
<groupId>org.codehaus.gmaven</groupId>
<artifactId>groovy-maven-plugin</artifactId>
<version>2.0</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<source>
log.info('Test message: {}', 'Hello, World!')
</source>
</configuration>
</execution>
</executions>
</plugin>
The configuration above will produce the following output:
[INFO] Test message: Hello, World!
I haven't tried this myself but there is a plugin here which may help:
http://code.google.com/p/maven-echo-plugin/

Jenkins + selenium tests with failsafe plugin

I have a Jenkins platform which calls maven to make unit tests (with surefire plugin) and integration tests (with failsafe plugin). When there is an error in the integration tests, Jenkins considers the build as successfull. Is this behavior normal? I'd prefer it considers the build as unstable. More generally, do you know how Jenkins read and interprets the result of the build to consider a build as successfull or unstable? I read somewhere on the net that the failsafe reports must be redirected to the surefire report path. I did id but the problem is still here.
pom.xml :
[...]
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.10</version>
<configuration>
<disableXmlReport>false</disableXmlReport>
</configuration>
<executions>
<execution>
<id>default-test</id>
<phase>test</phase>
<configuration>
<includes>
<include>**/tests/**</include>
</includes>
<excludes>
<exclude>**/testsIntegration/**</exclude>
</excludes>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.7.2</version>
<configuration>
<disableXmlReport>false</disableXmlReport>
<reportsDirectory>${basedir}/target/surefire-reports</reportsDirectory>
<includes>
<include>com/acelys/conventionsJuridiques/*.java</include>
<!-- ... inclure les tests Selenium -->
</includes>
</configuration>
<executions>
<execution>
<id>integration-test</id>
<phase>integration-test</phase>
<goals>
<goal>integration-test</goal>
</goals>
<configuration>
<includes>
<include>**/testsIntegration/**</include>
</includes>
<excludes>
<exclude>**/tests/**</exclude>
</excludes>
</configuration>
</execution>
</executions>
</plugin>
[...]
output of jenkins :
[...]
mojoStarted org.apache.maven.plugins:maven-failsafe-plugin:2.7.2(integration-test)
[INFO]
[INFO] --- maven-failsafe-plugin:2.7.2:integration-test (integration-test) # BaseContrats ---
[INFO] Failsafe report directory: C:\jenkins_home\workspace\Base Contrats EXT JS MAVEN\target\surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running com.acelys.conventionsJuridiques.testsIntegration.connexion.TestConnexion
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 23.971 sec <<< FAILURE!
Results :
Failed tests:
testHomePage(com.acelys.conventionsJuridiques.testsIntegration.connexion.TestConnexion)
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent!
mojoSucceeded org.apache.maven.plugins:maven-failsafe-plugin:2.7.2(integration-test)
mojoStarted org.apache.tomcat.maven:tomcat6-maven-plugin:2.1-SNAPSHOT(tomcat-shutdown)
[INFO]
[INFO] --- tomcat6-maven-plugin:2.1-SNAPSHOT:shutdown (tomcat-shutdown) # BaseContrats ---
25 févr. 2013 09:32:08 org.apache.coyote.http11.Http11Protocol destroy
INFO: Stopping Coyote HTTP/1.1 on http-8080
25 févr. 2013 09:32:08 org.apache.catalina.core.ApplicationContext log
INFO: Closing Spring root WebApplicationContext
25 févr. 2013 09:32:08 org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
mojoSucceeded org.apache.tomcat.maven:tomcat6-maven-plugin:2.1-SNAPSHOT(tomcat-shutdown)
projectSucceeded BaseContrats:BaseContrats:1.0-SNAPSHOT
sessionEnded
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2:07.408s
[INFO] Finished at: Mon Feb 25 09:32:08 CET 2013
[INFO] Final Memory: 13M/51M
[INFO] ------------------------------------------------------------------------
Projects to build: [MavenProject: BaseContrats:BaseContrats:1.0-SNAPSHOT # C:\jenkins_home\workspace\Base Contrats EXT JS MAVEN\pom.xml]
[JENKINS] Archiving C:\jenkins_home\workspace\Base Contrats EXT JS MAVEN\pom.xml to C:\jenkins_home\jobs\Base Contrats EXT JS MAVEN\modules\BaseContrats$BaseContrats\builds\2013-02-25_09-29-58\archive\BaseContrats\BaseContrats\1.0-SNAPSHOT\BaseContrats-1.0-SNAPSHOT.pom
[JENKINS] Archiving C:\jenkins_home\workspace\Base Contrats EXT JS MAVEN\target\ConventionsJuridiques.war to C:\jenkins_home\jobs\Base Contrats EXT JS MAVEN\modules\BaseContrats$BaseContrats\builds\2013-02-25_09-29-58\archive\BaseContrats\BaseContrats\1.0-SNAPSHOT\BaseContrats-1.0-SNAPSHOT.war
channel stopped
Finished: SUCCESS
According to the documentation:
failsafe:verify verifies that the integration tests of an application passed.
You need to add the goal to the maven-failsafe-plugin execution:
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
This will allow Jenkins to interpret the test results and mark the build as unstable.
You can see that maven finished with SUCCESS. This will have Jenkins also finish with success.
To mark build as unstable, you need a post build action that will analyse your test results and mark build as failed or unstable. I suggest you search for more details on Jenkins post build actions for processing the test results and marking build as needed.
Hope this helps.
Under the post build actions the Publish JUnit test result report changes the report XML's to search for.
The assumption is the standard surefire and failsafe plugin output directories are used.
changes to
You should add a step in your build : "publish Junit report"
You will have graph showing all your test result, but it will also set the correct build result if tests are failing.
As said by https://stackoverflow.com/users/709863/stephane-piette:
Add a post build action 'Publish Performance test result report'. This action is provided by the plugin named 'Performance plugin'. You probably do not have this plugin installed, which is why it does not exist in the list.
The goal "integration-test" of the failsafe plugin won't mark the build as error when tests fail.
You have to add the goal "verify" to run after "integration-test" in the plugin execution. This will look for errors or failures and mark the build as "error". Then Jenkins will see that Maven did not succeed.
You have to set the plugin's configuration so that the build fails upon failed test(s):
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
....
<configuration>
<testFailureIgnore>false</testFailureIgnore>
</configuration>
<executions>
....
</executions>
</plugin>

Error during Failsafe integration test does not cause failed Maven build

I have Failsafe running a Selenium integration test. If one of my assertions in the test does not pass and the test fails, then the Maven build will fail as expected. However, if the test errors, the build finishes unexpectedly as a success (output below)
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 14.075 sec <<< FAILURE!
Results :
Tests in error:
test(uk.co.ned24.ExpandedIT)
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7 minutes 40 seconds
[INFO] Finished at: Wed Jan 30 16:58:28 GMT 2013
[INFO] Final Memory: 78M/209M
[INFO] ------------------------------------------------------------------------
I'm not sure whether this is meant to happen or not and whether Selenium could cause unexpected behaviour? I've looked at the plugin doco and can't find any flags that can be set to make the build fail after a test error.
Ideally I'd like to make the build fail on test error, so would appreciate any advice! I've attached the Failsafe snipped from my POM in case that's of use.
thanks, Nick
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<executions>
<execution>
<id>integration-test</id>
<goals>
<goal>integration-test</goal>
</goals>
</execution>
<execution>
<id>verify</id>
<goals>
<goal>verify</goal>
</goals>
</execution>
</executions>
<configuration>
<systemPropertyVariables>
<configDir>${basedir}/local/integration-test</configDir>
</systemPropertyVariables>
</configuration>
</plugin>
You should call mvn verify instead of mvn integration-test.
Quoting the Failsafe Plugin page (emphasis mine):
The Failsafe Plugin is used during the integration-test and verify phases of the build lifecycle to execute the integration tests of an application. The Failsafe Plugin will not fail the build during the integration-test phase thus enabling the post-integration-test phase to execute.
NOTE: when running integration tests, you should invoke maven with the (shorter to type too)
mvn verify
rather than trying to invoke the integration-test phase directly, as otherwise the post-integration-test phase will not be executed.
You should set the version of the maven-failsafe-plugin. For example to 2.14.1.
And your integration test classes must have ending "IntegrationTest", for example:
CustomDaoIntegrationTest

Resources