How do I stop the online searching by maven m2e connectors for the dependencies when I have already overridden the functionality for them to have local library instead of central by pom file by giving url like :
<repository>
<id>central</id>
<url>file://${basedir}/library</url>
</repository>
My all other files get downloaded(I mean copied) from the library which exists at local except some which I have not included in the library. Is there any way that connector too only search for the local library. My log is something like below.
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------
[INFO] Total time: 5.413 s
[INFO] Finished at: 2017-09-18T15:22:36-05:00
[INFO] Final Memory: 12M/125M
[INFO] ------------------------------------------------------------------
------
[ERROR] Failed to execute goal on project myproject: Could not resolve
dependencies for project com.company.product:myproject:jar:1.0: Failed to
collect dependencies at org.glassfish.jersey.media:jersey-media-json-
jackson:jar:2.19 -> com.fasterxml.jackson.jaxrs:jackson-jaxrs-
base:jar:2.5.1 -> com.fasterxml.jackson.core:jackson-core:jar:2.5.1:
Failed to read artifact descriptor for
com.fasterxml.jackson.core:jackson-core:jar:2.5.1: Could not transfer
artifact com.fasterxml.jackson.core:jackson-core:pom:2.5.1 from/to
release.maven.java.net (https://maven.java.net/content/groups/public):
sun.security.validator.ValidatorException: PKIX path building failed:
sun.security.provider.certpath.SunCertPathBuilderException: unable to
find valid certification path to requested target -> [Help 1]
[ERROR]
Here I am running package as a goal. I can provide more details if you ask.
Quite simple, ask your central repository to get redirected to local repository in your settings.xml file. Example given below. Let me know if further help required.
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
...
<mirrors>
<mirror>
<id>central-repo</id>
<name>Local repo</name>
<url>http://<localhost>/central</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
...
</settings>
You can try -o option (offline).
Example command line:
mvn clean package -o
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
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.
I am getting build error when run with maven. below is the error snippet.
Caused by: java.io.FileNotFoundException: http://repo1.maven.org/maven2/com/day/jcr/vault/maven-vault-plugin/0.0.10/maven-vault-plugin-0.0.10.pom
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1625)
at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:468)
at org.apache.maven.wagon.providers.http.LightweightHttpWagon.fillInputData(LightweightHttpWagon.java:115)
... 30 more
[DEBUG] Using Wagon implementation lightweight from default mapping for protocol http
[INFO] Unable to find resource 'com.day.jcr.vault:maven-vault-plugin:pom:0.0.10' in repository central (http://repo1.maven.org/maven2)
[DEBUG] Trying repository adobe-public
[DEBUG] Using Wagon implementation lightweight from default mapping for protocol http
[DEBUG] Checking for pre-existing User-Agent configuration.
[DEBUG] Adding User-Agent configuration.
[DEBUG] Connecting to repository: 'adobe-public' with url: 'http://repo.adobe.com/nexus/content/groups/public/'.
Downloading: http://repo.adobe.com/nexus/content/groups/public//com/day/jcr/vault/maven-vault-plugin/0.0.10/maven-vault-plugin-0.0.10.pom
[DEBUG] attempting to create parent directories for destination: maven-vault-plugin-0.0.10.pom.tmp
178b downloaded (maven-vault-plugin-0.0.10.pom)
[WARNING] *** CHECKSUM FAILED - Checksum failed on download: local = '81ffbd1712afe8cdf138b570c0fc9934742c33c1'; remote = '<html>
<head><title>301' - RETRYING
Downloading: http://repo.adobe.com/nexus/content/groups/public//com/day/jcr/vault/maven-vault-plugin/0.0.10/maven-vault-plugin-0.0.10.pom
[DEBUG] attempting to create parent directories for destination: maven-vault-plugin-0.0.10.pom.tmp
178b downloaded (maven-vault-plugin-0.0.10.pom)
[WARNING] *** CHECKSUM FAILED - Checksum failed on download: local = '81ffbd1712afe8cdf138b570c0fc9934742c33c1'; remote = '<html>
<head><title>301' - IGNORING
[DEBUG] Using Wagon implementation lightweight from default mapping for protocol http
[DEBUG] Artifact resolved
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error building POM (may not be this project's POM).
Project ID: com.day.jcr.vault:maven-vault-plugin
POM Location: C:\Users\username\.m2\repository\com\day\jcr\vault\maven-vault-plugin\0.0.10\maven-vault-plugin-0.0.10.pom
Reason: Not a v4.0.0 POM. for project com.day.jcr.vault:maven-vault-plugin at C:\Users\username\.m2\repository\com\day\jcr\vault\maven-vault-plugi
n\0.0.10\maven-vault-plugin-0.0.10.pom
[INFO] ------------------------------------------------------------------------
[DEBUG] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: Unable to build project for plugin 'com.day.jcr.vault:maven-vault-plugin': Not a v4.0.0 POM. f
or project com.day.jcr.vault:maven-vault-plugin at C:\Users\username\.m2\repository\com\day\jcr\vault\maven-vault-plugin\0.0.10\maven-vault-plugin
-0.0.10.pom
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.loadPluginFully(DefaultLifecycleExecutor.java:1599)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.findArtifactTypeHandlersInPlugins(DefaultLifecycleExecutor.java:1468)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.findExtensions(DefaultLifecycleExecutor.java:222)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:178)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
I have added maven repo then adobe repo. Intially build try to find vault plugin through maven repo, which cause error FNF, then tried adobe repo. Vault plugin is present on adobe repo, but its download only POM with 301 message.
Any thoughts.
pom snippet :
<repositories>
<repository>
<id>maven-central</id>
<name>Maven2</name>
<url>http://repo1.maven.org/maven2/</url>
</repository>
<repository>
<id>adobe-public</id>
<name>Adobe</name>
<url>https://repo.adobe.com/nexus/content/groups/public/</url>
</repository>
</repositories>
After changing to https, fall back not happen to adobe. Below is the error :
... 27 more
Caused by: java.io.FileNotFoundException: http://repo1.maven.org/maven2/com/day/jcr/vault/maven-vault-plugin/0.0.10/maven-vault-plugin-0.0.10.jar
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1625)
at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:468)
at org.apache.maven.wagon.providers.http.LightweightHttpWagon.fillInputData(LightweightHttpWagon.java:115)
... 27 more
[DEBUG] Using Wagon implementation lightweight from default mapping for protocol http
[INFO] Unable to find resource 'com.day.jcr.vault:maven-vault-plugin:maven-plugin:0.0.10' in repository central (http://repo1.maven.org/maven2)
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Plugin could not be found - check that the goal name is correct: Unable to download the artifact from any repository
You request an http URL and get back a 301 redirect to an https URL. Such redirects between schemes is not followed by default, because of security risks. When the POM is requested only the 301 redirect HTML page is retrieved which has 81ffbd1712afe8cdf138b570c0fc9934742c33c1 as SHA1 checksum. Then the POM URL + .sha1 is retrieved which should have the checksum of the POM in its first line and they are compared. Here again you onyl get the 301 redirect page, so 81ffbd1712afe8cdf138b570c0fc9934742c33c1 is compared against '<html>\n<head><title>301' which of course does not match.
Configure the https URL instead for the Adobe repo directly and it should work just fine.
I have a created a maven repo in a directory called lib in the base of my project.
I can use maven to build this project and fetch dependencies from the repo in the lib directory. When I try to build this project with Hudson, Hudson can not find the dependencies in the lib repo.
Here are the relevant parts of the project pom:
<dependency>
<groupId>manitou</groupId>
<artifactId>manitou.cxf.jar</artifactId>
<version>1.0.0</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>ErpClientsLibRepo</id>
<url>file://${basedir}/lib</url>
</repository>
</repositories>
Here are the errors from Maven when ran from Hudson:
[INFO] o.h.m.e.h.MavenExecutionResultHandler - Build failed with exception(s)
[INFO] o.h.m.e.h.MavenExecutionResultHandler - [1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal on project DigabitERPClients: Could not resolve dependencies for project com.digabit:DigabitERPClients:jar:1.2.0: Failure to find manitou:manitou.cxf.jar:jar:1.0.0 in file:///opt/eng/hudson/jobs/20-DigabitJParent/workspace/DigabitErpClients/lib was cached in the local repository, resolution will not be reattempted until the update interval of ErpClientsLibRepo has elapsed or updates are forced
[DEBUG] Closing connection to remote
[ERROR] Failed to execute goal on project DigabitERPClients: Could not resolve dependencies for project com.digabit:DigabitERPClients:jar:1.2.0: Failure to find manitou:manitou.cxf.jar:jar:1.0.0 in file:///opt/eng/hudson/jobs/20-DigabitJParent/workspace/DigabitErpClients/lib was cached in the local repository, resolution will not be reattempted until the update interval of ErpClientsLibRepo has elapsed or updates are forced -> [Help 1]
Here is a dir listing at the path Maven (As ran by Hudson) seems to be looking at:
[root#vail lib]# cd /opt/eng/hudson/jobs/20-DigabitJParent/workspace/DigabitErpClients/lib
[root#vail lib]# ls
manitou
[root#vail lib]# ls manitou/
manitou.cxf.jar
[root#vail lib]#
Any ideas what I'm doing wrong? Thanks
I went into the hudson project and forced maven to update, now the build works :S
I have a maven project with an in-project repository with an external jar file.
I used the install command to install the jar file into the in-porject repository
and when I checked in the repository the jar file was installed
i also added the dependency configuration in the pom file.
But when I run the mvn compile file.
I get the error that mvn cannot resolve the dependency
this is the Pom snippet:
<repository>
<id>repo</id>
<releases>
<enabled>true</enabled>
<checksumPolicy>ignore</checksumPolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<url>file://${project.basedir}/repo</url>
</repository>
this is the dependency in POM
<dependency>
<groupId>Com.RubineEngine.GesturePoints</groupId>
<artifactId>Com-RubineEngine-GesturePoints</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
this is the error message :
[INFO] Final Memory: 6M/309M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project com-boundingbox-box: Could not resolve
dependencies for project com.boundingbox.box:com-boundingbox-box:jar:1.0-SNAPSH
OT: Could not find artifact Com.RubineEngine.GesturePoints:Com-RubineEngine-Gest
urePoints:jar:1.0-SNAPSHOT -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[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 rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyReso
lutionException
Does anybody have any suggestion about this error.
this is the error message after using the U and X switches
[DEBUG] =======================================================================
[DEBUG] Using connector WagonRepositoryConnector with priority 0 for file://C:\U
sers\FAISAL\Desktop\disaster\com-initialtheta-theta/repo
Downloading: file://C:\Users\FAISAL\Desktop\disaster\com-initialtheta-theta/repo
/Com/RubineEngine/GesturePoints/Com-RubineEngine-GesturePoints/1.0-SNAPSHOT/mave
n-metadata.xml
[DEBUG] Writing resolution tracking file C:\Users\FAISAL\.m2\repository\Com\Rubi
neEngine\GesturePoints\Com-RubineEngine-GesturePoints\1.0-SNAPSHOT\resolver-stat
us.properties
[DEBUG] Using connector WagonRepositoryConnector with priority 0 for http://repo
.typesafe.com/typesafe/releases/
Downloading: http://repo.typesafe.com/typesafe/releases/Com/RubineEngine/Gesture
Points/Com-RubineEngine-GesturePoints/1.0-SNAPSHOT/maven-metadata.xml
[DEBUG] Writing resolution tracking file C:\Users\FAISAL\.m2\repository\Com\Rubi
neEngine\GesturePoints\Com-RubineEngine-GesturePoints\1.0-SNAPSHOT\resolver-stat
us.properties
[DEBUG] Could not find metadata Com.RubineEngine.GesturePoints:Com-RubineEngine-
GesturePoints:1.0-SNAPSHOT/maven-metadata.xml in typesafe (http://repo.typesafe.
com/typesafe/releases/)
[DEBUG] Could not find metadata Com.RubineEngine.GesturePoints:Com-RubineEngine-
GesturePoints:1.0-SNAPSHOT/maven-metadata.xml in lib (file://C:\Users\FAISAL\Des
ktop\disaster\com-initialtheta-theta/repo)
[DEBUG] Skipped remote update check for Com.RubineEngine.GesturePoints:Com-Rubin
eEngine-GesturePoints:1.0-SNAPSHOT/maven-metadata.xml, already updated during th
is session.
[DEBUG] Failure to find Com.RubineEngine.GesturePoints:Com-RubineEngine-GestureP
oints:1.0-SNAPSHOT/maven-metadata.xml in http://repo.typesafe.com/typesafe/relea
ses/ was cached in the local repository, resolution will not be reattempted unti
l the update interval of typesafe has elapsed or updates are forced
[DEBUG] Skipped remote update check for Com.RubineEngine.GesturePoints:Com-Rubin
eEngine-GesturePoints:1.0-SNAPSHOT/maven-metadata.xml, already updated during th
is session.
[DEBUG] Failure to find Com.RubineEngine.GesturePoints:Com-RubineEngine-GestureP
oints:1.0-SNAPSHOT/maven-metadata.xml in file://C:\Users\FAISAL\Desktop\disaster
\com-initialtheta-theta/repo was cached in the local repository, resolution will
not be reattempted until the update interval of lib has elapsed or updates are
forced
Looks like the system is getting confuse between two repositories.
Check, if the groupId/artifactId are set correctly in the pom file of the libs in your project's repository (i.e. ${project.baseDir}\repo\Com....\1.0-SNAPSHOT\Com-RubineEngine-GesturePoints.pom)
To get rid of "resolution will not be reattempted until the update interval of lib has elapsed or updates are forced" error you need to delete the folders from your local repository (usually ~/.m2), i.e. ~/.m2/Com/RubineEngine.
Try changing snapshots enabled to true.
<snapshots>
<enabled>true</enabled>
</snapshots>