Maven 3.1.0 breaks Google App Engine Maven Plugin - java

Looks likes Google App Engine plugin is broken with new maven 3.1.0 release. When I am trying to run development server, I am getting exception
Caused by: java.lang.ClassNotFoundException: org.sonatype.aether.RepositorySystem
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:244)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:230)
... 57 more
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
My maven version is
Apache Maven 3.1.0 (893ca28a1da9d5f51ac03827af98bb730128f9f2; 2013-06-28 05:15:32+0300)
Maven home: C:\Program Files\Maven\apache-maven-3.1.0
Java version: 1.7.0_25, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.7.0_25\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"
There is a conluence page about this problem on Apache site http://cwiki.apache.org/confluence/display/MAVEN/AetherClassNotFound

If you need to use the plug-in with Maven 3.1.0 then you can use the latest 1.8.3-SNAPSHOT version (from the Sonatype repository, see below) which has this problem fixed.
<plugin>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>1.8.3-SNAPSHOT</version>
</plugin>
<pluginRepository>
<id>sonatype-nexus-snapshots</id>
<name>Sonatype Nexus Snapshots</name>
<url>https://oss.sonatype.org/content/repositories/google-snapshots/</url>
</pluginRepository>

See also this question:
Move to version 3.8.0 of the android-maven-plugin, it solves the issue.

I had the same problem, but moving back to Maven 3.0.5 solved the problem

Related

Maven Build Error: java.security.InvalidAlgorithmParameterException

I am doing a maven build, but it gets an error related to one of the dependencies. If I (and other developers) build this on our local machines or on other linux servers, it builds with no problems. However, on one particular linux server, it gets the following error when building.
mvn clean install DskipTests=true -U
maven Build Error:
[ERROR] Failed to execute goal on project corporateInterface: Could
not resolve dependencies for project
com.travellinck:corporateInterface:war:3.10: Failed to collect
dependencies at
com.github.Cloudmersive:Cloudmersive.APIClient.Java:jar:v3.62: Failed
to read artifact descriptor for
com.github.Cloudmersive:Cloudmersive.APIClient.Java:jar:v3.62: Could
not transfer artifact
com.github.Cloudmersive:Cloudmersive.APIClient.Java:pom:v3.62 from/to
jitpack.io (https://jitpack.io): Transfer failed for
https://jitpack.io/com/github/Cloudmersive/Cloudmersive.APIClient.Java/v3.62/Cloudmersive.APIClient.Java-v3.62.pom:
java.lang.RuntimeException: Unexpected error:
java.security.InvalidAlgorithmParameterException: the trustAnchors
parameter must be non-empty -> [Help 1] [ERROR]
So I think there must be something different on this server that is causing the dependency error. Any ideas please?
I see it gets a java.security.InvalidAlgorithmParameterException, so this suggests that there is probably some restriction configured on the server that is preventing the dependency being downloaded to the server.
More info:
pom.xml
<dependency>
<groupId>com.github.Cloudmersive</groupId>
<artifactId>Cloudmersive.APIClient.Java</artifactId>
<version>v3.62</version>
<exclusions>
<exclusion>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</exclusion>
</exclusions>
</dependency>
Maven version on linux server with the error:
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f) Maven
home: /home/jboss/.sdkman/candidates/maven/current Java version:
1.7.0_95, vendor: Oracle Corporation, runtime: /usr/java/java-7-openjdk-amd64/jre Default locale: en_US, platform
encoding: ANSI_X3.4-1968 OS name: "linux", version:
"3.10.0-1160.15.2.el7.x86_64", arch: "amd64", family: "unix"
Maven version of linux server that has no error:
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f) Maven
home: /opt/apache-maven-3.6.3 Java version: 1.7.0_161, vendor: Oracle
Corporation, runtime:
/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.161-2.6.12.0.el7_4.x86_64/jre
Default locale: en_US, platform encoding: ANSI_X3.4-1968 OS name:
"linux", version: "3.10.0-957.21.3.el7.x86_64", arch: "amd64", family:
"unix"
Maven version on localhost that has no error:
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5;
2015-11-10T18:41:47+02:00) Maven home:
/Users/richardmarais/Development/java/Maven/apache-maven-3.3.9 Java
version: 1.7.0_80, vendor: Oracle Corporation Java home:
/Library/Java/JavaVirtualMachines/jdk1.7.0_80.jdk/Contents/Home/jre
Default locale: en_GB, platform encoding: UTF-8 OS name: "mac os x",
version: "10.16", arch: "x86_64", family: "mac"
I fixed this issue. The problem was the Java version. I temporally build with Java 8 (to download the Cloudmersive api), then switched back to Java 7. Build is successful.

mvn release:prepare do not commit and do detect local changes

I have two strange behavior with my mvn release:prepare
1/ It do not stop when there is local changes not committed even if it detect them !
[DEBUG] release.properties not found - using empty properties
[INFO] Verifying that there are no local modifications...
[INFO] ignoring changes on: **\pom.xml.next, **\release.properties, **\pom.xml.branch, **\pom.xml.tag, **\pom.xml.backup, **\pom.xml.releaseBackup
[INFO] Executing: cmd.exe /X /C "git rev-parse --show-toplevel"
[INFO] Working directory: D:\XX
[INFO] Executing: cmd.exe /X /C "git status --porcelain ."
[INFO] Working directory: D:\XX
[DEBUG] A testFab2
[DEBUG] ?? release.properties
[WARNING] Ignoring unrecognized line: ?? release.properties
[INFO] Checking dependencies and plugins for snapshots ...
What is the release version for "XX-parent"? (YY:XX-parent) 1.3.2: :
2/ It doesn't commit and push the modified pom.xml...
And more confusing, the normal behaviour occurs well on my colleague computer. We have the same configuration. Here some tech infos :
Git
git version 2.16.2
mvn --version
Apache Maven 3.5.3 (3383c37e1f9e9b3bc3df5050c29c8aff9f295297; 2018-02-24T20:49:05+01:00)
Maven home: D:\tools\apache-maven-3.5.3
Java version: 1.8.0_162, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.8.0_162\jre
Default locale: fr_FR, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"
plugin maven-release
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.3</version>
<configuration>
<goals>install</goals>
<tagNameFormat>#{project.version}</tagNameFormat>
<autoVersionSubmodules>true</autoVersionSubmodules>
<preparationGoals>verify</preparationGoals>
<arguments>-Dmaven.javadoc.skip=true -Dmaven.site.skip=true</arguments>
</configuration>
</plugin>
I hve tried downgrade the pluginlike in this post : mvn release:prepare not committing changes to pom.xml, but without success
If you have some ideas...
Thank you
Use maven command with PushChanges=false.

mvn build is failing for tigase-web-ui-2.0 final

We downloaded the pom.xml available at
https://projects.tigase.org/projects/sureim/repository/revisions/33b2a6f9cc27ced875f7e773f041ac381e2115b9
for
tigase-web-ui-2.0 final
and mvn build is failing
[ERROR] Failed to execute goal on project tigase-web-ui: Could not
resolve dependencies for project
tigase.sure.web:tigase-web-ui:war:2.0: Could not find artifact
tigase.sure.web:theme:jar:2.0.0 in gwt-mobile-webkit
(http://gwt-mobile-webkit.googlecode.com/svn/repo) -> [Help 1]
Where do we find the relevant war / jar files.
Our mvn version is
Apache Maven 3.3.3 (7994120775791599e205a5524ec3e0dfe41d4a06; 2015-04-22T17:27:37+05:30)
Maven home: D:\Spacers\Gurupgm\Apache-maven-3.3.3\bin..
Java version: 1.8.0_45, vendor: Oracle Corporation
Java home: D:\Spacers\Gurupgm\Java8\jre
Default locale: en_IN, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "amd64", family: "dos"
Thanks for your help.
Try downloading the jar manually from the link click
After downloading install into maven repository by using the below command
mvn install:install-file -DgroupId=tigase.sure.web
-DartifactId=vomsProxyInitGUI -Dversion=2.0 -Dpackaging=jar -Dfile=/home/tigase-web-ui-2.0.jar

Maven Throws ArrayIndexOutOfBoundsException

Maven throws error as posted below. I am trying to get a repository from remote to mine.
mvn package
Could not transfer metadata org.symplifier.adk:symplifier-
adk:1.0.3-SNAPSHOT/maven-metadata.xml from/to a-repository
(sftp://git.a.com.np/home/git/gitlab/public/repo/): Cannot connect. Reason: java.lang.ArrayIndexOutOfBoundsException: 0
[WARNING] Failure to transfer org.symplifier.adk:symplifier-`
adk:1.0.3-SNAPSHOT/maven-metadata.xml from sftp://git.a.com.np/home/git/gitlab/public/repo/ was cached in the local repository, resolution will not be reattempted
until the update interval of a-repository has elapsed or updates are forced. Original error: Could not transfer metadata org.symplifier.adk:symplifier-adk:1.0.3-SNAPSHOT/maven-metadata.xml from/to a-repository
(sftp://git.a.com.np/home/git/gitlab/public/repo/): Cannot connect. Reason: java.lang.ArrayIndexOutOfBoundsException: 0
My maven version is
mvn -version
Apache Maven 3.3.3 (7994120775791599e205a5524ec3e0dfe41d4a06;
2015-04-22T17:42:37+05:45)
Maven home: /usr/local/apache-maven
Java version: 1.8.0_45, vendor: Oracle Corporation
Java home: /usr/lib/jvm/jdk1.8.0_45/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.2.0-4-amd64", arch: "amd64", family: "unix"
Edit1:
I tried forcing maven to update all repositories with my pom.xml
<repositories>
<repository>
<id>a-repository</id>
<url>sftp://git.a.com.np/home/git/gitlab/public/repo/</url>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
<releases>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</releases>
</repository>
</repositories>
<dependency>
<groupId>org.symplifier.adk</groupId>
<artifactId>symplifier-adk</artifactId>
<version>1.0.3-SNAPSHOT</version>
</dependency>
Force update.
mvn -U package
Edit2:
Have tried deleting the pom.lastUpdated file as well. Also, deleting the repository and retrying.
One thing different is my machine's username and the username on the remote repository is different. But it should not matter as my public key is in the remote repo and that will be used for authentication.
More so, only one package is facing this error. Let me know what is wrong.
Update: This is the log file.
From your stack trace
...
Caused by: java.lang.ArrayIndexOutOfBoundsException: 0
at com.jcraft.jsch.IdentityFile.<init>(IdentityFile.java:367)
...
I'd venture the guess that you're using a public/private key setup to connect and Maven can't find the location of said key-file. Have a look at your settings.xml and see if it differs from your coworkers', eg.
<server>
<id>a-repository</id>
<username>sraddhanjali</username>
<privateKey>${user.home}/.ssh/id_dsa</privateKey>
...

Jersey 2.0 "Getting Started" guide, mainClass not found

Hi I am trying to follow the Getting Started guide for Jersey 2.0.
I did steps 1.1 and 1.2 as is. No problem there.
For step 1.3 I had a problem cause maven could not find the javax-annotation 1.2 but I solved it following the advice of another Stackoverflow user and added a repository to my pom.
Somvn clean test passes with no problems, BUT when I try to run mvn clean exec:java I get back
[WARNING] java.lang.ClassNotFoundException: com.example.Main
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:423)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:285)
at java.lang.Thread.run(Thread.java:722)
The pom.xml is the one created by the following command:
mvn archetype:generate -DarchetypeArtifactId=jersey-quickstart-grizzly2 \
-DarchetypeGroupId=org.glassfish.jersey.archetypes -DinteractiveMode=false \
-DgroupId=com.example -DartifactId=simple-service -Dpackage=com.example \
-DarchetypeVersion=2.0
where the only addition I 've made is the following:
<repositories>
<repository>
<id>java.net.repo</id>
<url>https://maven.java.net/content/groups/promoted/</url>
<layout>default</layout>
</repository>
</repositories>
In case it is of interest this is the output of mvn -version
Apache Maven 3.0.4 (r1232337; 2012-01-17 10:44:56+0200)
Maven home: /usr/share/maven
Java version: 1.7.0_21, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.7.0_21.jdk/Contents/Home/jre
Default locale: el_GR, platform encoding: UTF-8
OS name: "mac os x", version: "10.8.3", arch: "x86_64", family: "mac"
I am able to reproduce your error. This has nothing to do with Jersey; it's an error you're making with Maven. mvn clean exec:java says: "delete all the .class files and then try to run the Main .class file". Since you deleted it, Maven can't find it. Here's a solution:
mvn clean compile exec:java
This should fix the problem in your question. This says "delete all the .class files, recompile them from source and then try to run the Main .class file"
To get past the next error you'll see, delete the <scope>test</scope> line from the client dependency in the pom.xml:
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-client</artifactId>
<scope>test</scope>
</dependency>
To:
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-client</artifactId>
</dependency>

Categories