Update jenkins selenium plugin to version 3.0.1 - maven

I want to update jenkins selenium plugin (latest version: 2.53.1).
I can configure selenium hub and nodes outside of jenkins and run my automated tests with latest browser versions (firefox 51.0.1, chrome 55.0.2883.87) successfully but I just want to use jenkins as hub.
So that's why I'm trying to integrate the newest version of the selenium-server-standalone (3.0.1) into Jenkins but it's not working.
Getting this error messages:
[WARNING] The POM for org.jenkins-ci.tools:maven-hpi-plugin:jar:1.117 is missing, no dependency information available
[WARNING] Failed to build parent project for org.jenkins-ci.plugins:selenium:hpi:2.53.2-SNAPSHOT
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO]Building Jenkins Selenium Plugin 2.53.2-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-hpi-plugin:1.117:validate (default-validate) # selenium ---
[INFO]
[INFO] --- maven-enforcer-plugin:1.3.1:display-info (display-info) # selenium ---
[INFO] Maven Version: 3.3.9
[INFO] JDK Version: 1.8.0_121 normalized as: 1.8.0-121
[INFO] OS Info: Arch: amd64 Family: unix Name: linux Version: 4.4.0-62-generic
[INFO]
[INFO] --- maven-enforcer-plugin:1.3.1:enforce (display-info) # selenium ---
[INFO] Restricted to JDK 1.7 yet org.seleniumhq.selenium:selenium-server-standalone:jar:3.0.1:compile contains org/openqa/selenium/chrome/ChromeDriver.class targeted to JDK 1.8
[WARNING] Rule 2: org.apache.maven.plugins.enforcer.EnforceBytecodeVersion failed with message:
Found Banned Dependency: org.seleniumhq.selenium:selenium-server-standalone:jar:3.0.1
Use 'mvn dependency:tree' to locate the source of the banned dependencies.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 11.325 s
[INFO] Finished at: 2017-02-15T16:42:25+01:00
[INFO] Final Memory: 62M/1133M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:1.3.1:enforce (display-info) on project selenium: Some Enforcer rules have failed. Look above for specific messages explaining why the rule failed. -> [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/MojoExecutionException
pom.xml of maven project:
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>fake</groupId>
<artifactId>fake</artifactId>
<packaging>pom</packaging>
<version>${selenium.version}</version>
<name>fake</name>
<properties>
<selenium.short.version>3.0</selenium.short.version>
<selenium.version>${selenium.short.version}.1</selenium.version>
<htmlunit.driver.version>2.20</htmlunit.driver.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<phase>install</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<get
src="http://selenium-release.storage.googleapis.com/${selenium.short.version}/selenium-server-standalone-${selenium.version}.jar"
dest="${project.build.directory}/selenium-server-standalone-${selenium.version}.jar"
verbose="on" usetimestamp="true" />
<get
src="https://github.com/SeleniumHQ/htmlunit-driver/releases/download/${htmlunit.driver.version}/htmlunit-driver-standalone-${htmlunit.driver.version}.jar"
dest="${project.build.directory}/htmlunit-driver-standalone-${htmlunit.driver.version}.jar"
verbose="on" usetimestamp="true" />
</target>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.1</version>
<executions>
<execution>
<id>selenium-server-standalone</id>
<phase>install</phase>
<goals>
<goal>install-file</goal>
</goals>
<configuration>
<file>${project.build.directory}/selenium-server-standalone-${selenium.version}.jar</file>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-server-standalone</artifactId>
<version>${selenium.version}</version>
<packaging>jar</packaging>
<localRepositoryPath>local_m2</localRepositoryPath>
</configuration>
</execution>
<execution>
<id>htmlunit-driver-standalone</id>
<phase>install</phase>
<goals>
<goal>install-file</goal>
</goals>
<configuration>
<file>${project.build.directory}/htmlunit-driver-standalone-${htmlunit.driver.version}.jar</file>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>htmlunit-driver-standalone</artifactId>
<version>${htmlunit.driver.version}</version>
<packaging>jar</packaging>
<localRepositoryPath>local_m2</localRepositoryPath>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Code : https://github.com/jenkinsci/selenium-plugin
OS: Ubuntu 16.04.2; Eclipse Neon Java IDE ,openjdk version "1.8.0_121"
I've already tried it out with openjdk 1.7 as well but it's still not working.
I'm quite a newbie at this so I appreciate any help. Thanks a lot.

The root cause is simple : The Jenkins plugin's parent pom enforces by default to JDK7. Selenium libraries have moved on to using JDK8. That explains the error message arising from the enforcer plugin.
Here's how the enforcer plugin has been configured in the parent pom
<java.level>7</java.level>
<enforceBytecodeVersion>
<maxJdkVersion>1.${java.level}</maxJdkVersion>
<ignoredScopes>
<ignoredScope>test</ignoredScope>
</ignoredScopes>
<excludes>
<!-- Makes no sense to check core itself: -->
<exclude>org.jenkins-ci.main:jenkins-core</exclude>
<exclude>org.jenkins-ci.main:cli</exclude>
<exclude>org.jenkins-ci.main:jenkins-test-harness</exclude>
<!-- findbugs dep managed to provided and optional so is not shipped and missing annotations ok -->
<exclude>com.google.code.findbugs:annotations</exclude>
</excludes>
</enforceBytecodeVersion>
To fix this, you have two options [ I have never tried this, but its something that you can try and see if it helps ] (Both these options I am suggesting based on the recommendations from your parent pom itself )
Try passing the JVM argument -Djava.level=8 when you build the code.
Add an entry such as below to your pom file (This will cause enforcer plugin to perhaps ignore only the selenium libraries)
maven-enforcer-plugin
display-info
org.seleniumhq.selenium:selenium-java::jar:compile
org.seleniumhq.selenium:selenium-server::jar:compile
Hope that helps!
update
I spent more time looking at this and realised that moving over to selenium 3.0.1 for this plug-in was not very straight forward. I have tried doing the changes and raised a pull request for the same. You can take a look at the PR and see if that helps.
PS : I still have 3 tests failing in the PR. I haven't figured out how to get them to pass. But the PR should help you get started. You can directly checkout my branch and try building from there.

Related

The parameters 'url' for goal org.apache.maven.plugins:maven-deploy-plugin:3.0.0-M1:deploy-file are missing or invalid

I'm using the maven-deploy-plugin to deploy into Nexus an artifact generated by a task of maven-antrun-plugin at the end of my build.
The Ant task simply creates a file .sh of the assembled archive built by Maven.
I had to include maven-deploy-plugin because otherwise the .sh is not uploaded into Nexus and it's completely ignored by the lifecycle of the build.
This is the plugin configuration I've tried:
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>3.0.0-M1</version>
<configuration>
<skip>false</skip>
</configuration>
<executions>
<execution>
<id>deploy-sh</id>
<phase>deploy</phase>
<goals>
<goal>deploy-file</goal>
</goals>
<configuration>
<skip>false</skip>
<file>${project.build.directory}/${project.artifactId}-${project.version}-autoinstaller.sh</file>
<repositoryId>myrepo</repositoryId>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
<version>${project.version}</version>
</configuration>
</execution>
</executions>
</plugin>
I run the Maven build with mvn clean deploy goals, but it fails with the following error:
[INFO] --- maven-deploy-plugin:3.0.0-M1:deploy-file (deploy-sh) # MyApplication ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 04:11 min
[INFO] Finished at: 2020-05-01T19:07:40+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:3.0.0-M1:deploy-file (deploy-sh) on project MyApplication: The parameters 'url' for goal org.apache.maven.plugins:maven-deploy-plugin:3.0.0-M1:deploy-file are missing or invalid -> [Help 1]
The parameters 'url' for goal org.apache.maven.plugins:maven-deploy-plugin:3.0.0-M1:deploy-file are missing or invalid
Yes, this occurs because there's not the <url> tag in the section, so it's a mandatory parameter.
But why the <distributionManagement> is completely ignored? I also have a distributionManagement configured for myrepo repository, so urls are configured there.
What I have to do to make it work within the distributionManagement for snapshots and releases?
Following this answer, I found the following solution:
I have removed completely the maven-deploy-plugin
I have added <attachartifact> ant task in the maven-antrun-plugin
In this way, the file produced by the Ant run plugin is correctly deployed to Nexus, as described here:
AttachArtifact Task
This task will attatch an artifact to the current Maven project. This is can be used to install and deploy an artifact generated by the Ant tasks.

Adding external jar to project using maven-shading

My goal is to add an external jar into my Maven-project. Running the project invokes an NoClassDefFoundError. So I did a little research to found out that possibly the external jar is not included in my created jar file.
Therefor I found the solution to use maven-shade-plugin, but I'm stuck a little because the project will not compile.
I've got the following 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>this.isa.test</groupId>
<artifactId>test</artifactId>
<version>0.0.1</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.12.2-R0.1-SNAPSHOT</version><!--change this value depending on the version or use LATEST-->
<type>jar</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.12.2-R0.1-SNAPSHOT</version><!--change this value depending on the version-->
<type>jar</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.0</version>
<type>maven-plugin</type>
</dependency>
</dependencies>
</project>
Note that maven-shade-plugin is referenced as a dependency and included as an plugin for the build. I'm compiling the project through the Eclipse IDE with the preinstalled maven integration like the following mvn-install.
The following Error messages will be given in the Console:
[INFO] --------------------------------[ jar ]---------------------------------
[WARNING] The POM for org.apache.maven.plugins:maven-shade-plugin:jar:3.2 is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.195 s
[INFO] Finished at: 2018-09-30T09:48:43+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Plugin org.apache.maven.plugins:maven-shade-plugin:3.2 or one of its dependencies could not be resolved: Failure to find org.apache.maven.plugins:maven-shade-plugin:jar:3.2 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [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/PluginResolutionException
To be honest, I'm a little overchallenged because it's my first attempt to use Maven. There are plenty of questions and answers here and all over the internet, but nothing seems to fit my situation.
I am not using Eclipse, but instead invoking maven from commandline - and for making the thing work, I would recommend the same to you.
Once you have maven build working, you can try the next challenge with Eclipse, which should not be hard anyway.
Your pom needs following fixes:
remove the shade plugin from dependencies; dependencies should contain only artifacts that are needed for javac to compile the project, in your case also artifacts needed in runtime, but never (with very few exceptions) maven tooling artifacts
fix the shade plugin version to 3.2.0 (you have it correctly in your dependency, but not in plugin declaration)
Then try mvn clean install on commandline (make sure you are in the same directory where your pom file exists) and it should work - at least it did for me.

How can I launch "bower install" then "spring-boot:run" using Maven?

I'm a studdent and I does not understand something with Maven in my project.
I use spring-boot and angular 1 within the same repository and I need a solution to first execute a "bower install" before using the maven pluggin "spring-boot:run".
I'd to know if it's possible to customize the maven command.
I use IntelliJ and all I do is pressing the start button in my main class
package fr.studionline;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
#SpringBootApplication
#EnableAutoConfiguration
public class StudionlineBackApplication {
public static void main(String[] args) {
SpringApplication.run(StudionlineBackApplication.class, args);
}
}
The bower_components directory is in another directory than the main class as described in the picture below :
tree view of my project
Thanks in advance if you can help me understand how it work.
I will respond to any questions if there is something missing in my question.
UPDATE:
I did try the front-end-maven pluggin with this pom configuration :
<build>
<resources>
<resource>
<directory>src/resources</directory>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<!-- Use the latest released version:
https://repo1.maven.org/maven2/com/github/eirslett/frontend-maven-plugin/ -->
<version>1.4</version>
<executions>
<execution>
<id>bower install</id>
<goals>
<goal>bower</goal>
</goals>
<configuration>
<arguments>install</arguments>
</configuration>
</execution>
</executions>
<configuration>
<workingDirectory>src/main/resources/static</workingDirectory>
</configuration>
</plugin>
</plugins>
</build>
and this was what happend when I execute the command frontend:bower
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building studionline-back 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- frontend-maven-plugin:1.4:bower (default-cli) # studionline-back ---
[INFO] Running 'bower install' in C:\Antoine\Ecole\Projet\ProjetAnu_5A\studionline-back\src\main\resources\static
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.071 s
[INFO] Finished at: 2017-07-06T17:59:58+02:00
[INFO] Final Memory: 11M/155M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.github.eirslett:frontend-maven-
plugin:1.4:bower
(default-cli) on project studionline-back: Failed to run task: 'bower install' failed.
java.io.IOException:
Cannot run program "C:\Antoine\Ecole\Projet\ProjetAnu_5A\studionline-back\src\main\resources\static\node\node.exe"
(in directory "C:\Antoine\Ecole\Projet\ProjetAnu_5A\studionline-back\src\main\resources\static"):
CreateProcess error=2, Le fichier spécifié est introuvable -> [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
Process finished with exit code 1
But I still doesn't understand how to launch it with Intellij. Should I do mvn run instead of clicking on the "Run" button ?
Have a look at the frontend-maven-plugin. In particular it has a bower runner.
<execution>
<id>bower install</id>
<goals>
<goal>bower</goal>
</goals>
<configuration>
<!-- optional: The default argument is actually
"install", so unless you need to run some other bower command,
you can remove this whole <configuration> section.
-->
<arguments>install</arguments>
</configuration>
</execution>
Check the "Optional Configuration" section to see how to configure your front end directory. In your case:
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<!-- optional -->
<configuration>
<workingDirectory>src/main/resources/static</workingDirectory>
</configuration>
</plugin>

Maven Jaxb2 xjc plugin error No schemas have been found

These days I've spent some time on JAXB for converting XSD to Java Class and vice versa. Here's a very good tutorial for beginners, http://www.journaldev.com/1312/how-to-generate-java-classes-from-xsd-using-xjc-maven-plugin. I follow the steps strictly, but always get error when mvn clean install
Here's my pom.xml file.
<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>jd</groupId>
<artifactId>jd</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<!-- Plugin required to build java classes from XSD using XJC -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxb2-maven-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<id>xjc</id>
<goals>
<goal>xjc</goal>
</goals>
</execution>
</executions>
<configuration>
<!-- The name of your generated source package -->
<arguments>-extension -npa -b ${project.basedir}/src/main/java/com/moodys/jaxb/global.xjb</arguments>
</configuration>
</plugin>
</plugins>
</build>
</project>
But when I type mvn clean install, it always give me error as following:
C:\Users\congy\Desktop\Work\workspace\JaxbFromClass>mvn clean jaxb2:xjc
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building jd 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) # jd ---
[INFO] Deleting C:\Users\congy\Desktop\Work\workspace\JaxbFromClass\target
[INFO]
[INFO] --- jaxb2-maven-plugin:1.5:xjc (default-cli) # jd ---
[INFO] Generating source...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.487s
[INFO] Finished at: Thu Jul 04 19:09:37 CST 2013
[INFO] Final Memory: 4M/122M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:jaxb2-maven-plugin:1.5:xjc (default-cli) on project jd: No schemas have been found -> [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/MojoExecutionException
Can anyone show me the cause or simply tell me what should I refer to for further information?
Another question is : according to this question Difference of Maven JAXB plugins, there's at least three jaxb plugins. So all of these plugins are all generated for the same purposes? If so ,why?
Thanks in advance!
As you did not provide any schemaDirectory, the plugin is trying to generate Java sources from all XML schema files in the default schema directory. You should configure the plugin according to the documentation :
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxb2-maven-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<id>id1</id>
<goals>
<goal>xjc</goal>
</goals>
<configuration>
<outputDirectory>target/generated-sources/jaxb</outputDirectory>
<packageName>com.your.package.jaxb</packageName>
<schemaDirectory>src/main/xsd</schemaDirectory>
<schemaFiles>jaxb.xsd</schemaFiles>
</configuration>
</execution>
</executions>
</plugin>
Try to make sure that jaxb.xsd is present under src/main/resources, the plugin is waring since it coudn't find the scheme in the specified location.
We can use as below in pom.xml file
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxb2-maven-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<id>id1</id>
<goals>
<goal>xjc</goal>
</goals>
<configuration>
<outputDirectory>src/main/java</outputDirectory>
<clearOutputDir>false</clearOutputDir>
<packageName>com.subu.xsd.model</packageName>
<schemaDirectory>src/main/java/schemadir</schemaDirectory>
<schemaFiles>XYZ.xsd</schemaFiles>
</configuration>
</execution>
</executions>
</plugin>
The OP already got their answer, but I ran into this same problem for a different reason...
I introduced a new class that JAXB wasn't generating source for. This is because I used a parameterized constructor. Once I added a no-arg constructor the problem was fixed.

failsafe plugin won't run on one project but will run on another -- why?

This is driving me insane. The Maven failsafe plugin will not run on my project. If I run mvn verify only surefire runs. If I type mvn failsafe:verify it fails with the following error:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Simulation Experiment Server 1.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-failsafe-plugin:2.11:verify (default-cli) # experiment-server ---
[INFO] Failsafe report directory: C:\IdeaProjects\experiment_server\target\failsafe-reports
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.551s
[INFO] Finished at: Fri Mar 30 11:24:58 GMT-06:00 2012
[INFO] Final Memory: 5M/15M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-failsafe-plugin:2.11:verify (default-cli) on project experiment-server: C:\IdeaProjects\experiment_server\target\failsafe-reports\failsafe-summary.xml (The system cannot find the path specified) -> [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/MojoExecutionException
It's complaining about not finding failsafe-summary.xml. But this should be created by the plugin. And the plugin works fine (and creates the failsafe-summary.xml file if I run run Antonio Goncalves wonderful Arquillian example project.
So I copied the exact plugin information Antonio uses, and it still won't run on my project. I've modelled my POM to be exactly like his (except without a parent pom) -- something must be going wrong, I just don't know what. Why will failsafe run on his project but not mine??
Here is my failsafe pom.xml entry, which is taken right from his, and is the same as the one on the failsafe usaages site):
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${version.maven.failsafe.plugin}</version>
<configuration>
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
Thanks for any help, this is driving me insane.
UPDATE Okay, I seem to have gotten the cannot find failsafe-summary.xml problem fixed -- I change my directory from experiment_server to experiment-server. I guess that messes up failsafe.
But, I'm still having trouble getting failsafe to run from the command mvn verify or mvn integration-test. Both those commands call surefire instead of failsafe. I can now run failsafe directly by using the command: mvn failsafe:integration-test, but shouldn't failsafe automatically run with mvn verify? My mvn help:effective-pom shows that failsafe is there, so that's not the problem... Any ideas?
Take a look at the failsafe docs for the test names failsafe expects by default:
<includes>
<include>**/IT*.java</include>
<include>**/*IT.java</include>
<include>**/*ITCase.java</include>
</includes>
Are your tests named following one of these patterns? If not, try defining the <includes> element in the plugin configuration. Or change your test name(s) to fit the default pattern.
Okay, now that we've verified the test class names - typically when I add executions to plugin config I do it something like this:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${version.maven.failsafe.plugin}</version>
<configuration>
</configuration>
<executions>
<execution>
<id>failsafe-integration-tests</id>
<phase>integration-test</phase>
<goals>
<goal>integration-test</goal>
</goals>
</execution>
<execution>
<id>failsafe-verify</id>
<phase>verify</phase>
<goals>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
This explicitly binds the failsafe plugin goals you want to run to the correct phases of the build lifecycle. I believe the surefire plugin is bound to the test lifecycle phase by default (for a jar, war, & ejb anyway), but nothing is bound to integration-test or verify.
Here I will share my 2 cents. I had same issue and solution above didn't solve my problem.
I had maven-failsafe-plugin encapsulated in pluginManagement tag. I noticed to move it out into plugins tag instead when I saw this doc in the 4.0.0 maven schema:
Default plugin information to be made available for reference by
projects derived from this one. This plugin configuration will not
be resolved or bound to the lifecycle unless referenced. Any local
configuration for a given plugin will override the plugin's entire
definition here.
Hopefully this additional info. solves more ppl's problem like myself.
For me it worked only after I added the "default" includes.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.15</version>
<configuration>
<includes>
<include>**/IT*.java</include>
<include>**/*IT.java</include>
<include>**/*ITCase.java</include>
<include>**/IntegrationTest*.java</include>
</includes>
</configuration>
<executions>
<execution>
<id>failsafe-integration-tests</id>
<phase>integration-test</phase>
<goals>
<goal>integration-test</goal>
</goals>
</execution>
<execution>
<id>failsafe-verify</id>
<phase>verify</phase>
<goals>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
If you are running 2.12.2 version of the failsafe plugin, this is normal. Switch to a previous version. It seem 2.13 is not available yet.
Jira link

Resources