Jenkins not running TestNG tests via surefire - java

Have a local set up using Maven and TestNG which builds just fine. The build is a little odd given that in order for the tests to run, a packaged JAR is needed first. So in effect the local setup runs
#!/bin/bash
mvn clean package -Dmaven.test.skip.exec=true
mvn test
When run on Jenkins, the clean/package step succeeds as does test, except no tests are actually run:
[workspace] $ mvn -f some_sub_directory/pom.xml test
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building ...-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) # project ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /var/lib/jenkins/jobs/...
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) # project ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) # project ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) # project ---
[INFO] Not compiling test sources
[INFO]
[INFO] --- maven-surefire-plugin:2.10:test (default-test) # project ---
[INFO] Tests are skipped.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.222s
[INFO] Finished at: Fri Nov 22 18:34:00 UTC 2013
[INFO] Final Memory: 11M/89M
[INFO] ------------------------------------------------------------------------
Finished: SUCCESS
Seems as though the testCompile and test goals in the surefire plugin aren't finding any test classes.
Is there an additional config needed in pom.xml?

The default and recommended path for test classes is {basedir}/src/test/java/.
But you can precise the path in your pom.xml
<build>
<testSourceDirectory>{basedir}/path/to/test/classes</testSourceDirectory>
...
</build>

You need to specify your tests that need to be run. I believe, it looks for tests starting with test*. If you are using a testng xml then you need to set that up. Check this link out for examples on how to specify tests in different ways.

Related

Jenkins is unable to find the java file in workspace

We are following the instructions given by some tutorials to integrate our project with jenkins unsuccessfully, we think the reason is the path to the scripts of java. Could you give us a hand? The log result is:
Started by user admin
Running as SYSTEM Building in workspace C:\Users\xxxxxxx\.jenkins\workspace\JenkinsDemo Parsing POMs Established TCP socket on 57342 [JenkinsDemo] $ "C:\Program Files\Java\jdk-11.0.11/bin/java" -cp C:\Users\xxxxxxx\.jenkins\plugins\maven-plugin\WEB-INF\lib\maven35-agent-1.13.jar;C:\Users\xxxxxxx\apache-maven-3.8.1\boot\plexus-classworlds-2.6.0.jar;C:\Users\xxxxxxx\apache-maven-3.8.1/conf/logging jenkins.maven3.agent.Maven35Main C:\Users\xxxxxxx\apache-maven-3.8.1 C:\Users\xxxxxxx\.jenkins\war\WEB-INF\lib\remoting-4.12.jar C:\Users\xxxxxxx\.jenkins\plugins\maven-plugin\WEB-INF\lib\maven35-interceptor-1.13.jar C:\Users\xxxxxxx\.jenkins\plugins\maven-plugin\WEB-INF\lib\maven3-interceptor-commons-1.13.jar 57342 <===[JENKINS REMOTING CAPACITY]===>channel started Executing Maven: -B -f C:\Users\xxxxxxx\.jenkins\workspace\JenkinsDemo\pom.xml install [INFO] Scanning for projects... [INFO] [INFO]
----------------------< JenkinsDemo:JenkinsDemo >----------------------- [INFO] Building JenkinsDemo 0.0.1-SNAPSHOT [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources) # JenkinsDemo
--- [WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent! [INFO] skip non existing resourceDirectory C:\Users\xxxxxxx\.jenkins\workspace\JenkinsDemo\src\main\resources [INFO] [INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) # JenkinsDemo --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # JenkinsDemo --- [WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent! [INFO] skip non existing resourceDirectory C:\Users\xxxxxxx\.jenkins\workspace\JenkinsDemo\src\test\resources [INFO] [INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) # JenkinsDemo --- [INFO] No sources to compile [INFO] [INFO] --- maven-surefire-plugin:2.12.4:test (default-test) # JenkinsDemo --- [INFO] No tests to run. [JENKINS] Guardando informes de test [INFO] [INFO] --- maven-jar-plugin:2.4:jar (default-jar) # JenkinsDemo --- [INFO] [INFO] --- maven-install-plugin:2.4:install (default-install) # JenkinsDemo --- [INFO] Installing C:\Users\xxxxxxx\.jenkins\workspace\JenkinsDemo\target\JenkinsDemo-0.0.1-SNAPSHOT.jar to C:\Users\xxxxxxx\.m2\repository\JenkinsDemo\JenkinsDemo\0.0.1-SNAPSHOT\JenkinsDemo-0.0.1-SNAPSHOT.jar [INFO] Installing C:\Users\xxxxxxx\.jenkins\workspace\JenkinsDemo\pom.xml to C:\Users\xxxxxxx\.m2\repository\JenkinsDemo\JenkinsDemo\0.0.1-SNAPSHOT\JenkinsDemo-0.0.1-SNAPSHOT.pom [INFO]
------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO]
------------------------------------------------------------------------ [INFO] Total time: 3.337 s [INFO] Finished at: 2022-05-09T12:20:50+02:00 [INFO]
------------------------------------------------------------------------ Esperando a que Jenkins finalice de recopilar datos [JENKINS] Archiving C:\Users\xxxxxxx\.jenkins\workspace\JenkinsDemo\pom.xml to JenkinsDemo/JenkinsDemo/0.0.1-SNAPSHOT/JenkinsDemo-0.0.1-SNAPSHOT.pom [JENKINS] Archiving C:\Users\xxxxxxx\.jenkins\workspace\JenkinsDemo\target\JenkinsDemo-0.0.1-SNAPSHOT.jar to JenkinsDemo/JenkinsDemo/0.0.1-SNAPSHOT/JenkinsDemo-0.0.1-SNAPSHOT.jar channel stopped [JenkinsDemo] $ cmd /c call C:\Users\xxxxxxx\AppData\Local\Temp\jenkins13221465416928573076.bat
C:\Users\xxxxxxx\.jenkins\workspace\JenkinsDemo>javac EnviarPruebaDeIngles.java error: file not found: EnviarPruebaDeIngles.java Usage: javac <options> <source files> use
--help for a list of possible options
C:\Users\xxxxxxx\.jenkins\workspace\JenkinsDemo>java EnviarPruebaDeIngles Error: Could not find or load main class EnviarPruebaDeIngles Caused by: java.lang.ClassNotFoundException: EnviarPruebaDeIngles
C:\Users\xxxxxxx\.jenkins\workspace\JenkinsDemo>exit 1 Build step 'Execute Windows batch command' marked build as failure Finished: FAILURE
Project configuration is:
Our eclipse with selenium project tree, our intention is to execute like the main classes which are going to be located at com.jenkins.demo

Failed to execute goal org.apache.maven.plugins:maven-war-plugin:3.2.3:war (default-war) on project hapi-fhir-jpaserver-starter

So I'm getting this error when trying to Clean Install with Maven on a VPS Ubuntu Server.
I've installed the necessary items to make it but still to no avail.
root#iHRS:~/hapi-fhir-jpaserver-starter# mvn clean install
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.inject.internal.cglib.core.$ReflectUtils$1 (file:/usr/share/maven/lib/guice.jar) to method
java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of com.google.inject.internal.cglib.core.$ReflectUtils$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
[INFO] Scanning for projects...
[WARNING] The project ca.uhn.hapi.fhir:hapi-fhir-jpaserver-starter:war:5.1.0 uses prerequisites which is only intended for maven-plugin projects but not for non maven-plugin projects. For such purposes you should use the maven-enforcer-plugin. See https://maven.apache.org/enforcer/enforcer-rules/requireMavenVersion.html
[INFO]
[INFO] ------------< ca.uhn.hapi.fhir:hapi-fhir-jpaserver-starter >------------
[INFO] Building HAPI FHIR JPA Server - Starter Project 5.1.0
[INFO] --------------------------------[ war ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) # hapi-fhir-jpaserver-starter ---
[INFO] Deleting /root/hapi-fhir-jpaserver-starter/target
[INFO]
[INFO] --- maven-enforcer-plugin:3.0.0-M2:enforce (enforce-maven) # hapi-fhir-jpaserver-starter ---
[INFO]
[INFO] --- jacoco-maven-plugin:0.8.5:prepare-agent (default-prepare-agent) # hapi-fhir-jpaserver-starter ---
> [INFO] argLine set to
> -javaagent:/root/.m2/repository/org/jacoco/org.jacoco.agent/0.8.5/org.jacoco.agent-0.8.5-runtime.jar=destfile=/root/hapi-fhir-jpaserver-starter/target/jacoco.exec,excludes=ca/uhn/fhir/model/dstu2/**/*.class:ca/uhn/fhir/jpa/rp/r5/*.class:ca/uhn/fhir/jpa/rp/r4/*.class:ca/uhn/fhir/jpa/rp/dstu3/*.class:ca/uhn/fhir/jpa/rp/dstu2/*.class,dumponexit=true
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # hapi-fhir-jpaserver-starter ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 3 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) # hapi-fhir-jpaserver-starter ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 11 source files to /root/hapi-fhir-jpaserver-starter/target/classes
[WARNING] Unable to autodetect 'javac' path, using 'javac' from the environment.
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # hapi-fhir-jpaserver-starter ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /root/hapi-fhir-jpaserver-starter/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) # hapi-fhir-jpaserver-starter ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 7 source files to /root/hapi-fhir-jpaserver-starter/target/test-classes
[WARNING] Unable to autodetect 'javac' path, using 'javac' from the environment.
[INFO]
[INFO] --- maven-surefire-plugin:3.0.0-M3:test (default-test) # hapi-fhir-jpaserver-starter ---
[INFO]
[INFO] --- maven-war-plugin:3.2.3:war (default-war) # hapi-fhir-jpaserver-starter ---
[INFO] Packaging webapp
[INFO] Assembling webapp [hapi-fhir-jpaserver-starter] in [/root/hapi-fhir-jpaserver-starter/target/hapi]
[INFO] Processing war project
[INFO] Copying webapp resources [/root/hapi-fhir-jpaserver-starter/src/main/webapp]
[INFO] Processing overlay [ id ca.uhn.hapi.fhir:hapi-fhir-testpage-overlay]
[INFO] Webapp assembled in [990 msecs]
[INFO] Building war: /root/hapi-fhir-jpaserver-starter/target/hapi.war
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-war-plugin:3.2.3:war (default-war) on project hapi-fhir-jpaserver-starter: Error assembling WAR: Problem creating war: Execution exception: Java heap space -> [Help 1]
So I'm trying to setup iHRS since yesterday please I need help
The problem lies in this log message (see last line!)
Error assembling WAR: Problem creating war: Execution exception: Java heap space
Before triggering the build via mvn clean install, issue the following command in the same shell/terminal:
export MAVEN_OPTS="-Xmx2048m -XX:MaxPermSize=128m"
It will allow Maven to use more RAM - here up to 2048 MB - during the build phase(s). If it does not work, you can increase this value even further to see if the build passes. Keep in mind that your machine/workstation has needs that amount of free, physical RAM. Otherwise, the build will obviously: fail again.

IntelliJ IDEA Maven project StackOverflowError when running debug configuration

When I run mvn compile exec:exec, everything works fine, but when I click the debug button for the same configuration, it gives me the following error:
/home/miika/.jdks/openjdk-14.0.1/bin/java -Dmaven.multiModuleProjectDirectory=/home/miika/IdeaProjects/jetfuel -Dmaven.home=/opt/IntelliJ-IDEA/plugins/maven/lib/maven3 -Dclassworlds.conf=/opt/IntelliJ-IDEA/plugins/maven/lib/maven3/bin/m2.conf -Dmaven.ext.class.path=/opt/IntelliJ-IDEA/plugins/maven/lib/maven-event-listener.jar -Dfile.encoding=UTF-8 -classpath /opt/IntelliJ-IDEA/plugins/maven/lib/maven3/boot/plexus-classworlds.license:/opt/IntelliJ-IDEA/plugins/maven/lib/maven3/boot/plexus-classworlds-2.6.0.jar org.codehaus.classworlds.Launcher -Didea.version2020.1.2 compile exec:exec "-Dexec.args=-classpath %classpath:/opt/IntelliJ-IDEA/lib/idea_rt.jar -agentlib:jdwp=transport=dt_socket,address=40913,suspend=y,server=y -javaagent:/opt/IntelliJ-IDEA/plugins/java/lib/rt/debugger-agent.jar ${exec.args}"
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------< com.discape:jetfuel >-------------------------
[INFO] Building Jetfuel 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # jetfuel ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 7 resources
[INFO] Copying 0 resource
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) # jetfuel ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- exec-maven-plugin:1.6.0:exec (default-cli) # jetfuel ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.037 s
[INFO] Finished at: 2020-06-26T17:05:50+03:00
[INFO] ------------------------------------------------------------------------
---------------------------------------------------
constituent[0]: file:/opt/IntelliJ-IDEA/plugins/maven/lib/maven3/conf/logging/
constituent[1]: file:/opt/IntelliJ-IDEA/plugins/maven/lib/maven3/lib/plexus-utils-3.2.1.jar
constituent[2]: file:/opt/IntelliJ-IDEA/plugins/maven/lib/maven3/lib/jsoup-1.12.1.jar
constituent[3]: file:/opt/IntelliJ-IDEA/plugins/maven/lib/maven3/lib/maven-resolver-transport-wagon-1.4.1.jar
constituent[4]: file:/opt/IntelliJ-IDEA/plugins/maven/lib/maven3/lib/maven-resolver-provider-3.6.3.jar
constituent[5]: file:/opt/IntelliJ-IDEA/plugins/maven/lib/maven3/lib/maven-core-3.6.3.jar
constituent[6]: file:/opt/IntelliJ-IDEA/plugins/maven/lib/maven3/lib/maven-compat-3.6.3.jar
constituent[7]: file:/opt/IntelliJ-IDEA/plugins/maven/lib/maven3/lib/maven-resolver-spi-1.4.1.jar
constituent[8]: file:/opt/IntelliJ-IDEA/plugins/maven/lib/maven3/lib/maven-resolver-connector-basic-1.4.1.jar
constituent[9]: file:/opt/IntelliJ-IDEA/plugins/maven/lib/maven3/lib/commons-lang3-3.8.1.jar
constituent[10]: file:/opt/IntelliJ-IDEA/plugins/maven/lib/maven3/lib/maven-model-builder-3.6.3.jar
constituent[11]: file:/opt/IntelliJ-IDEA/plugins/maven/lib/maven3/lib/plexus-sec-dispatcher-1.4.jar
constituent[12]: file:/opt/IntelliJ-IDEA/plugins/maven/lib/maven3/lib/maven-artifact-3.6.3.jar
constituent[13]: file:/opt/IntelliJ-IDEA/plugins/maven/lib/maven3/lib/jsr250-api-1.0.jar
constituent[14]: file:/opt/IntelliJ-IDEA/plugins/maven/lib/maven3/lib/wagon-http-3.3.4-shaded.jar
constituent[15]: file:/opt/IntelliJ-IDEA/plugins/maven/lib/maven3/lib/commons-cli-1.4.jar
constituent[16]: file:/opt/IntelliJ-IDEA/plugins/maven/lib/maven3/lib/maven-builder-support-3.6.3.jar
constituent[17]: file:/opt/IntelliJ-IDEA/plugins/maven/lib/maven3/lib/plexus-component-annotations-2.1.0.jar
constituent[18]: file:/opt/IntelliJ-IDEA/plugins/maven/lib/maven3/lib/cdi-api-1.0.jar
constituent[19]: file:/opt/IntelliJ-IDEA/plugins/maven/lib/maven3/lib/maven-resolver-impl-1.4.1.jar
constituent[20]: file:/opt/IntelliJ-IDEA/plugins/maven/lib/maven3/lib/wagon-provider-api-3.3.4.jar
constituent[21]: file:/opt/IntelliJ-IDEA/plugins/maven/lib/maven3/lib/maven-resolver-api-1.4.1.jar
constituent[22]: file:/opt/IntelliJ-IDEA/plugins/maven/lib/maven3/lib/maven-resolver-util-1.4.1.jar
constituent[23]: file:/opt/IntelliJ-IDEA/plugins/maven/lib/maven3/lib/commons-io-2.5.jar
constituent[24]: file:/opt/IntelliJ-IDEA/plugins/maven/lib/maven3/lib/maven-repository-metadata-3.6.3.jar
constituent[25]: file:/opt/IntelliJ-IDEA/plugins/maven/lib/maven3/lib/slf4j-api-1.7.29.jar
constituent[26]: file:/opt/IntelliJ-IDEA/plugins/maven/lib/maven3/lib/org.eclipse.sisu.inject-0.3.4.jar
constituent[27]: file:/opt/IntelliJ-IDEA/plugins/maven/lib/maven3/lib/maven-plugin-api-3.6.3.jar
constituent[28]: file:/opt/IntelliJ-IDEA/plugins/maven/lib/maven3/lib/maven-model-3.6.3.jar
constituent[29]: file:/opt/IntelliJ-IDEA/plugins/maven/lib/maven3/lib/maven-settings-builder-3.6.3.jar
constituent[30]: file:/opt/IntelliJ-IDEA/plugins/maven/lib/maven3/lib/jcl-over-slf4j-1.7.29.jar
constituent[31]: file:/opt/IntelliJ-IDEA/plugins/maven/lib/maven3/lib/wagon-file-3.3.4.jar
constituent[32]: file:/opt/IntelliJ-IDEA/plugins/maven/lib/maven3/lib/maven-embedder-3.6.3.jar
constituent[33]: file:/opt/IntelliJ-IDEA/plugins/maven/lib/maven3/lib/maven-shared-utils-3.2.1.jar
constituent[34]: file:/opt/IntelliJ-IDEA/plugins/maven/lib/maven3/lib/javax.inject-1.jar
constituent[35]: file:/opt/IntelliJ-IDEA/plugins/maven/lib/maven3/lib/org.eclipse.sisu.plexus-0.3.4.jar
constituent[36]: file:/opt/IntelliJ-IDEA/plugins/maven/lib/maven3/lib/plexus-interpolation-1.25.jar
constituent[37]: file:/opt/IntelliJ-IDEA/plugins/maven/lib/maven3/lib/maven-slf4j-provider-3.6.3.jar
constituent[38]: file:/opt/IntelliJ-IDEA/plugins/maven/lib/maven3/lib/guava-25.1-android.jar
constituent[39]: file:/opt/IntelliJ-IDEA/plugins/maven/lib/maven3/lib/plexus-cipher-1.7.jar
constituent[40]: file:/opt/IntelliJ-IDEA/plugins/maven/lib/maven3/lib/guice-4.2.1-no_aop.jar
constituent[41]: file:/opt/IntelliJ-IDEA/plugins/maven/lib/maven3/lib/maven-settings-3.6.3.jar
constituent[42]: file:/opt/IntelliJ-IDEA/plugins/maven/lib/maven3/lib/jansi-1.17.1.jar
---------------------------------------------------
Exception in thread "main" java.lang.StackOverflowError
at org.apache.maven.plugin.PluginParameterExpressionEvaluator.stripTokens(PluginParameterExpressionEvaluator.java:453)
at org.apache.maven.plugin.PluginParameterExpressionEvaluator.evaluate(PluginParameterExpressionEvaluator.java:160)
at org.apache.maven.plugin.PluginParameterExpressionEvaluator.evaluate(PluginParameterExpressionEvaluator.java:145)
at org.apache.maven.plugin.PluginParameterExpressionEvaluator.evaluate(PluginParameterExpressionEvaluator.java:428)
^ the end repeats for ~1020 lines
here's my pom.xml if anyone needs it:
https://raw.githubusercontent.com/discapes/jetfuel/v1.1/pom.xml
I am trying to debug to find out which thread is preventing my application from closing.
It is known issue, please vote for IDEA-203018.
I think you put the breakpoint on the method.Click to ctrl+shift+f8 list breakpoint,
and remove breakpoints on methods
made maven configuration compile exec:exec "-Dexec.args=-classpath %classpath -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=1044 com.me.myapp.myclass", and added remote configuration. Launched maven cfg, then remote cfg

Why is Heroku attempting to run newrelic-agent.jar instead of my app?

My app was working, it's working in staging, but after pushing that build to production, Heroku is running this command:
java -Dserver.port=12366 -javaagent:target/newrelic-agent.jar -jar target/newrelic-agent.jar
Why is Heroku trying to run newrelic-agent.jar instead of my app's jar?
My build log looks like this:
-----> Java app detected
-----> Installing JDK 1.8... done
-----> Installing Maven 3.3.9... done
-----> Executing: mvn -DskipTests clean dependency:list install
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building projectxserver 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[WARNING] The artifact org.hibernate:hibernate-validator:jar:6.0.9.Final has been relocated to org.hibernate.validator:hibernate-validator:jar:6.0.9.Final
[INFO]
[INFO] --- maven-clean-plugin:3.0.0:clean (default-clean) # projectxserver ---
[INFO]
[INFO] --- maven-dependency-plugin:3.0.2:list (default-cli) # projectxserver ---
[INFO]
[INFO] --- maven-resources-plugin:3.0.1:resources (default-resources) # projectxserver ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 11 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.7.0:compile (default-compile) # projectxserver ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 54 source files to /tmp/build_b35db9c210bc86f2ba9870e2cd5d9474/target/classes
[INFO] /tmp/build_b35db9c210bc86f2ba9870e2cd5d9474/src/main/java/tech/projectx/server/models/support/JacksonUtil.java: /tmp/build_b35db9c210bc86f2ba9870e2cd5d9474/src/main/java/tech/projectx/server/models/support/JacksonUtil.java uses unchecked or unsafe operations.
[INFO] /tmp/build_b35db9c210bc86f2ba9870e2cd5d9474/src/main/java/tech/projectx/server/models/support/JacksonUtil.java: Recompile with -Xlint:unchecked for details.
[INFO]
[INFO] --- maven-resources-plugin:3.0.1:testResources (default-testResources) # projectxserver ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.7.0:testCompile (default-testCompile) # projectxserver ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to /tmp/build_b35db9c210bc86f2ba9870e2cd5d9474/target/test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.21.0:test (default-test) # projectxserver ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- maven-jar-plugin:3.0.2:jar (default-jar) # projectxserver ---
[INFO] Building jar: /tmp/build_b35db9c210bc86f2ba9870e2cd5d9474/target/projectxserver-1.0.0-SNAPSHOT.jar
[INFO]
[INFO] --- spring-boot-maven-plugin:2.0.1.RELEASE:repackage (default) # projectxserver ---
[INFO]
[INFO] --- maven-dependency-plugin:3.0.2:copy (copy-new-relic-jar) # projectxserver ---
[INFO] Configured Artifact: com.newrelic.agent.java:newrelic-agent:?:jar
[INFO] Copying newrelic-agent-4.0.0.jar to /tmp/build_b35db9c210bc86f2ba9870e2cd5d9474/target/newrelic-agent.jar
[INFO]
[INFO] --- maven-install-plugin:2.5.2:install (default-install) # projectxserver ---
[INFO] Installing /tmp/build_b35db9c210bc86f2ba9870e2cd5d9474/target/projectxserver-1.0.0-SNAPSHOT.jar to /app/tmp/cache/.m2/repository/tech/projectx/projectxserver/1.0.0-SNAPSHOT/projectxserver-1.0.0-SNAPSHOT.jar
[INFO] Installing /tmp/build_b35db9c210bc86f2ba9870e2cd5d9474/pom.xml to /app/tmp/cache/.m2/repository/tech/projectx/projectxserver/1.0.0-SNAPSHOT/projectxserver-1.0.0-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 17.850 s
[INFO] Finished at: 2018-05-08T19:10:25+00:00
[INFO] Final Memory: 61M/410M
[INFO] ------------------------------------------------------------------------
-----> Discovering process types
Procfile declares types -> (none)
Default types for buildpack -> web
-----> Compressing...
Done: 190.1M
-----> Launching...
Released v46
https://projectxserver-production.herokuapp.com/ deployed to Heroku
After re-deploying a few times, it started using the correct jar. Is Heroku picking up a random one?
Heroku tries to automatically figure out the command to run your app when it detects that you are using Spring Boot. However, since the new-relic JAR is in your target/ directory, it thinks that it is your app.
You can fix this in two ways:
Put the new-relic jar in a different directory (Heroku recommends target/dependency or similar).
Create a Procfile and explicitly tell Heroku the command needed to run your app.
If you create a Procfile it will probably look like this:
web: java -Dserver.port=$PORT -javaagent:target/newrelic-agent.jar -jar target/projectxserver-1.0.0-SNAPSHOT.jar
Then run:
git add Procfile
git commit -m "Procfile"
git push heroku master
You can see the logic for the default command in the Java buildpack's bin/release script.

Spring Roo 2.0.0M2 sample script home page & tomcat issues

I'm testing the sample script at Spring Roo 2.0.0M2 released. The script generates well, but when issueing mvn tomcat:run it breaks.
In the end there is no local website.
How to solve this to get the project running?
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building foo 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> tomcat-maven-plugin:1.1:run (default-cli) > compile # foo >>>
[INFO]
[INFO] --- apt-maven-plugin:1.1.3:process (default) # foo ---
[INFO]
[INFO] --- aspectj-maven-plugin:1.8:compile (default) # foo ---
[INFO] Showing AJC message detail for messages of types: [error, warning, fail]
[WARNING] incorrect classpath: D:\Tools\maven_repo\org\springframework\roo\org.springframework.roo.annotations\2.0.0.M2\org.springframework.roo.annotations-2.0.0.M2.pom
<unknown source file>:<no line information>
[INFO]
[INFO] --- aspectj-maven-plugin:1.8:test-compile (default) # foo ---
[WARNING] No sources found skipping aspectJ compile
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # foo ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 62 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # foo ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] <<< tomcat-maven-plugin:1.1:run (default-cli) < compile # foo <<<
[INFO]
[INFO] --- tomcat-maven-plugin:1.1:run (default-cli) # foo ---
[INFO] Skipping non-war project
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.312 s
[INFO] Finished at: 2016-05-27T12:54:41+02:00
[INFO] Final Memory: 43M/602M
[INFO] ------------------------------------------------------------------------
Remember that Spring Roo 2.x generates Spring Boot applications. It includes some starters on your pom.xml file that provides you an embedded tomcat server. Also, your generated project includes the spring-boot-maven-plugin that allows you to run your application executing the following maven command:
mvn clean compile spring-boot:run
For more information about Spring Boot project read the official documentation
Hope this helps,

Categories