Cannot execute a simple maven project through jenkins - java

I'm using Linux - Ubuntu 14.04.
I've installed Jenkins 2.7.2.
I created a maven project in Eclipse and followed the instructions provided in this link http://www.guru99.com/maven-jenkins-with-selenium-complete-tutorial.html.
After completing the project setup, I executed it as Maven Project and the build was successful.
Then I installed Jenkins, installed Maven Integration Plugin, created a Maven Project and added the Root POM location and in 'Goals and options' field, I gave 'test' as input and executed the Build, but the Build was a failure.
The console output is as follows:
Started by user QA Admin
Building in workspace /var/lib/jenkins/workspace/WebDriverTest2
Parsing POMs
Established TCP socket on 58065
[WebdriverTest] $ java -Xms1024m -Xmx4096m -XX:PermSize=1024m -cp /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven32-agent-1.7.jar:/var/lib/jenkins/tools/hudson.tasks.Maven_MavenInstallation/Maven/boot/plexus-classworlds-2.5.2.jar:/var/lib/jenkins/tools/hudson.tasks.Maven_MavenInstallation/Maven/conf/logging jenkins.maven3.agent.Maven32Main /var/lib/jenkins/tools/hudson.tasks.Maven_MavenInstallation/Maven /var/cache/jenkins/war/WEB-INF/lib/remoting-2.60.jar /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven32-interceptor-1.7.jar /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-commons-1.7.jar 58065
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option PermSize=1024m; support was removed in 8.0
<===[JENKINS REMOTING CAPACITY]===>channel started
Executing Maven: -B -f /home/admin/workspace/WebdriverTest/pom.xml test
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building WebdriverTest 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # WebdriverTest ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.5.1:compile (default-compile) # WebdriverTest ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # WebdriverTest ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.5.1:testCompile (default-testCompile) # WebdriverTest ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.19.1:test (default-test) # WebdriverTest ---
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Results :
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[JENKINS] Recording test results
hudson.AbortException: Test reports were found but none of them are new. Did tests run?
For example, /home/admin/workspace/WebdriverTest/target/surefire-reports/TEST-TestSuite.xml is 23 min old
at hudson.tasks.junit.TestResult.parse(TestResult.java:228)
at hudson.maven.reporters.SurefireArchiver.postExecute(SurefireArchiver.java:148)
at hudson.maven.Maven3Builder$MavenExecutionListener.recordMojoEnded(Maven3Builder.java:634)
at hudson.maven.Maven3Builder$MavenExecutionListener.mojoFailed(Maven3Builder.java:667)
at hudson.maven.Maven3Builder$JenkinsEventSpy.onEvent(Maven3Builder.java:311)
at org.apache.maven.eventspy.internal.EventSpyDispatcher.onEvent(EventSpyDispatcher.java:104)
at org.apache.maven.eventspy.internal.EventSpyExecutionListener.mojoFailed(EventSpyExecutionListener.java:138)
at org.apache.maven.lifecycle.internal.DefaultExecutionEventCatapult.fire(DefaultExecutionEventCatapult.java:90)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:219)
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.jvnet.hudson.maven3.launcher.Maven32Launcher.main(Maven32Launcher.java:132)
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.launchStandard(Launcher.java:330)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:238)
at jenkins.maven3.agent.Maven32Main.launch(Maven32Main.java:186)
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 hudson.maven.Maven3Builder.call(Maven3Builder.java:136)
at hudson.maven.Maven3Builder.call(Maven3Builder.java:71)
at hudson.remoting.UserRequest.perform(UserRequest.java:153)
at hudson.remoting.UserRequest.perform(UserRequest.java:50)
at hudson.remoting.Request$2.run(Request.java:332)
at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.097 s
[INFO] Finished at: 2016-08-25T17:16:17+05:30
[INFO] Final Memory: 18M/981M
[INFO] ------------------------------------------------------------------------
Waiting for Jenkins to finish collecting data
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test (default-test) on project WebdriverTest: Error creating properties files for forking: No such file or directory -> [Help 1]
[JENKINS] Archiving /home/admin/workspace/WebdriverTest/pom.xml to WebdriverTest/WebdriverTest/0.0.1-SNAPSHOT/WebdriverTest-0.0.1-SNAPSHOT.pom
[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
/home/admin/workspace/WebdriverTest/pom.xml is not inside /var/lib/jenkins/workspace/WebDriverTest2/home/admin/workspace/WebdriverTest/; will archive in a separate pass
channel stopped
Finished: FAILURE
Any help is greatly appreciated. Please help. Thanks in advance.

It looks like you may have given an absolute path to the pom file. At the top Maven logs
Building in workspace /var/lib/jenkins/workspace/WebDriverTest2
And at the end you can see
/home/admin/workspace/WebdriverTest/pom.xml is not inside /var/lib/jenkins/workspace/WebDriverTest2/home/admin/workspace/WebdriverTest/; will archive in a separate pass
So if what I'm thinking is correct, you just need to change the "Root POM" parameter. Give it a relative path to the pom.xml from the project's root directory. So if your project is
WebDriverTest
src/main/java
src/test/java
...
pom.xml
The "Root POM" parameter should just be pom.xml

Related

Build fails in jenkins for java which is in Azure repo

I have configured the project in Azure Repo and Jenkins VM but when I start Build of that java project in jenkins, it fails. Please help me to resolve the issue. Jenkins console output below. Integration between Azure Repo and Jenkins was successful but when I try to click on Build Now in Jenkins it fails.
Java Project is in Azure Repo,
Jenkins is in Azure cloud vm (Ready plugins available by Azure)
Started by user user
Running as SYSTEM
Building in workspace /bitnami/jenkins/home/workspace/MyShuttle
The recommended git tool is: NONE
using credential 04536115-8271-469c-9196-66fa633da13a
> git rev-parse --resolve-git-dir /bitnami/jenkins/home/workspace/MyShuttle/.git # timeout=10
Fetching changes from the remote Git repository
> git config remote.origin.url https://cloudera2019#dev.azure.com/cloudera2019/MyShuttle/_git/MyShuttle # timeout=10
Fetching upstream changes from https://cloudera2019#dev.azure.com/cloudera2019/MyShuttle/_git/MyShuttle
> git --version # timeout=10
> git --version # 'git version 2.35.1'
using GIT_ASKPASS to set credentials
> git fetch --tags --force --progress -- https://cloudera2019#dev.azure.com/cloudera2019/MyShuttle/_git/MyShuttle +refs/heads/*:refs/remotes/origin/* # timeout=10
> git rev-parse refs/remotes/origin/master^{commit} # timeout=10
Checking out Revision c481534e99083921a6ff50e07bed72b1f6855a93 (refs/remotes/origin/master)
> git config core.sparsecheckout # timeout=10
> git checkout -f c481534e99083921a6ff50e07bed72b1f6855a93 # timeout=10
Commit message: "Added CreateMYSQLDB.sql"
> git rev-list --no-walk c481534e99083921a6ff50e07bed72b1f6855a93 # timeout=10
Parsing POMs
Established TCP socket on 33515
[MyShuttle] $ java -cp /bitnami/jenkins/home/plugins/maven-plugin/WEB-INF/lib/maven35-agent-1.13.jar:/bitnami/jenkins/home/tools/hudson.tasks.Maven_MavenInstallation/maven/boot/plexus-classworlds-2.6.0.jar:/bitnami/jenkins/home/tools/hudson.tasks.Maven_MavenInstallation/maven/conf/logging jenkins.maven3.agent.Maven35Main /bitnami/jenkins/home/tools/hudson.tasks.Maven_MavenInstallation/maven /bitnami/jenkins/home/war/WEB-INF/lib/remoting-4.11.2.jar /bitnami/jenkins/home/plugins/maven-plugin/WEB-INF/lib/maven35-interceptor-1.13.jar /bitnami/jenkins/home/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-commons-1.13.jar 33515
<===[JENKINS REMOTING CAPACITY]===>channel started
Executing Maven: -B -f /bitnami/jenkins/home/workspace/MyShuttle/pom.xml package -Dtest=FaresTest,SimpleTest
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------< com.microsoft.example:myshuttle >-------------------
[INFO] Building myshuttle 0.0.1
[INFO] --------------------------------[ war ]---------------------------------
[INFO]
[INFO] --- jacoco-maven-plugin:0.7.9:prepare-agent (default) # myshuttle ---
[WARNING] The artifact xml-apis:xml-apis:jar:2.0.2 has been relocated to xml-apis:xml-apis:jar:1.0.b2
[INFO] argLine set to -javaagent:/bitnami/jenkins/home/.m2/repository/org/jacoco/org.jacoco.agent/0.7.9/org.jacoco.agent-0.7.9-runtime.jar=destfile=/bitnami/jenkins/home/workspace/MyShuttle/target/jacoco.exec
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # myshuttle ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /bitnami/jenkins/home/workspace/MyShuttle/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.3:compile (default-compile) # myshuttle ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # myshuttle ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /bitnami/jenkins/home/workspace/MyShuttle/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.3:testCompile (default-testCompile) # myshuttle ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) # myshuttle ---
[INFO] Surefire report directory: /bitnami/jenkins/home/workspace/MyShuttle/target/surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Exception in thread "main" java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:513)
at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:525)
Caused by: java.lang.RuntimeException: Class java/util/UUID could not be instrumented.
at org.jacoco.agent.rt.internal_8ff85ea.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:140)
at org.jacoco.agent.rt.internal_8ff85ea.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:101)
at org.jacoco.agent.rt.internal_8ff85ea.PreMain.createRuntime(PreMain.java:55)
at org.jacoco.agent.rt.internal_8ff85ea.PreMain.premain(PreMain.java:47)
... 6 more
Caused by: java.lang.NoSuchFieldException: $jacocoAccess
at java.base/java.lang.Class.getField(Class.java:1999)
at org.jacoco.agent.rt.internal_8ff85ea.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:138)
... 9 more
*** java.lang.instrument ASSERTION FAILED ***: "result" with message agent load/premain call failed at ./src/java.instrument/share/native/libinstrument/JPLISAgent.c line: 422
FATAL ERROR in native method: processing of -javaagent failed, processJavaStart failed
Aborted
Results :
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[JENKINS] Recording test results
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 12.070 s
[INFO] Finished at: 2022-02-28T09:25:11Z
[INFO] ------------------------------------------------------------------------
Waiting for Jenkins to finish collecting data
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test (default-test) on project myshuttle: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test failed: The forked VM terminated without saying properly goodbye. VM crash or System.exit called ? -> [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/PluginExecutionException
[JENKINS] Archiving /bitnami/jenkins/home/workspace/MyShuttle/pom.xml to com.microsoft.example/myshuttle/0.0.1/myshuttle-0.0.1.pom
channel stopped
Archiving artifacts
Finished: FAILURE
I could able to solve the issue by adding below xml in pom.xml
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<forkCount>3</forkCount>
<reuseForks>true</reuseForks>
<argLine>-Xmx1024m -XX:MaxPermSize=256m</argLine>
</configuration>
</plugin>

ERROR Failed to execute goal io.quarkus:quarkus-maven-plugin:1.13.2.Final:dev (default-cli) on project code-with-quarkus:

when I use the command mvn clean quarkus: dev, I get the following response from the terminal in intellij:
E:\api-hard-lot>mvn clean quarkus:dev
[INFO] Scanning for projects...
[INFO]
[INFO] ---------------------< org.acme:code-with-quarkus >---------------------
[INFO] Building code-with-quarkus 1.0.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # code-with-quarkus ---
[INFO] Deleting E:\api-hard-lot\target
[INFO]
[INFO] --- quarkus-maven-plugin:1.13.2.Final:dev (default-cli) # code-with-quarkus ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 31 source files to E:\api-hard-lot\target\classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.052 s
[INFO] Finished at: 2021-04-25T12:02:55-03:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal io.quarkus:quarkus-maven-plugin:1.13.2.Final:dev (default-cli) on project code-with-quarkus: Fatal error
compiling: invalid target release: 11 -> [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
'cmd' is not recognized as an internal command
or external, an operable program or a batch file.
Your project was created using JDK 11 and thus mandates JDK 11 while you are trying to build it with a JDK inferior to 11.
Either update your JDK (recommended) or adjust your project to be JDK 8 compatible (replace occurrences of 11 with 1.8 in your pom file).
thanks guys thats exactly my solution i alter to jdk 8 and
in pom
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
and
in code-with-quarkus

Jenkins cannot execute Maven pom.xml

I have a big issue with my Jenkins on Mac OS. So I installed Jenkins, made a simple class and converted to Maven, created a new job on Jenkins and specify the pom.xml location ( which Jenkins sees it ok ) but when I try to build my class I always get an error as Jenkins cannot write mojo status or something.This is my console output
Started by user anonymous
Building in workspace /Users/Shared/Jenkins/Home/workspace/Cocotest
Parsing POMs
[Simple2] $ /Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/bin/java -cp /Users/Shared/Jenkins/Home/plugins/maven-plugin/WEB-INF/lib/maven31-agent-1.5.jar:/usr/local/apache-maven-3.3.9/boot/plexus-classworlds-2.5.2.jar:/usr/local/apache-maven-3.3.9/conf/logging jenkins.maven3.agent.Maven31Main /usr/local/apache-maven-3.3.9 /Users/Shared/Jenkins/Home/war/WEB-INF/lib/remoting-2.53.2.jar /Users/Shared/Jenkins/Home/plugins/maven-plugin/WEB-INF/lib/maven31-interceptor-1.5.jar /Users/Shared/Jenkins/Home/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-commons-1.5.jar 51372
<===[JENKINS REMOTING CAPACITY]===>channel started
Executing Maven: -B -f /Users/alex-macbook/Eclipse workspace/Simple2/pom.xml install
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Simple2 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # Simple2 ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/alex-macbook/Eclipse workspace/Simple2/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # Simple2 ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.396 s
[INFO] Finished at: 2015-12-29T20:46:31+01:00
[INFO] Final Memory: 12M/144M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project Simple2: Error while storing the mojo status: /Users/alex-macbook/Eclipse workspace/Simple2/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst (Permission denied) -> [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
[JENKINS] Archiving /Users/alex-macbook/Eclipse workspace/Simple2/pom.xml to simple/Simple2/0.0.1-SNAPSHOT/Simple2-0.0.1-SNAPSHOT.pom
/Users/alex-macbook/Eclipse workspace/Simple2/pom.xml is not inside /Users/Shared/Jenkins/Home/workspace/Cocotest/Users/alex-macbook/Eclipse workspace/Simple2/; will archive in a separate pass
channel stopped
Finished: FAILURE
Regarding this error message:
Error while storing the mojo status:
/Users/alex-macbook/Eclipse workspace/Simple2/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst (Permission denied)
I think it's more a permission problem.
Jenkins is running with a dedicated jenkins user.
Did you check this user has a R/W access in your working directory?

WordCount example runs in Eclipse, but not in terminal

I tried running first of the WordCount examples and it works in Eclipse (I have Windows 7 OS), but not in shell, using the command:
mvn compile exec:java -Dexec.mainClass=com.google.cloud.dataflow.examples.MinimalWordCount
I have installed Maven and configured JAVA_HOME and Path variables and so on, however, I'm not sure what I must have missed. This is the output:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Tutorial 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # Tutorial ---
[WARNING] Using platform encoding (Cp1250 actually) to copy filtered resources,
i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:\Java\eclipse-jee-luna-SR2-win32-x8
6_64\eclipse\workspace\Tutorial\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.3:compile (default-compile) # Tutorial --
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- exec-maven-plugin:1.4.0:java (default-cli) # Tutorial ---
[WARNING]
java.lang.ClassNotFoundException: com.google.cloud.dataflow.examples.MinimalWord
Count
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:281)
at java.lang.Thread.run(Thread.java:744)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.011 s
[INFO] Finished at: 2015-11-03T01:11:57+01:00
[INFO] Final Memory: 17M/178M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.4.0:java
(default-cli) on project Tutorial: An exception occured while executing the Java
class. com.google.cloud.dataflow.examples.MinimalWordCount -> [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/MojoExecutionE
xception-
I am in the dark about how to proceed and would very much appreciate ideas of where to look next and other things to try.
Thanks!
You may have run into an issue with the documentation.
The command line you are using should work if you have cloned GoogleCloudPlatform/DataflowJavaSDK-examples. The mention of the particular repo to clone is way back in "getting started", not at all obvious if you head straight to WordCount Example Pipeline.
But if you generated the project from the Cloud Dataflow Plugin for Eclipse (or via a Maven archetype) then the examples are placed into your Java package. So instead of com.google.cloud.dataflow.examples.MinimalWordCount you will use the name my.java.project.MinimalWordCount, where my.java.project is whatever package name you chose when you created the project.
Or if you have cloned the SDK itself from GoogleCloudPlatform/DataflowJavaSDK then you will need to add -pl examples to your command line. This is because the SDK's repository is factored into maven modules; this flag instructs maven to run in the context of the examples module.
If you have a multi-module maven project (DataflowJavaSDK, not DataflowJavaSDK-examples), you can do mvn compile in the top directory, then cd into examples and then issue the mvn exec:java -Dexec.mainClass=... command there.

Maven with Surefire refuses to run single test method?

I've been trying to use Maven with the Surefire plugin to run some JUnit unit tests.
Following the instructions provided by Maven and the Surefire folks here: http://maven.apache.org/surefire/maven-surefire-plugin/examples/single-test.html
My command for maven is as follows:
mvn clean -Dtest-group=regression -Dtest=TestClass#testMethod test
TestGroup is pulled from an #IfProfileValue statement and has always worked:
#IfProfileValue(name = "test-group", values = {"regression"})
However after I run the command, despite being sure that testClass has a method named testMethod(which would run if I didn't add the #testMethod to the command) my output is as follows:
~/REPOS/app: mvn clean -Dtest-group=regression -Dtest=TestClass#testmethod test
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.app:GuiAuto:jar:0.0.1-SNAPSHOT
[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: org.twitter4j:twitter4j-core:jar -> version 2.2.4 vs [3.0,) # line 127, column 21
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. # line 147, column 12
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building GuiAuto 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # GuiAuto ---
[INFO] Deleting /Users/llaskin/REPOS/app/target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # GuiAuto ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 92 resources
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) # GuiAuto ---
[INFO] Compiling 762 source files to /Users/llaskin/REPOS/app/target/classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # GuiAuto ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 3 resources
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:testCompile (default-testCompile) # GuiAuto ---
[INFO] Compiling 762 source files to /Users/llaskin/REPOS/app/target/test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.17:test (default-test) # GuiAuto ---
[INFO] Surefire report directory: /Users/llaskin/REPOS/app/target/surefire-reports
[INFO] parallel='classes', perCoreThreadCount=false, threadCount=5, useUnlimitedThreads=false, threadCountSuites=0, threadCountClasses=0, threadCountMethods=0, parallelOptimized=true
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Results :
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 11.379s
[INFO] Finished at: Mon Nov 17 12:27:59 CST 2014
[INFO] Final Memory: 27M/571M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.17:test (default-test) on project GuiAuto: No tests were executed! (Set -DfailIfNoTests=false to ignore this 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
Maybe this is because of the bug SUREFIRE-1028 in Surefire 2.16 and 2.17. This bug is fixed in Surefire 2.18.
Can you please upgrade and tell us whether your problem is fixed with Surefire 2.18 or not.

Categories

Resources