Error when pushing changes to openshift project - openshift

when I tried to push some changes in open shift project I got this error when trying to build the project:
remote: Found pom.xml... attempting to build with 'mvn --global-settings /var/lib/openshift/531f20d5500446fb69000112/app-root/runtime/repo//.openshift/config/settings.rhcloud.xml clean package -Popenshift -DskipTests'
remote: [INFO] Scanning for projects...
remote: [INFO]
remote: [INFO] ------------------------------------------------------------------------
remote: [INFO] Building radwan02 1.0
remote: [INFO] ------------------------------------------------------------------------
remote: [WARNING] The POM for org.apache.maven.plugins:maven-clean-plugin:jar:2.4.1 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
remote: [INFO] ------------------------------------------------------------------------
remote: [INFO] BUILD FAILURE
remote: [INFO] ------------------------------------------------------------------------
remote: [INFO] Total time: 0.292s
remote: [INFO] Finished at: Sat May 03 09:58:48 EDT 2014
remote: [INFO] Final Memory: 3M/78M
remote: [INFO] ------------------------------------------------------------------------
remote: [ERROR] Failed to parse plugin descriptor for org.apache.maven.plugins:maven-clean-plugin:2.4.1 (/var/lib/openshift/531f20d5500446fb69000112/.m2/repository/org/apache/maven/plugins/maven-clean-plugin/2.4.1/maven-clean-plugin-2.4.1.jar): zip file is empty -> [Help 1]
remote: [ERROR]
remote: [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
remote: [ERROR] Re-run Maven using the -X switch to enable full debug logging.
remote: [ERROR]
remote: [ERROR] For more information about the errors and possible solutions, please read the following articles:
remote: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginDescriptorParsingException
remote: An error occurred executing 'gear postreceive' (exit code: 1)
remote: Error message: CLIENT_ERROR: Failed to execute: 'control build' for /var/lib/openshift/531f20d5500446fb69000112/jbossews
after that the project status is "Building" and after I restart the project manually the changes I made didn't apply on the server.
Here's the pom file (I didn't change anything):
<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>radwan02</groupId>
<artifactId>radwan02</artifactId>
<packaging>war</packaging>
<version>1.0</version>
<name>radwan02</name>
<repositories>
<repository>
<id>eap</id>
<url>http://maven.repository.redhat.com/techpreview/all</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>eap</id>
<url>http://maven.repository.redhat.com/techpreview/all</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.6</maven.compiler.source>
<maven.compiler.target>1.6</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.2-1003-jdbc4</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.25</version>
</dependency>
</dependencies>
<profiles>
<profile>
<!-- When built in OpenShift the 'openshift' profile will be used when
invoking mvn. -->
<!-- Use this profile for any OpenShift specific customization your app
will need. -->
<!-- By default that is to put the resulting archive into the 'webapps'
folder. -->
<!-- http://maven.apache.org/guides/mini/guide-building-for-different-environments.html -->
<id>openshift</id>
<build>
<finalName>radwan02</finalName>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<outputDirectory>webapps</outputDirectory>
<warName>ROOT</warName>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
I use jBoss Developer Studo under windows 7, and JDK 1.7 64 bit

I just created a new Tomcat 7 application and the build finished without any error. There are couple of solutions:
Create a new application and push the changes again. Just in case there was some issue with that gear.
Create an empty file called force_clean_build inside your existing application .openshift/markers directory. Commit the file and push the changes. This will remove the .m2 repository and download all the dependencies and plugins again.

Related

How to fix the dependencies of a Maven JavaFX project ? (VsCode)

I have tried several ways to make the UI of a board game and JavaFX seems to be easiest option. So I created a new Java project using Maven in VsCode with a JavaFX archetype. But now that I copied my java files and Maven dependencies, it seems that there are conflicts with some libraries. I get errors like :
"The package javax.swing is not accessibleJava(268436910)", or
"The type com.fasterxml.jackson.databind.ObjectMapper is not accessibleJava(16778666)"
Here is my 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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.monopoly</groupId>
<artifactId>monopoly</artifactId>
<version>1.0</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>19</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>19</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.11.3</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.11.3</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<release>11</release>
</configuration>
</plugin>
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.8</version>
<executions>
<execution>
<!-- Default configuration for running -->
<!-- Usage: mvn clean javafx:run -->
<id>default-cli</id>
<configuration>
<mainClass>com.monopoly.App</mainClass>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
I haven't modified my files to use javafx yet, so some libraries will be replaced, but others won't, such as Json libraries. In any case, I hope it can help someone in the same situation.
I looked for version conflicts, but mvn dependency:tree is successful :
[INFO] -----------------------< com.monopoly:monopoly >------------------------
[INFO] Building monopoly 1.0
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) # monopoly ---
[INFO] com.monopoly:monopoly:jar:1.0
[INFO] +- org.openjfx:javafx-controls:jar:19:compile
[INFO] | +- org.openjfx:javafx-controls:jar:win:19:compile
[INFO] | \- org.openjfx:javafx-graphics:jar:19:compile
[INFO] | +- org.openjfx:javafx-graphics:jar:win:19:compile
[INFO] | \- org.openjfx:javafx-base:jar:19:compile
[INFO] | \- org.openjfx:javafx-base:jar:win:19:compile
[INFO] +- org.openjfx:javafx-fxml:jar:19:compile
[INFO] | \- org.openjfx:javafx-fxml:jar:win:19:compile
[INFO] +- com.fasterxml.jackson.core:jackson-databind:jar:2.11.3:compile
[INFO] | \- com.fasterxml.jackson.core:jackson-core:jar:2.11.3:compile
[INFO] \- com.fasterxml.jackson.core:jackson-annotations:jar:2.11.3:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
I also looked for answers on the net but that's a very specific topic, so haven't found anything yet. That's why I'm asking you guys. I'm not very experienced so I hope I gave enough information
Sorry if I'm late to answer, I forgot to post this. I found the answer with the help of #jewelsea. I was missing these lines in my module-info.java :
requires com.fasterxml.jackson.databind;
opens com.monopoly to javafx.fxml, com.fasterxml.jackson.databind;

With the shaded jar from dropwizard I got: Class path contains multiple SLF4J bindings

I probably made something stupid here. There is something (smallish) wrong with my dropwizard setup. Running the shaded jar works fine, but when executing integration tests I get this warning:
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/graphhopper/web/target/graphhopper-web-0.11-SNAPSHOT.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/user/.m2/repository/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]
INFO [2018-04-08 18:44:27,653] org.eclipse.jetty.util.log: Logging initialized #1090ms to org.eclipse.jetty.util.log.Slf4jLog
Where graphhopper-web-0.11-SNAPSHOT.jar is the shaded jar with dropwizard (with logback).
This usually means that more than one slf4j binding is on the classpath but I could reject this theory and only slf4j-api is there, plus the logback dependency for dropwizard. I also have analyzed the dependency graph with Netbeans and
mvn dependency:tree -Dverbose -Dincludes=org.slf4j
(see output here)
but couldn't find something problematic.
Can it be that the shaded jar (with logback) is somehow put into the classpath with the other jars (including logback) for mvn clean install? How could I avoid this?
Reproduce it via:
git clone https://github.com/graphhopper/graphhopper
cd web
mvn clean install
See this issue.
imported your code into my intellij community edition, added exclusion as follows to all the dependency in pom.xml of web module. It resolve issues given issue. You may have do changes in respective module.
example:
<dependency>
<groupId>io.dropwizard</groupId>
<artifactId>dropwizard-core</artifactId>
<version>1.2.2</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>
The issue is the jar logback-classic-1.2.3.jar has a actual file /org/slf4j/impl/StaticLoggerBinder.class, so jar exclusion won't work.
You need to change the configuration of the maven-shade-plugin
<configuration>
<createDependencyReducedPom>true</createDependencyReducedPom>
<filters>
<filter>
<artifact>ch.qos.logback:logback-classic</artifact>
<excludes>
<exclude>org/slf4j/impl/**</exclude>
</excludes>
</filter>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
</configuration>
Once you do that all is good and the warning is gone
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------< com.graphhopper:graphhopper-web >-------------------
[INFO] Building GraphHopper Web 0.11-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # graphhopper-web ---
[INFO] Deleting /Users/tarun.lalwani/Desktop/tarunlalwani.com/tarunlalwani/workshop/ub16/so/graphhopper/web/target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # graphhopper-web ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 118 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.5.1:compile (default-compile) # graphhopper-web ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 19 source files to /Users/tarun.lalwani/Desktop/tarunlalwani.com/tarunlalwani/workshop/ub16/so/graphhopper/web/target/classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # graphhopper-web ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.5.1:testCompile (default-testCompile) # graphhopper-web ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 9 source files to /Users/tarun.lalwani/Desktop/tarunlalwani.com/tarunlalwani/workshop/ub16/so/graphhopper/web/target/test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.19.1:test (default-test) # graphhopper-web ---
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running com.graphhopper.http.WebHelperTest
Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.151 sec - in com.graphhopper.http.WebHelperTest
Running com.graphhopper.http.IPFilterTest
20:29:46.762 [main] DEBUG com.graphhopper.http.IPFilter - whitelist:[4.5.67.1, 1.2.3.4]
20:29:46.765 [main] DEBUG com.graphhopper.http.IPFilter - blacklist:[8.9.7.3]
20:29:46.765 [main] DEBUG com.graphhopper.http.IPFilter - blacklist:[4.5.67.1, 1.2.3.4]
20:29:46.766 [main] DEBUG com.graphhopper.http.IPFilter - whitelist:[4.5.67.1, 1.2.3.4]
20:29:46.766 [main] DEBUG com.graphhopper.http.IPFilter - whitelist:[1.2.3*, 4.5.67.1, 7.8.*.3]
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.003 sec - in com.graphhopper.http.IPFilterTest
Results :
Tests run: 8, Failures: 0, Errors: 0, Skipped: 0
Edit-1: 26-Apr-2018
Updates from https://github.com/graphhopper/graphhopper/issues/1328
I believe the issue is that you run the Dropwizard app integration tests as integration test during the verify phase of the build. This phase gets invoked after the package phase where you create a shaded jar and replace the original jar with it.
[INFO] Replacing original artifact with shaded artifact.
[INFO] Replacing /home/travis/build/graphhopper/graphhopper/web/target/graphhopper-web-0.11-SNAPSHOT.jar with /home/travis/build/graphhopper/graphhopper/web/target/graphhopper-web-0.11-SNAPSHOT-shaded.jar
As a result you have two jars in the classpath with two slf4j bindings (graphhopper-web-0.11-SNAPSHOT and logback-classic-1.2.3.jar). There's no need to create a shaded jar for running an integration test against a Dropwizard application, it can be run as a unit test. So, if you configure graphhopper-web to run its integration tests during the test phase, there will be no warning:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.19.1</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
<configuration>
<excludes>
<exclude>com.graphhopper.http.**</exclude>
</excludes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<argLine>-Xmx100m -Xms100m</argLine>
<includes>
<include>com.graphhopper.http.**</include>
</includes>
</configuration>
</plugin>
Another option is to rename them from *IT to *Test, so they are not automatically matched as integration tests.

How to deploy mysql datasource using jboss-as-maven-plugin

This question is here to give an answer to once i find a solution, I have found documentation on Postgresql and H2 databases from the jboss website and have seen how it is done manually through this website, however I cannot seem to find much information on how to deploy a mysql datasource using the jboss-as-maven-plugin.
What is the minimum configuration properties required to properly register a mysql datasource with jboss-as 7 server through their maven plugin?
I have this dependency:
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
And this configuration for the maven plugin
<build>
<plugins>
...
<plugin>
<groupId>org.jboss.as.plugins</groupId>
<artifactId>jboss-as-maven-plugin</artifactId>
<configuration>
<execute-commands/>
<executeCommands/>
<properties>
<enable-welcome-root>false</enable-welcome-root>
</properties>
</configuration>
<executions>
...
<!-- deploy the mysql connectorj -->
<execution>
<id>deploy-mysql-driver</id>
<phase>install</phase>
<goals>
<goal>deploy-artifact</goal>
</goals>
<configuration>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<name>mysql.jar</name>
</configuration>
</execution>
<execution>
<id>deploy</id>
<phase>install</phase>
<goals>
<goal>deploy</goal>
</goals>
</execution>
<execution>
<id>add-datasource</id>
<phase>deploy</phase>
<goals>
<goal>add-resource</goal>
</goals>
<configuration>
<address>subsystem=datasources</address>
<resources>
<resource>
<address>xa-data-source=java:global/datasources/tncDS</address>
<enable-resource>true</enable-resource>
<properties>
<jndi-name>java:jboss/datasources/tncDS</jndi-name>
<enabled>true</enabled>
<connection-url>jdbc:mysql://localhost:3306/tnc</connection-url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<driver-name>mysql.jar</driver-name>
</properties>
</resource>
</resources>
</configuration>
</execution>
</executions>
...
</plugin>
</plugins>
</build>
running the command mvn jboss-as:run causes this error:
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.241s
[INFO] Finished at: Tue Sep 24 21:37:28 EST 2013
[INFO] Final Memory: 16M/308M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.jboss.as.plugins:jboss-as-maven-plugin:7.4.Final:deploy-artifact (deploy-mysql-driver) on project ear: Could not execute goal deploy-artifact on null. Reason: I/O Error could not execute operation '{
[ERROR] "address" => [],
[ERROR] "operation" => "read-attribute",
[ERROR] "name" => "launch-type"
[ERROR] }': java.net.ConnectException: JBAS012144: Could not connect to remote://localhost:9999. The connection timed out
[ERROR] -> [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
UPDATE:
I have developed a plugin that injects the required file (META-INF/services/java.sql.Driver) into the jar before deployment:
<plugin>
<groupId>com.thenaglecode</groupId>
<artifactId>mysql-jdbc-compliance-maven-plugin</artifactId>
<version>1.0-SNAPSHOT</version>
<configuration>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.26</version>
</configuration>
<executions>
<execution>
<goals>
<goal>modify-connector</goal>
</goals>
<phase>package</phase>
</execution>
</executions>
</plugin>
However i'm still getting could not connect to remote message. Is there a step that i'm missing or doing in the wrong sequence as i understand that the run command should start up the server.
UPDATE 2:
After some fiddling and reading of the jboss-as plugin website, I realized that the jboss-as:run goal also invokes the package phase. I was mostly receiving this error when I tried to run any of the deploying goals bound to the package phase.
Anything that needs to be deployed should be bound to the install phase.
I am now getting a seperate error regarding my persistence unit not existing
The problem is the MySQL driver is not JDBC 4 compliant. You need to add a META-INF/services/java.sql.Driver file to the JAR with the fully qualified JDBC driver class name or install it as a module. See https://community.jboss.org/wiki/DataSourceConfigurationInAS7 for more details.
solution here:
conf : jboss as7, maven 3.3.3, mysql java connector 5.1.29 28 27 26...,
starting from mysql java connector 5.1.30, the file Meta-INF/serivces/java.sql.driver contain this line "com.mysql.jdbc.Driver
com.mysql.fabric.jdbc.FabricMySQLDriver", if I change it to "com.mysql.jdbc.Driver" the datasource is created and the project deployed fine.
with mysql java connector 5.1.29 28 27 26 ..., that file contain only "com.mysql.jdbc.Driver", the deployement work fine.
check my pom.xml here
https://github.com/anouarattn/GestionAbsence

Failsafe html reports in Jenkins

I have some integration tests (with Selenium) which are run with failsafe maven plugin. Failsafe generates XML reports files only.
1) I want to generate HTML reports
2) I want to have a link in Jenkins to the html reports
For the 1) I installed the "maven-surefire-report-plugin" to use the failsafe-report-only goal.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.13</version>
<executions>
<execution>
<phase>post-integration-test</phase>
<goals>
<goal>failsafe-report-only</goal>
</goals>
</execution>
</executions>
</plugin>
But in the standard output, nothing seems to be generated :
[INFO]
[INFO] >>> maven-surefire-report-plugin:2.13:failsafe-report-only (default) # BaseContrats >>>
[INFO]
[INFO] <<< maven-surefire-report-plugin:2.13:failsafe-report-only (default) # BaseContrats <<<
[INFO]
[INFO] --- maven-surefire-report-plugin:2.13:failsafe-report-only (default) # BaseContrats ---
In my failsafe-reports directory, I have only XML report files but not the HTML ones.
Is it the good plugin to generate html reports for failsafe?
For the 2), I installed the Jenkins plugin "Selenium HTML report" and added the post build action "Publish Selenium HTML report" and configured it with "target/failsafe-reports" value for "Selenium tests results location" parameter, but nothing is displayed in Jenkins interface (surely because my html reports file are not generated...).
Could you help me for these 2 points?
Answer for the part 1) to generate HTML reports for Failsafe.
Add the following to pom.xml
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.18.1</version>
<configuration>
<skipSurefireReport>${skipSurefireReport}</skipSurefireReport>
<reportsDirectories>
<reportsDirectory>${basedir}/target/failsafe-reports</reportsDirectory>
</reportsDirectories>
</configuration>
</plugin>
</plugins>
</reporting>
<properties>
<skipSurefireReport>true</skipSurefireReport>
</properties>
I am assuming you are using mvn verify to run the integration tests using failsafe-plugin.
By default, this generates the (*.txt & *.xml) reports in {basedir}/target/failsafe-reports. This should be specified in <reportDirectories>. You can point to any directory which has TEST-*.xml reports.
And then run the cmd
mvn site
This would generate html reports for the Failsafe run integration tests. By default, The files would be in {basedir}/target/site/failsafe-report.html.
This location be changed.

Send test reports to different directory using maven-surefire-plugin

I want to generate my reports so I used maven-surefire-plugin.
This is my pom.xml:
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.10</version>
<executions>
<execution>
<id>test-reports</id>
<phase>install</phase>
<configuration>
<tasks>
<junitreport todir="./reports">
<fileset dir="./reports">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames" todir="./report/html"/>
</junitreport>
</tasks>
</configuration>
<goals>
<goal>test </goal>
</goals>
</execution>
</executions>
</plugin>
But I'm getting this error when I run maven test:
Tests run: 6, Failures: 2, Errors: 2, Skipped: 0
[INFO] --------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] --------------------------------------------------------------------
[INFO] Total time: 10.403s
[INFO] Finished at: Wed Oct 12 08:35:10 CEST 2011
[INFO] Final Memory: 17M/126M
[INFO] --------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire- plugin:2.10:test (default-test) on project jebouquine: There are test failures.
[ERROR]
[ERROR] Please refer to C:\Users\Amira\workspace1\jebouquine\target\surefire-reports for the individual test results.
[ERROR] -> [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
When I open C:\Users\Amira\workspace1\jebouquine\target\surefire-reports I find repotrts but I want them under ./reports.
Any idea how to do it? Or is there any alternative to generate my tests reports?
Look, here's the bottom line: you need to read more about Maven because what you have written does not make sense. You have tried to stuff ant configuration elements into the surefire plugin config, which is not right at all. And you have tried to bind it to the install phase, but then you are running mvn test.
Finally, it might help if you explained why you want them in a different directory in the first place ... there might be a better way to achieve your real goals.
However, this will fix your problem for the next 5 seconds or so:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.10</version>
<configuration>
<reportsDirectory>${project.build.directory}/reports</reportsDirectory>
</configuration>
</plugin>