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>
...
Related
I cloned a JAVA repo and when I tried to build it with "mvn install", I got the following error
Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom:2.3.2.RELEASE from/to central (https://repo.maven.apache.org/maven2): Transfer failed for https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-starter-parent/2.3.2.RELEASE/spring-boot-starter-parent-2.3.2.RELEASE.pom and 'parent.relativePath' points at no local POM # line 6, column 13: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target -> [Help 2]
the repo "https://repo.maven.apache.org/maven2" is accessible in my browser when I open it in Chrome.
After some googling, I put a settings.xml file in the .m2 folder looks like this
<?xml version="1.0" encoding="UTF-8"?>
<settings>
<activeProfiles>
<!--make the profile active all the time -->
<activeProfile>securecentral</activeProfile>
</activeProfiles>
<profiles>
<profile>
<id>securecentral</id>
<!--Override the repository (and pluginRepository) "central" from the
Maven Super POM -->
<repositories>
<repository>
<id>central</id>
<url>https://repo1.maven.org/maven2</url>
<releases>
<enabled>true</enabled>
</releases>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>https://repo1.maven.org/maven2</url>
<releases>
<enabled>true</enabled>
</releases>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
</settings>
Now when I run "mvn install", the error for spring-boot goes away. But I am facing this error now:
Failed to read artifact descriptor for org.apache.camel.springboot:camel-salesforce-starter:jar:3.4.2: Could not transfer artifact io.dropwizard.metrics:metrics-bom:pom:4.1.9 from/to central (https://repo.maven.apache.org/maven2): Transfer failed for https://repo.maven.apache.org/maven2/io/dropwizard/metrics/metrics-bom/4.1.9/metrics-bom-4.1.9.pom: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target -> [Help 1]
My question is, why do I need to manually add and in settings.xml and why I am still getting the error for camel? Thanks
You can try to run mvn -U clean install
-U according to Maven CLI options is for
Forces a check for missing releases and updated snapshots on remote
repositories
or try to delete the local repository folder. Sometimes it gets messed up when having network problems...
You can find your local repo folder in your .m2 folder (on windows: C:\Users<your_username>.m2)
You can delete the whole repository folder or just some part of it. After that just run the mvn clean install
PKIX path building failed:
sun.security.provider.certpath.SunCertPathBuilderException: unable to
find valid certification path to requested target
Almost certain that root CA certificates on your system are outdated.
Try to update your JDK installation. Note that CA certificate used by your browser might not be same as JRE/JDK is using.
Without knowing more details about your system, it's hard to provide more accurate answer.
This answer provides possible workaround.
OK...got it working.
#rkosegi's answer put me on the right path. The root CA cert used by my browser is different than the one jdk uses. That's why I can view the repo in browser with no error but maven cannot access the repo.
Somehow my company (a financial institution) has a root CA cert overriding all the other root CA cert, that means, when I open any website (for example stackoverflow), the cert path always shows like this:
I am not a system admin and not sure how this is done, but anyhow, all I need to do is save the Root CA cert as a *.CER file and add it to the jdk's cacert folder.
After that, the command "mvn clean install" runs to complete with no error
i have in settings.xml following config
<profile>
<properties>
<nexus.host>http://localhost:8081/nexus/content/repositories</nexus.host>
</properties>
</profile>
this profile is set as active.
its used in distribution management section of pom
<distributionManagement>
<snapshotRepository>
<id>my-snapshots</id>
<name>my snapshots</name>
<url>${nexus.path}/snapshots</url>
</snapshotRepository>
<repository>
<id>my-releases</id>
<name>my releases</name>
<url>${nexus.path}/releases</url>
</repository>
</distributionManagement>
this works when i run it on local machine, but when the job is executed on jenkins it fails with
org.apache.maven.project.ProjectBuildingException: Some problems were encountered while processing the POMs:
[FATAL] Non-resolvable parent POM: Failure to transfer
com.myapp:sample:pom:1.1.0 from ${nexus.path}/releases was cached in
the local repository, resolution will not be reattempted until the
update interval of my-releases has elapsed or updates are forced.
Original error: Could not transfer artifact com.myapp:sample:pom:1.1.0
from/to my-releases (${nexus.path}/releases): Cannot access
${nexus.path}/releases with type default using the available connector
factories: WagonRepositoryConnectorFactory and 'parent.relativePath'
points at wrong local POM # line 3, column 13
unable to identify the cause of the error
I had the same issue in the past. To resolve this in Jenkins you will need to set the Maven argument so it can find the location of your settings.xml.
You will need to have the settings.xml in the application resources so Jenkins can find it.
To set the argument(In Jenkins, it should be under Goals and options):
-s src/main/resources/settings.xml
However in my instance the Jenkins administrators provided a separate version of maven so the application will have the needed settings.xml and there was no need to provide our own custom settings.xml.
On a side note, you might want to contact the Jenkins Administrators to ensure that they have implemented the proper configurations so Jenkins will be able to deploy the produced artifacts to the repository under the id you have specified.
I'm trying to accessing a server with a maven repo. From my windows machine at work I can access it with my company login. With my mac I can access the server if I connect to it and enter in my windows credentials.
Here is the part of my pom with the rep:
<repositories>
<repository>
<id>repo.id</id>
<url>file:////servername/MavenRepo</url>
<!-- use snapshot version -->
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
here is the part of the settings.xml that I'm using to try to set credentials to access that maven repo. What am I doing wrong?
<server>
<id>repo.id</id>
<username>domain\username</username>
<password>password</password>
</server>
The error is:
[ERROR] Failed to execute goal on project Company-Project: Could not resolve dependencies for project Company-Project:Company-Project:jar:DEVELOP-1.0-SNAPSHOT: Failed to collect dependencies at Company-ProjectName:Company-ProjectName:jar:1.0-SNAPSHOT: Failed to read artifact descriptor for Company-ProjectName:Company-ProjectName:jar:1.0-SNAPSHOT: Could not transfer artifact Company-ProjectName:Company-ProjectName:pom:1.0-SNAPSHOT from/to com.Company.maven (file:////Server.Company.corpnet.local/JenkinsMavenRepo): Repository path /Server.Company.corpnet.local/JenkinsMavenRepo does not exist, and cannot be created. -> [Help 1]
It seems that maven could not find the repository on the file system.
file:////Server.Company.corpnet.local/JenkinsMavenRepo): Repository path /Server.Company.corpnet.local/JenkinsMavenRepo does not exist
Have you mounted the repository file system correctly?
Check if you can access the directory /Server.Company.corpnet.local/JenkinsMavenRepo in the Terminal.
PS
I always would prefer a repository server such as nexus. Is that an option?
Turns out using windows as a filestore for a maven repo is proprietary. I setup a IIS server (http) pointing to that directory which resolves the issue.
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>