Maven GAE Plugin - Unable to run gae:debug - java

I'm having trouble running the gae:debug goal of the Maven GAE Plugin. The error I'm receiving is below. Any ideas?
I'm running it with "mvn gae:debug".
[INFO] Packaging webapp
[INFO] Assembling webapp[test-gae] in [C:\development\test-gae\target\test-gae-0.0.1-SNAPSHOT]
[INFO] Processing war project
[INFO] Webapp assembled in[56 msecs]
[INFO] Building war: C:\development\test-gae\target\test-gae-0.0.1-SNAPSHOT.war
[INFO] [statemgmt:end-fork]
[INFO] Ending forked execution [fork id: -2101914270]
[INFO] [gae:debug]
Usage: <dev-appserver> [options] <war directory>
Options:
--help, -h Show this help message and exit.
--server=SERVER The server to use to determine the latest
-s SERVER SDK version.
--address=ADDRESS The address of the interface on the local machine
-a ADDRESS to bind to (or 0.0.0.0 for all interfaces).
--port=PORT The port number to bind to on the local machine.
-p PORT
--sdk_root=root Overrides where the SDK is located.
--disable_update_check Disable the check for newer SDK versions.
EDIT: gae:run with the jvmFlags option is also giving me the same result with the below configuration.
<plugin>
<groupId>net.kindleit</groupId>
<artifactId>maven-gae-plugin</artifactId>
<version>0.5.0</version>
<configuration>
<jvmFlags>
<jvmFlag>-Xdebug</jvmFlag>
<jvmFlag>-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000</jvmFlag>
</jvmFlags>
</configuration>
</plugin>

It looks like this is an open issue. I have submitted a patch for this (see Issue 38).

Related

Another Maven "Source option 6 is no longer supported. Use 7 or later."

I see lots of answers to this question but they don't work for me. I installed Visual Studio Code, latest version of Java and Maven on my PC and I was able to successfully build my application with Maven on the PC. I then went through the same steps on my Mac and I get this error.
Fresh versions of Macos, Visual Studio Code, Maven and Java. Like all the others have said, I added these lines to the properties section of my pom.xml file:
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
Still get the same error. Here is the relevant output from the mvn build:
alberts-mbp:com.versabuilt.rushmore.process albertyoungwerth$ mvn package
[INFO] Scanning for projects...
[INFO]
[INFO] ---------< com.versabuilt.rushmore.process:VersaBuiltProcess >----------
[INFO] Building VersaBuilt Process 0.2.18
[INFO] -------------------------------[ bundle ]-------------------------------
[INFO]
[INFO] --- maven-resources-plugin:3.0.2:resources (default-resources) # VersaBuiltProcess ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 5 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.6.0:compile (default-compile) # VersaBuiltProcess ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 10 source files to /Users/albertyoungwerth/rushmore/com.versabuilt.rushmore.process/target/classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] Source option 6 is no longer supported. Use 7 or later.
[ERROR] Target option 6 is no longer supported. Use 7 or later.
[INFO] 2 errors
I have also restarted Visual Studio Code to no avail.
The last build system I used was called make, so it's been a while since I debugged a build process. I don't remember make dumping 62Kb of debug output either...
Anywho, searching for the keyword "source" (clue being that was one of the tags I was supposed to add) got me to this in the maven debug output:
[DEBUG] (f) source = 1.6
Ahaaa! the source compiler version had not changed like I asked it to with the edit in my original question! I'll bet the maven folks changed the location of the xml tag! Sure enough, searching for 1.6 in the pom.xml file I find this:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.0</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
I changed the source and target tag values to 1.8 and it worked! I also tried deleting the source and target tags in the build plugins scope and left in the maven.compiler.source/target values set to 1.8 and that also worked.
So moral of the story, be careful of extra source or target tags in your pom.xml file!
Actually, I too faced the above error message, after adding this to property file, Error got resolved. :)
property need to be added in pom.xml
<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>
I corrected this problem by matching the jdk between my IDE and the pom.xml file.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
Sometimes changing from Kotlin to java or inverted.
You can also change or java version to a higher one.
At least that worked for me.
Changing maven compiler version in pom file solved my issue.
<maven.compiler.source>11</maven.compiler.source> <maven.compiler.target>11</maven.compiler.target>
go to your project properties and go to sources.
then in Source/binary format it will be JDK 5 or 6 etc.
but click and make it the higher version.
you are done.:)

Not able to upload artifacts to Nexus from the same machine using mvn clean deploy, works fine from my local Windows 10 machine

Java 11
I have a very basic Spring Boot application that I would like to build and deploy the artifacts on a Nexus sever.
mvn clean deploy (from my local Win 10 machine - WORKS !!!)
mvn clean deploy (from Nexus machine - FAILS ????)
mvn clean deploy (from Jenkins - FAILS ????)
When I run mvn clean deploy command from my local Win 10 machine all the artifacts get deployed successfully on remote Nexus server and I can even see and browse them.
But when I clone the project and run mvn clean deploy on the very same machine where both Nexus and Jenkins (Ubuntu box) are installed it gives me Not authorized error.
I have already copied over BOTH settings.xml and settings-security.xml from my local Windows machine to Ubuntu (~/.m2) where Nexus is installed.
I have disabled the firewalls as well just to be sure that no ports are blocked.
I am confused how the artifacts are getting copied over from a remote machine but not from the same machine.
pom.xml
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<addResources>true</addResources>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>3.0.0-M1</version>
</plugin>
</plugins>
</build>
<distributionManagement>
<snapshotRepository>
<id>my-maven-snapshots</id>
<url>http://my-nexus-server/nexus/repository/maven-snapshots/</url>
</snapshotRepository>
<repository>
<id>my-maven-releases</id>
<url>http://my-nexus-server/nexus/repository/maven-releases/</url>
</repository>
</distributionManagement>
<scm>
<connection>scm:git:https://johndoe#bitbucket.org/johndoe/todo.git</connection>
<url>https://johndoe#bitbucket.org/johndoe/todo</url>
<developerConnection>scm:git:https://johndoe#bitbucket.org/johndoe/todo.git</developerConnection>
<tag>HEAD</tag>
</scm>
Error (Nexus is installed on this machine):
[INFO] --- maven-install-plugin:2.5.2:install (default-install) # todo ---
[INFO] Installing /home/admin/cloned-apps/todo/pom.xml to /home/admin/.m2/repository/com/example/todo/0.0.2-SNAPSHOT/todo-0.0.2-SNAPSHOT.pom
[INFO]
[INFO] --- maven-deploy-plugin:2.8.2:deploy (default-deploy) # todo ---
Downloading from my-maven-snapshots: http://my-nexus-server/nexus/repository/maven-snapshots/com/example/todo/0.0.2-SNAPSHOT/maven-metadata.xml
[WARNING] Could not transfer metadata com.example:todo:0.0.2-SNAPSHOT/maven-metadata.xml from/to my-maven-snapshots (http://my-nexus-server/nexus/repository/maven-snapshots/): Not authorized , ReasonPhrase:Unauthorized.
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for todo 0.0.2-SNAPSHOT:
[INFO]
[INFO] todo ............................................... FAILURE [ 4.622 s]
[INFO] todo-webapp ........................................ SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.973 s
[INFO] Finished at: 2020-04-16T02:39:48Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy (default-deploy) on project todo: Failed to retrieve remote metadata com.example:todo:0.0.2-SNAPSHOT /maven-metadata.xml: Could not transfer metadata com.example:todo:0.0.2-SNAPSHOT/maven-metadata.xml from/to my-maven-snapshots (http://my-nexus-server/nexus/repository/maven-snapshots/ ): Not authorized , ReasonPhrase:Unauthorized. -> [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
mvn clean deploy (from Nexus machine - FAILS ????)
Are you sure you're running mvn clean deploy from the same user under whose $HOME/.m2 directory you've copied the settings.xml and settings-security.xml files?
Also, did you try adding the password directly to settings.xml to rule out issues (if any) with settings-security.xml?
P.S: Avoid running mvn commands with sudo privilege.

Heroku unable to detect java 11

I am trying to deploy a java jar to heroku with heroku maven plugin.
I am using java 11 so I have added system.properties in the root folder(where pom.xml is present) and set java.runtime.version=11. However it doesn't seem to be working !
My plugin :
<plugin>
<groupId>com.heroku.sdk</groupId>
<artifactId>heroku-maven-plugin</artifactId>
<version>3.0.1</version>
<configuration>
<includeTarget>false</includeTarget>
<includes>
<include>${project.build.directory}/${project.build.finalName}.jar</include>
</includes>
<processTypes>
<web>java $JAVA_OPTS -jar ${project.build.directory}/${project.build.finalName}.jar</web>
</processTypes>
</configuration>
</plugin>
When I do git push heroku master it starts build process using jdk 8.
remote: Building source:
remote:
remote: -----> Java app detected
remote: -----> Installing JDK 1.8... done
remote: -----> Installing Maven 3.6.2... done
remote: -----> Executing Maven
remote: $ mvn -DskipTests clean dependency:list install
Eventually build fails with error :
Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile (default-compile) on project ImpactHub_bot: Fatal error compiling: invalid flag: --release ->
How do I set jdk verison to 11 ? I have also tried adding ${java.version} to configuration but it didn't help
That's exactly how you are specifying the Java version, see: https://devcenter.heroku.com/articles/java-support#specifying-a-java-version
You can specify a Java version by adding a file called
system.properties to your application.
Set a property java.runtime.version in the file:
java.runtime.version=11
I used it in my project as well and it is working.
Make sure your system.properties is saved as All Files. Furthermore it should be at the root folder of your git repo.
It might have a .txt ending. If that fails open a Support Ticket with Heroku.

Maven Clover Instrumentation error - unexpected token

We’re building Java servlet apps using eclipse and maven which run in the Google Cloud Platform.
We are starting to look at integrating OpenClover into our builds to provide test coverage and code complexity statistics.
Some of our apps have dependencies on Google libraries, such as com.google.cloud.spanner.Statement.Builder.
When we try and run clover from the command line against these servlets we see the following errors:
[INFO] Building auditio 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # auditio ---
[INFO]
[INFO] --- clover-maven-plugin:4.3.0:setup (default-cli) # auditio ---
[INFO] OpenClover Version 4.3.0, built on August 03 2018 (build-1010)
[INFO] Creating new database at 'C:\.......\service\auditio\target\clover\clover.db'.
[INFO] Processing files at 1.8 source level.
[INFO] C:\...........\service\auditio\AuditIoSpanner.java:54:5:unexp
ected token: builder
[INFO] Instrumentation error
com.atlassian.clover.api.CloverException: C:\...............\service\auditio\src\main\java\com\mandm\service\aud
itio\AuditIoSpanner.java:54:5:unexpected token: builder
at com.atlassian.clover.instr.java.Instrumenter.instrument(Instrumenter.java:159)
at com.atlassian.clover.CloverInstr.execute(CloverInstr.java:76)
at com.atlassian.clover.CloverInstr.mainImpl(CloverInstr.java:54)
[ERROR] Failed to execute goal org.openclover:clover-maven-plugin:4.3.0:setup (default-cli) on project auditio: Clover has fa
iled to instrument the source files in the [C:\........service\auditio\target\clover\src-instrumented] d
irectory -> [Help 1]
This is when running the following command:
mvn clean clover:setup test clover:aggregate clover:clover check
With the following in our pom.xml
<plugin>
<groupId>org.openclover</groupId>
<artifactId>clover-maven-plugin</artifactId>
<version>4.3.0</version>
<configuration>
<targetPercentage>75%</targetPercentage>
</configuration>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>instrument</goal>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
We’re running JDK 1.8.
While we can exclude the offending class files that contain these references to get the clover coverage to work, that isn’t ideal.
Servlets that do not have these specific references will run clover just fine.
Can anyone advise why this might be occurring and if there is a known resolution?
Thanks in advance.
After reaching out to OpenClover support they have confirmed that this is caused by a bug in their latest (4.3.0) release as can be seen here - https://bitbucket.org/openclover/clover/issues/72
- and will be resolved in a patch.

Error 404 while deploying to Tomcat with Tomcat7 MVN plugin

I'm trying to deploy my project to Tomcat using Tomcat MVN plugin but I get the following error:
Uploading: http://localhost:8080/manager/text/deploy?path=%2FSample
Uploaded: http://localhost:8080/manager/text/deploy?path=%2FSample (90810 KB at 62283.7 KB/sec)
[ERROR] Tomcat return http status error: 404, Reason Phrase: Not Found
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
The plugin configuration in the pom
<build>
<plugins>
.
.
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
</plugin>
.
.
.
I have no Tomcat users set in the pom because in my Tomcat configuration I don't have any users and need to kept it that way.
When I manually copy the war into the tomcat folder "webapps" it deploy with no issue.
I don't know what is missing... and I have try the followings with no result
Error while deploying to Tomcat: tomcatManager status code:404, ReasonPhrase:Not Found
tomcatManager status code:404, ReasonPhrase:Not Found
Ok after a lot of research I found a way to deploy my project with Tomcat7 Maven Plugin.
It's as simple as running the goal mvn tomcat7:run-war
The only downside is that it use it own embedded Tomcat server
I leave the documentation here

Categories