Maven Surefire Report Missing from Generated Site - maven-2

I'm having a little difficulty in getting the surefire report to appear in the generated site. I run mvn clean site:site and the report is missing.
My pom.xml looks like this:-
<?xml version="1.0" encoding="UTF-8"?>
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>testMaven</groupId>
<artifactId>testMaven</artifactId>
<name>Test Maven Project</name>
<version>1.0</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.6</version>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.6</version>
</plugin>
</plugins>
</reporting>
</project>
When I do mvn test, the test runs fine.
$ mvn clean test
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Test Maven Project
[INFO] task-segment: [clean, test]
[INFO] ------------------------------------------------------------------------
[INFO] [clean:clean {execution: default-clean}]
[INFO] Deleting directory c:\workspace\java\rsa\testMaven\target
[INFO] [resources:resources {execution: default-resources}]
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO] [compiler:compile {execution: default-compile}]
[INFO] Compiling 1 source file to c:\workspace\java\rsa\testMaven\target\classes
[INFO] [resources:testResources {execution: default-testResources}]
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO] [compiler:testCompile {execution: default-testCompile}]
[INFO] Compiling 1 source file to c:\workspace\java\rsa\testMaven\target\test-classes
[INFO] [surefire:test {execution: default-test}]
[INFO] Surefire report directory: c:\workspace\java\rsa\testMaven\target\surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running testMaven.main.HelloWorldServiceTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.047 sec
Results :
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1 second
[INFO] Finished at: Fri Dec 10 10:42:20 CST 2010
[INFO] Final Memory: 17M/1016M
[INFO] ------------------------------------------------------------------------
May I know what I'm doing wrong here? Thanks.

You need to use the maven-surefire-report-plugin in the reporting section (instead of the maven-surefire-plugin), e.g.
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.6</version>
</plugin>
</plugins>
</reporting>

Related

How to run selenium/junit teste case using maven command line

I'm trying to run an automated test from the command line, but when using the "mvn clean test" command, only the "BUILD SUCCESS" log is displayed, but the browser is not started and the test is not executed.
I'm using: - Junit 4
Selenium 3.141.59
Java 8
Eclipse IDE
-Maven 3.6.0
Someone can help me ?
I dont know what is happen.
You can add maven surefire plugin in your pom or failsafe:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M7</version>
</plugin>
</plugins>
</build>
Then try again running:
mvn clean test
All classses containing Test/Tests should be picked up
LOG:
[INFO] Running DummyTest
Test was executed
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.024 s - in DummyTest
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M5

I am trying to build new item in jenkins (1st time) to run autotest in maven.
I configure the jenkins and press build now.
There is a problem I can't find the answer and ask for help please.
This is the error in the console :
[INFO] --- maven-surefire-plugin:3.0.0-M5:test (default-test) # miron ---
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/surefire/maven-surefire-common/3.0.0-M5/maven-surefire-common-3.0.0-M5.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 43.979 s
[INFO] Finished at: 2022-02-23T10:29:40+02:00
[INFO] ------------------------------------------------------------------------
[WARNING] The requested profile "Regression" could not be activated because it does not exist.
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M5:test (default-test) on project miron: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M5:test failed: Plugin org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M5 or one of its dependencies could not be resolved: Failed to collect dependencies at org.apache.maven.plugins:maven-surefire-plugin:jar:3.0.0-M5 -> org.apache.maven.surefire:maven-surefire-common:jar:3.0.0-M5: Failed to read artifact descriptor for org.apache.maven.surefire:maven-surefire-common:jar:3.0.0-M5: Could not transfer artifact org.apache.maven.surefire:maven-surefire-common:pom:3.0.0-M5 from/to central (https://repo.maven.apache.org/maven2): transfer failed for https://repo.maven.apache.org/maven2/org/apache/maven/surefire/maven-surefire-common/3.0.0-M5/maven-surefire-common-3.0.0-M5.pom: Connect to repo.maven.apache.org:443 [repo.maven.apache.org/199.232.192.215, repo.maven.apache.org/199.232.196.215] failed: Connection timed out: connect -> [Help 1]
I am working from work (company).
My POM :
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M5</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>testng.xml</suiteXmlFile>
</suiteXmlFiles>
<useSystemClassLoader>false</useSystemClassLoader>
</configuration>
</plugin>
</plugins>
</build>
Can someone help me solve it please ?

detekt doesn't generate report

I'm building my project by maven. The detekt configuration was added based on the official documentation:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
<inherited>false</inherited>
<executions>
<execution>
<!-- This can be run separately with mvn antrun:run#detekt -->
<id>detekt</id>
<phase>validate</phase>
<configuration>
<target name="detekt">
<java taskname="detekt" dir="${project.basedir}"
fork="true"
failonerror="false"
classname="io.gitlab.arturbosch.detekt.cli.Main"
classpathref="maven.plugin.classpath">
<arg value="--input"/>
<arg value="${project.basedir}/src/main/kotlin"/>
<arg value="--config"/>
<arg value="${project.basedir}/src/main/resources/sv_detekt.yml"/>
<arg value="--filters"/>
<arg value=".*/test/.*,.*/target/.*,.*/resources/.*"/>
<arg value="--output"/>
<arg value="${project.build.directory}/detekt-reports"/>
<arg value="--output-name"/>
<arg value="checkstyle-result"/>
/>
</java>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>io.gitlab.arturbosch.detekt</groupId>
<artifactId>detekt-cli</artifactId>
<version>1.0.0.RC8</version>
</dependency>
</dependencies>
</plugin>
Then, I'm trying to execute it by the following command: mvn antrun:run#detekt
The result is the following:
$ mvn antrun:run#detekt
[INFO] Scanning for projects...
[INFO]
[INFO] -------------------------< com.my:opd >--------------------------
[INFO] Building opd 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-antrun-plugin:1.3:run (detekt) # opd ---
[INFO] Executing tasks
[INFO] Executed tasks
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.295 s
[INFO] Finished at: 2018-08-10T11:46:02+03:00
[INFO] ------------------------------------------------------------------------
looks fine but the folder ${project.build.directory}/detekt-reports is not created and there are not any reports. What I did wrong?
I am not sure where is the issue however when detekt is executed through the maven tool in the intellij, it works fine. May be the problem in windows terminal...

Running the sample application using "mvn exec:exec" doesn't work

I'm following the Getting Started version 0.9. I can run the sample application with the full "java -Duser.lan..." command and the double-click on the foo.jar, but when I try the mvn exec:exec alternative it doesn't work.
Here the error in console:
CI0011766:drombler-test-application claudiorosati$ mvn exec:exec
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building drombler-test-application 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- exec-maven-plugin:1.5.0:exec (default-cli) # drombler-test-application ---
Error: Could not find or load main class Projects.drombler-test.drombler-test-application.target.deployment.standalone.conf.logging.properties
[ERROR] Command execution failed.
org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)
at org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:404)
at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:166)
at org.codehaus.mojo.exec.ExecMojo.executeCommandLine(ExecMojo.java:764)
at org.codehaus.mojo.exec.ExecMojo.executeCommandLine(ExecMojo.java:711)
at org.codehaus.mojo.exec.ExecMojo.execute(ExecMojo.java:289)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.809 s
[INFO] Finished at: 2017-03-08T11:46:48+01:00
[INFO] Final Memory: 24M/981M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.5.0:exec (default-cli) on project drombler-test-application: Command execution failed. Process exited with an error: 1 (Exit value: 1) -> [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
Here the section of the pom file of the test-application module:
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<id>default-cli</id>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<commandlineArgs>${additionalExecArgs} -Duser.language=en -Duser.country=US -Djavafx.verbose=true -Dbinary.css=false -Djava.util.logging.config.file=${project.build.directory}/deployment/standalone/conf/logging.properties -jar ${project.build.directory}/deployment/standalone/bin/foo.jar --userdir ${project.build.directory}/userdir</commandlineArgs>
<executable>java</executable>
<classpathScope>runtime</classpathScope>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.drombler.fx</groupId>
<artifactId>drombler-fx-maven-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<brandingId>foo</brandingId>
<title>MyApplication ${project.version}</title>
<width>1500</width>
<height>1000</height>
<!--Uncomment the following line and specifcy an unused port to create a single instance application -->
<!--<defaultSingleInstancePort>some unused port</defaultSingleInstancePort>-->
</configuration>
</plugin>
</plugins>
</build>
[DEBUG] Executing command line: [java, -Duser.language=en,
-Duser.country=US, -Djavafx.verbose=true, -Dbinary.css=false, -Djava.util.logging.config.file=/Users/claudiorosati/Projects/NetBeans,
Projects/drombler-test/drombler-test-application/target/deployment/standalone/conf/logging.properties,
-jar, /Users/claudiorosati/Projects/NetBeans, Projects/drombler-test/drombler-test-application/target/deployment/standalone/bin/foo.jar,
--userdir, /Users/claudiorosati/Projects/NetBeans, Projects/drombler-test/drombler-test-application/target/userdir]
Error: Could not find or load main class
Projects.drombler-test.drombler-test-application.target.deployment.standalone.conf.logging.properties [ERROR] Command execution failed.
org.apache.commons.exec.ExecuteException: Process exited with an
error: 1 (Exit value: 1)
It looks like there is an issue with paths which have spaces.
Please try the following:
<commandlineArgs>${additionalExecArgs} -Duser.language=en -Duser.country=US -Djavafx.verbose=true -Dbinary.css=false -Djava.util.logging.config.file="${project.build.directory}/deployment/standalone/conf/logging.properties" -jar "${project.build.directory}/deployment/standalone/bin/foo.jar" --userdir "${project.build.directory}/userdir"</commandlineArgs>

maven issue - maven-resources-plugin

Getting following excepting while running "mvn clean install -DskipTests -U"
[INFO] Scanning for projects...
[INFO] Reactor build order:
[INFO] (derived-data) avalon Data Modules
[INFO] (data-affiliate-dynamic) avalon Dynamic Affiliate Data
[INFO] (data-external-id) Amazon ID Reference Data
[INFO] (data-products-raw) avalon Raw Product Data
[INFO] (data-product-images) avalon Product Image Data
[INFO] ------------------------------------------------------------------------
[INFO] Building (derived-data) avalon Data Modules
[INFO] task-segment: [clean, install]
[INFO] ------------------------------------------------------------------------
[INFO] [clean:clean]
[INFO] [site:attach-descriptor]
[INFO] [install:install]
[INFO] Installing C:\svn\data\trunk\pom.xml to C:\Users\dinsolani\.m2\repository
\com\avalon\derived-data\3\derived-data-3.pom
[INFO] ------------------------------------------------------------------------
[INFO] Building (data-affiliate-dynamic) avalon Dynamic Affiliate Data
[INFO] task-segment: [clean, install]
[INFO] ------------------------------------------------------------------------
[INFO] artifact com.avalon:maven-resources-plugin: checking for updates from c
entral
[INFO] snapshot com.avalon:maven-resources-plugin:4.66-SNAPSHOT: checking for
updates from central
[INFO] snapshot com.avalon:tools-maven-plugins:4.66-SNAPSHOT: checking for upd
ates from central
Downloading: http://repo.avalon.com/content/groups/private/com/avalon/tools-
maven-plugins/4.66-SNAPSHOT/tools-maven-plugins-4.66-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error building POM (may not be this project's POM).
Project ID: null:maven-resources-plugin:maven-plugin:null
Reason: Cannot find parent: com.avalon:tools-maven-plugins for project: null:m
aven-resources-plugin:maven-plugin:null for project null:maven-resources-plugin:
maven-plugin:null
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9 seconds
[INFO] Finished at: Thu Oct 13 19:50:23 IST 2011
[INFO] Final Memory: 13M/981M
[INFO] ------------------------------------------------------------------------
Now I really looking for some solution or atleast some workaround for this issue.
Can I manually download & place somewhere
Is there any public repository, which I can use?
Here is the pom for the data-affiliate-dynamic module:
<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>
<parent>
<groupId>com.avalon</groupId>
<artifactId>derived-data</artifactId>
<version>3</version>
</parent>
<artifactId>data-affiliate-dynamic</artifactId>
<packaging>pom</packaging>
<name>(${project.artifactId})avalonDynamicAffiliateData</name>
<build>
<plugins>
<plugin>
<groupId>com.avalon</groupId>
<artifactId>maven-resources-plugin</artifactId>
<configuration>
<include>var/affiliate/${sourceId}*-dynamic-*.xml</include>
</configuration>
</plugin>
</plugins>
</build>
</project>