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.
Related
I'm experimenting with writing an openHab2 binding which is written in java. I'm a C++ guy and java is new to me. The offending code looks like this:
import org.apache.http.client.CredentialsProvider;
import org.apache.http.impl.client.BasicCredentialsProvider;
...
#Override
public void initialize() {
...
CredentialsProvider credsProvider = new BasicCredentialsProvider();
...
}
I added org.apache.httpcomponents.htpclient_4.5.2.v20170210-0925.jar to the buildpath as an external jar and the program builds without any problems.
This project uses Maven, which I'm not familiar with either, as the build system so I added:
<dependencies>
<dependency>
<groupId>org.apache.httpcomponent</groupId>
<artifactId>httpclient</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<scope>runtime</scope>
</dependency>
</dependencies>
to the pom.xml.
When I run the system I get this error:
2018-05-20 09:51:38.574 [ERROR] [.i.c.AbstractInvocationHandler:101 ]
- An error occurred while calling method 'ThingHandler.initialize()' on
'org.openhab.binding.testbinging.internal.TestBingingHandler#728656fc':
org/apache/http/impl/client/BasicCredentialsProviderjava.lang.NoClassDefFoundError:
org/apache/http/impl/client/BasicCredentialsProvider at
org.openhab.binding.testbinging.internal.TestBingingHandler.initialize(TestBingingHandler.java:63)
2018-05-20 09:51:38.576 [ERROR] [.c.thing.internal.ThingManager:700 ]
- Exception occurred while initializing handler of thing 'testbinging:sample:0ac3dcf3':
org/apache/http/impl/client/BasicCredentialsProviderjava.lang.NoClassDefFoundError:
org/apache/http/impl/client/BasicCredentialsProvider
It look to my untrained eye like the runtime classpath is not set correctly.
I'm using eclipse-oxygen version Oxygen.3a Release(4.7.3a), Build id: 20181405.1200 and
$ mvn -version
Apache Maven 3.3.9
Maven home: /usr/share/maven
Java version: 1.8.0_171, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-8-openjdk-amd64/jre
Thanks,
Steve
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.9.0-5-amd64", arch: "amd64", family: "unix"
It's because your dependencies are runtime:
<scope>runtime</scope>
You need to either change it to:
<scope>compile</scope>
Or delete the scope line, since this is the default scope.
Runtime dependencies aren't used at compile time. You can't read more about it: https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Scope
I am trying to build a maven project. Following are specifications of system and maven version:
Apache Maven 3.5.0,
Java version: 1.8.0_121, vendor: Oracle,
Corporation Default locale: en_IN, platform encoding: Cp1252,
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
on running mvn install command I am getting following error.
[WARNING] Could not transfer metadata
com.googlecode.wicket-jquery-ui:wicket-kendo-ui:8.0.0-SNAPSHOT/maven-metadata.xml
from/to sonatype-snapshots
(http://oss.sonatype.org/content/repositories/snapshots/): Error
transferring file: Server returned HTTP response code: 407 for URL:
http://oss.sonatype.org/content/repositories/snapshots/com/googlecode/wicket-jquery-ui/wicket-kendo-ui/8.0.0-SNAPSHOT/maven-metadata.xml
from
http://oss.sonatype.org/content/repositories/snapshots/com/googlecode/wicket-jquery-ui/wicket-kendo-ui/8.0.0-SNAPSHOT/maven-metadata.xml
with proxyInfo ProxyInfo{host='', userName='null', port=,
type='http', nonProxyHosts='null'}
I am working behind proxy so I have added following mapping in settings.xml which is inside %MAVEN_HOME%\conf:
<proxies>
<proxy>
<id>optional</id>
<active>true</active>
<protocol>http</protocol>
<username>username</username>
<password>password</password>
<host>proxyhost</host>
<port>proxyport</port>
<nonProxyHosts>local.net|some.host.com</nonProxyHosts>
</proxy>
</proxies>
even after adding username and password in settings.xml it is considering username as null and throwing 407 authentication error. Its causing problem to build the project. Please help to resolve this.
Update:
variables:
MAVEN_HOME=D:\Apache\Maven\apache-maven-3.5.0
M2_HOME=D:\Apache\Maven\apache-maven-3.5.0
Complete mvn -version :
Apache Maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426;
2017-04-04T01:09:06+05:30) Maven home:
D:\Apache\Maven\apache-maven-3.5.0\bin.. Java version: 1.8.0_121,
vendor: Oracle Corporation Java home: C:\Program
Files\Java\jdk1.8.0_121\jre Default locale: en_IN, platform encoding:
Cp1252 OS name: "windows 10", version: "10.0", arch: "amd64",
family:"windows"
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
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
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>