At the company I work for we are using artifactory like tool of repository management. Now I'm working on a modular project that look like at the following:
Now, I realized that each day the first time that I try to build my application through the command
jetty:run
I get the following information:
[INFO] Downloading: http://myRepo/artifactory/repo/it/myCompany/services/0.0.1-SNAPSHOT/maven-metadata.xml
[INFO] Downloaded: http://myRepo/artifactory/repo/it/myCompany/services/0.0.1-SNAPSHOT/maven-metadata.xml
[INFO] Downloading: http://myRepo/artifactory/repo/it/myCompany/parent/0.0.1-SNAPSHOT/maven-metadata.xml
[INFO] Downloading: http://myRepo/artifactory/repo/it/myCompany/parent/0.0.1-SNAPSHOT/maven-metadata.xml
[INFO] Downloading: http://myRepo/artifactory/repo/it/myCompany/model/0.0.1-SNAPSHOT/maven-metadata.xml
[INFO] Downloaded: http://myRepo/artifactory/repo/it/myCompany/model/0.0.1-SNAPSHOT/maven-metadata.xml
[INFO] Downloading: http://myRepo/artifactory/repo/it/myCompany/util/0.0.1-SNAPSHOT/maven-metadata.xml
[INFO] Downloaded: http://myRepo/artifactory/repo/it/myCompany/util/0.0.1-SNAPSHOT/maven-metadata.xml
[INFO] Downloading: http://myRepo/artifactory/repo/it/myCompany/rest/0.0.1-SNAPSHOT/maven-metadata.xml
[INFO] Downloaded: http://myRepo/artifactory/repo/it/myCompany/test/0.0.1-SNAPSHOT/maven-metadata.xml
I think that these xml files are converted in maven-metadata-repo.xml in the corrisponding folder inside the local repository. For example the file maven-metadata-repo.xml of the model project contains the following info:
<?xml version="1.0" encoding="UTF-8"?>
<metadata>
<groupId>myCompany</groupId>
<artifactId>model</artifactId>
<version>0.0.1-20140417.095713-1</version>
<versioning>
<snapshot>
<timestamp>20140417.095713</timestamp>
<buildNumber>1</buildNumber>
</snapshot>
<lastUpdated>20140512073542</lastUpdated>
<snapshotVersions>
<snapshotVersion>
<extension>pom</extension>
<value>0.0.1-20140417.095713-1</value>
<updated>20140417095713</updated>
</snapshotVersion>
<snapshotVersion>
<extension>jar</extension>
<value>0.0.1-20140417.095713-1</value>
<updated>20140417095713</updated>
</snapshotVersion>
</snapshotVersions>
</versioning>
</metadata>
Now I want to ask you Why i get the informations of download only the first time (each day) that i run the command jetty:run?
Also I configured the snapshot repository in artifactory in this way
Is this the reason of these continuous download?
This is related to the way Maven is checking whether there is an updated SNAPSHOT version of your dependencies (Maven3 is using unique SNAPSHOT versions). Maven downloads the maven-metadata.xml file and checks if it has the latest SNAPSHOT version cached in the local Maven repository or it needs to download a newer one from Artifactory.
The default update policy for SNAPSHOTS is checking once a day ("daily"). You can configure this policy in your settings.xml file, for example:
<repositories>
<repository>
<id>central</id>
<url>my-server-url</url>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
<releases>
<enabled>true</enabled>
<updatePolicy>daily</updatePolicy>
</releases>
</repository>
</repositories>
Possible values for are: "always", "daily" (default), "interval:XXX" (in minutes) or "never" (only if it doesn't exist locally).
Related
I have Maven 3.0.5 with Java 8 setup (that's for particular project and stack versions won't be revised).
I'm aware of Apache's new decision to force all the Maven repositories to only use HTTPS, otherwise Maven clients won't be able to speak to the repository servers.
It seems like I have configured all necessary settings in ~/.m2/settings.xml but for some reason, when I any build phase (say mvn clean), Maven defaults to HTTP and doesn't care about settings.xml - it still attempts to download references/dependencies with HTTP protocol.
Example of my settings.xml
(For simplicity, I removed project specific things and left only problem-related stuff):
<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
https://maven.apache.org/xsd/settings-1.0.0.xsd">
<repositories>
<repository>
<id>central</id>
<url>https://repo1.maven.org/maven2/</url>
</repository>
<repository>
<id>central</id>
<url>https://repo.maven.apache.org/maven2/</url>
</repository>
</repositories>
and here is what I'm getting when I do mvn archetype:generate, just to test the behaviour of Maven (the problem is persistent for any other command that tries to reach servers out):
[INFO] Scanning for projects...
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.pom
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-clean-plugin:2.5: Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-clean-plugin:jar:2.5
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-install-plugin/2.3/maven-install-plugin-2.3.pom
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-install-plugin:2.3: Plugin org.apache.maven.plugins:maven-install-plugin:2.3 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-install-plugin:jar:2.3
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-deploy-plugin/2.7/maven-deploy-plugin-2.7.pom
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-deploy-plugin:2.7: Plugin org.apache.maven.plugins:maven-deploy-plugin:2.7 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-deploy-plugin:jar:2.7
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-site-plugin/3.0/maven-site-plugin-3.0.pom
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-site-plugin:3.0: Plugin org.apache.maven.plugins:maven-site-plugin:3.0 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-site-plugin:jar:3.0
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-antrun-plugin/1.3/maven-antrun-plugin-1.3.pom
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-antrun-plugin:1.3: Plugin org.apache.maven.plugins:maven-antrun-plugin:1.3 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-antrun-plugin:jar:1.3
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-assembly-plugin/2.2-beta-5/maven-assembly-plugin-2.2-beta-5.pom
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-assembly-plugin:2.2-beta-5: Plugin org.apache.maven.plugins:maven-assembly-plugin:2.2-beta-5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-assembly-plugin:jar:2.2-beta-5
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-dependency-plugin/2.1/maven-dependency-plugin-2.1.pom
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-dependency-plugin:2.1: Plugin org.apache.maven.plugins:maven-dependency-plugin:2.1 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-dependency-plugin:jar:2.1
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-release-plugin/2.0/maven-release-plugin-2.0.pom
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-release-plugin:2.0: Plugin org.apache.maven.plugins:maven-release-plugin:2.0 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-release-plugin:jar:2.0
Downloading: http://repo.maven.apache.org/maven2/org/codehaus/mojo/maven-metadata.xml
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-metadata.xml
[WARNING] Could not transfer metadata org.apache.maven.plugins/maven-metadata.xml from/to central (http://repo.maven.apache.org/maven2): Failed to transfer file: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-metadata.xml. Return code is: 501 , ReasonPhrase:HTTPS Required.
[WARNING] Could not transfer metadata org.codehaus.mojo/maven-metadata.xml from/to central (http://repo.maven.apache.org/maven2): Failed to transfer file: http://repo.maven.apache.org/maven2/org/codehaus/mojo/maven-metadata.xml. Return code is: 501 , ReasonPhrase:HTTPS Required.
[WARNING] Failure to transfer org.apache.maven.plugins/maven-metadata.xml from http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced.
Original error: Could not transfer metadata org.apache.maven.plugins/maven-metadata.xml from/to central (http://repo.maven.apache.org/maven2): Failed to transfer file: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-metadata.xml. Return code is: 501 , ReasonPhrase:HTTPS Required.
[WARNING] Failure to transfer org.codehaus.mojo/maven-metadata.xml from http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced.
Original error: Could not transfer metadata org.codehaus.mojo/maven-metadata.xml from/to central (http://repo.maven.apache.org/maven2): Failed to transfer file: http://repo.maven.apache.org/maven2/org/codehaus/mojo/maven-metadata.xml. Return code is: 501 , ReasonPhrase:HTTPS Required.
What shall I do? as you see, it still uses HTTP, and I, correspondingly, get HTTP 501.
In your case, it seems to be working for dependencies, but not for plugins. You need to define a <profile> that is activeByDefault and contains a <pluginRepositories/> section for both snapshot and releases.
Maven has two types of repositories:
For dependencies
For plugins
The <mirrorOf> section only handles dependency repositories.
There were two problems:
Problem 1:
[WARNING] Failed to retrieve plugin descriptor for .. (whatever plugin name) warnings during almost any build phase, which says that (important>) the retrieval of plugin descriptors or its dependencies (which means plugins, and not the project dependencies!) is not going successful.
Here, Maven attempts to communicate with the end-point machine (repository) via HTTP, despite the fact(!), that I have customized my configuration .m2\settings.xml file and all the repository definition entries are with HTTPS, respectively, seems like Maven should be trying everything via HTTPS ..but no, it uses HTTP for plugins, and any HTTP communication with Maven repositories is forbidden since the 15th of January, 2020.
The way I resolved this is to define and configure <profiles/> and <pluginRepositories/> as #carlspring suggested, but I had to elaborate and expand that answer a bit.
So, here is my ready working settings.xml example: (note, that just to be safe, I provided alternative repositories in both - profiles and repositories)
<settings
xmlns="http://maven.apache.org/SETTINGS/1.0.0" $ xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
https://maven.apache.org/xsd/settings-1.0.0.xsd">
<profiles>
<profile>
<id>ssl-profile</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<repositories>
<repository>
<id>central-1</id>
<url>https://repo1.maven.org/maven2</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central-2</id>
<url>https://repo1.maven.org/maven2</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
<repositories>
<repository>
<id>central1</id>
<url>https://repo1.maven.org/maven2/</url>
</repository>
<repository>
<id>central2</id>
<url>https://repo.maven.apache.org/maven2/</url>
</repository>
</repositories>
</profiles>
</settings>
After this was resolved, and finally Maven attempted to connect to all the repositories via HTTPS, I then had another,
Problem 2:
peer not authenticated followed by Return code is: 501 , ReasonPhrase:HTTPS Required.
This was a bit tricky, but the way of solving this is to play with truststore cacerts file.
First, check whether you have truststore file cacerts and whether it's empty. it must NOT be empty and this is very important.
It seems like, in the OpenJDK 11 and in some other builds for Windows/Linux systems, cacerts file is either missing or present, but empty; however, according to my observation, it was present in Oracle JDK builds.
On Windows builds, it should be under %JAVA_HOME%\lib\security\;
On Linux builds, it may vary (depending on Linux distribution and your setup), but in my case, it was under /etc/ssl/certs (and I think that's Linux's certificates folder, not particularly Java's one).
If you see, that cacerts file is either absent or empty (simply check the file size, it should be larger than few bits), you can either:
Simply copy-paste existing cacerts file from some other JDK/JRE build;
Generate a cacerts truststore file and add certificate(s) to it. In this case, you will need to add as many certificates as you need, so, maybe it's easier to go with just a copy-paste variant.
I hope this helps.
I would suggest to go the following path:
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd">
<mirrors>
<mirror>
<id>central</id>
<name>central</name>
<url>https://repo1.maven.org/maven2/</url>
<mirrorOf>*</mirrorOf>
</mirror>
</mirrors>
</settings>
This will redirect all request via the above URL. If you have a repository manager inside of your corporate environment it's better to use this one and let the repo manager handle the https stuff.
Also an upgrade of Maven to most recent version 3.6.3 and I supose you are not using the most recent versions of plugins which I strongly recommend to upgrade there had been a lot of improvements.
The story behind: I submitted a bug to some public repo in GitHub, and it was fixed, but when I asked to release these changes I didn't get any response. So I'm waiting for next library version for 2 months. So I decided to fork this repo and publish to custom Bintray. The repo is https://github.com/okta/okta-sdk-java
The project has multiple maven modules:
$ find . -type f -name pom.xml
./httpclients/okhttp/pom.xml
./httpclients/httpclient/pom.xml
./impl/pom.xml
./swagger-templates/pom.xml
./pom.xml
./integration-tests/pom.xml
./api/pom.xml
./coverage/pom.xml
./examples/pom.xml
./examples/quickstart/pom.xml
I need to publish only impl module.
The problem is that root pom.xml has parent configuration:
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.okta</groupId>
<artifactId>okta-parent</artifactId>
<version>14</version>
<relativePath>../okta-java-parent</relativePath>
</parent>
<groupId>com.okta.sdk</groupId>
<artifactId>okta-sdk-root</artifactId>
<version>1.6.0-SNAPSHOT</version>
<packaging>pom</packaging>
And all deploy config is specified in okta-parent pom.
I tried to override repository config with (in root pom.xml):
<distributionManagement>
<repository>
<id>bintray-g4s8-maven</id>
<name>mvn</name>
<url>https://api.bintray.com/maven/g4s8/mvn/okta-sdk-impl/;publish=1</url>
</repository>
</distributionManagement>
but it didn't help.
I have server configuration in my settings.xml for this repo, and it's working fine for all other projects of mine:
<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
https://maven.apache.org/xsd/settings-1.0.0.xsd">
<servers>
<server>
<id>bintray-g4s8-maven</id>
<username>g4s8</username>
<password>...</password>
</server>
</servers>
</settings>
When I'm trying to publish it I'm getting error:
$ mvn deploy -pl impl -Ppublish -DskipTests
...
[INFO] --- nexus-staging-maven-plugin:1.6.8:deploy (injected-nexus-deploy) # okta-sdk-impl ---
[INFO] Performing deferred deploys (gathering into "/home/projects/github.com/g4s8/okta-sdk-java/impl/target/nexus-staging/deferred")...
[INFO] Installing /home/projects/github.com/g4s8/okta-sdk-java/impl/target/okta-sdk-impl-1.6.0-SNAPSHOT.jar to /home/projects/github.com/g4s8/okta-sdk-java/impl/target/nexus-staging/deferred/com/okta/sdk/okta-sdk-impl/1.6.0-SNAPSHOT/okta-sdk-impl-1.6.0-SNAPSHOT.jar
[INFO] Installing /home/projects/github.com/g4s8/okta-sdk-java/impl/pom.xml to /home/projects/github.com/g4s8/okta-sdk-java/impl/target/nexus-staging/deferred/com/okta/sdk/okta-sdk-impl/1.6.0-SNAPSHOT/okta-sdk-impl-1.6.0-SNAPSHOT.pom
[INFO] Installing /home/projects/github.com/g4s8/okta-sdk-java/impl/target/okta-sdk-impl-1.6.0-SNAPSHOT-sources.jar to /home/projects/github.com/g4s8/okta-sdk-java/impl/target/nexus-staging/deferred/com/okta/sdk/okta-sdk-impl/1.6.0-SNAPSHOT/okta-sdk-impl-1.6.0-SNAPSHOT-sources.jar
[INFO] Installing /home/projects/github.com/g4s8/okta-sdk-java/impl/target/okta-sdk-impl-1.6.0-SNAPSHOT-javadoc.jar to /home/projects/github.com/g4s8/okta-sdk-java/impl/target/nexus-staging/deferred/com/okta/sdk/okta-sdk-impl/1.6.0-SNAPSHOT/okta-sdk-impl-1.6.0-SNAPSHOT-javadoc.jar
[INFO] Installing /home/projects/github.com/g4s8/okta-sdk-java/impl/target/okta-sdk-impl-1.6.0-SNAPSHOT-javadoc.jar to /home/projects/github.com/g4s8/okta-sdk-java/impl/target/nexus-staging/deferred/com/okta/sdk/okta-sdk-impl/1.6.0-SNAPSHOT/okta-sdk-impl-1.6.0-SNAPSHOT-javadoc.jar
[INFO] Deploying remotely...
[INFO] Bulk deploying locally gathered artifacts from directory:
[INFO] * Bulk deploying locally gathered snapshot artifacts
Downloading from sonatype-nexus-snapshots: https://oss.sonatype.org/content/repositories/snapshots/com/okta/sdk/okta-sdk-impl/1.6.0-SNAPSHOT/maven-metadata.xml
Downloaded from sonatype-nexus-snapshots: https://oss.sonatype.org/content/repositories/snapshots/com/okta/sdk/okta-sdk-impl/1.6.0-SNAPSHOT/maven-metadata.xml (993 B at 412 B/s)
Uploading to sonatype-nexus-snapshots: https://oss.sonatype.org/content/repositories/snapshots/com/okta/sdk/okta-sdk-impl/1.6.0-SNAPSHOT/okta-sdk-impl-1.6.0-20191101.130725-30-javadoc.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 58.070 s
[INFO] Finished at: 2019-11-01T16:07:41+03:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.sonatype.plugins:nexus-staging-maven-plugin:1.6.8:deploy (injected-nexus-deploy) on project okta-sdk-impl: Failed to deploy artifacts: Could not transfer artifact com.okta.sdk:okta-sdk-impl:jar:javadoc:1.6.0-20191101.130725-30 from/to sonatype-nexus-snapshots (https://oss.sonatype.org/content/repositories/snapshots/): Failed to transfer file https://oss.sonatype.org/content/repositories/snapshots/com/okta/sdk/okta-sdk-impl/1.6.0-SNAPSHOT/okta-sdk-impl-1.6.0-20191101.130725-30-javadoc.jar with status code 401 -> [Help 1]
Maven is uploading artifacts to https://oss.sonatype.org/ instead of configured URL https://api.bintray.com/maven/g4s8/mvn/okta-sdk-impl/;publish=1. How can I force it to use my URL instead of parent URL?
Update
Effective pom shows both repositories in distributionManagement:
<distributionManagement>
<repository>
<id>bintray-g4s8-maven</id>
<name>mvn</name>
<url>https://api.bintray.com/maven/g4s8/mvn/okta-sdk-impl/;publish=1</url>
</repository>
<snapshotRepository>
<id>sonatype-nexus-snapshots</id>
<name>Sonatype Nexus Snapshots</name>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
</snapshotRepository>
</distributionManagement>
It is looking like you are building a SNAPSHOT version. The configured <snapshotRepository> is oss.sonatype.... You only added a configuration for building release versions.
I have following Artifactory (6.12.1) settings
Remote repositories:
central: https://repo.maven.apache.org/maven2
jboss: https://repository.jboss.org/nexus/content/groups/public/
jcenter https://jcenter.bintray.com
jvnet-nexus-staging: http://maven.java.net/content/repositories/staging/
rabbit-milestone: https://dl.bintray.com/rabbitmq/maven-milestones
repository.spring.milestone: https://repo.spring.io/milestone
repository.spring.snapshot: https://repo.spring.io/snapshot
sonatype-oss-snapshots: https://oss.sonatype.org/content/repositories/snapshots/
Virtual repositories
libs-release: libs-release-local, central, repository.spring.milestone, jcenter, jboss, rabbit-milestone
libs-snapshot: libs-snapshot-local, repository.spring.snapshot, jvnet-nexus-staging, sonatype-oss-snapshots
I'm trying to build spring-boot locally and I've forced all remote repositories from my system to go through our Artifactory. So I've added to my .m2/settings.xml following section:
<profile>
<id>artifactory</id>
<repositories>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>libs-release</name>
<url>https://artifactory.secret.com/artifactory/libs-release</url>
</repository>
<repository>
<snapshots />
<id>snapshots</id>
<name>libs-snapshot</name>
<url>https://artifactory.secret.com/artifactory/libs-snapshot</url>
</repository>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>spring-milestone</id>
<name>libs-release</name>
<url>https://artifactory.secret.com/artifactory/libs-release</url>
</repository>
<repository>
<snapshots />
<id>spring-snapshot</id>
<name>libs-snapshot</name>
<url>https://artifactory.secret.com/artifactory/libs-snapshot</url>
</repository>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>rabbit-milestone</id>
<name>libs-release</name>
<url>https://artifactory.secret.com/artifactory/libs-release</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>libs-release</name>
<url>https://artifactory.secret.com/artifactory/libs-release</url>
</pluginRepository>
<pluginRepository>
<snapshots />
<id>snapshots</id>
<name>libs-snapshot</name>
<url>https://artifactory.secret.com/artifactory/libs-snapshot</url>
</pluginRepository>
<pluginRepository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>spring-milestone</id>
<name>libs-release</name>
<url>https://artifactory.secret.com/artifactory/libs-release</url>
</pluginRepository>
<pluginRepository>
<snapshots />
<id>spring-snapshot</id>
<name>libs-snapshot</name>
<url>https://artifactory.secret.com/artifactory/libs-snapshot</url>
</pluginRepository>
</pluginRepositories>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile>
I've verified that everything works and our projects install dependencies correctly. This should be all ok.
Now the spring-boot project has repository definitions in root pom.xml, but my settings override it, which means maven is trying to download from our Artifactory (as intended).
But it get's stuck on this dependency
[INFO] -------------< org.springframework.boot:spring-boot-docs >--------------
[INFO] Building Spring Boot Docs 2.2.0.BUILD-SNAPSHOT [80/88]
[INFO] --------------------------------[ jar ]---------------------------------
Downloading from central: https://artifactory.secret.com/artifactory/libs-release/org/apache/geronimo/specs/geronimo-jta_1.0.1B_spec/1.0.1/geronimo-jta_1.0.1B_spec-1.0.1.pom
Downloaded from central: https://artifactory.secret.com/artifactory/libs-release/org/apache/geronimo/specs/geronimo-jta_1.0.1B_spec/1.0.1/geronimo-jta_1.0.1B_spec-1.0.1.pom (737 B at 12 kB/s)
Downloading from central: https://artifactory.secret.com/artifactory/libs-release/org/apache/geronimo/specs/specs/1.1/specs-1.1.pom
Downloading from snapshots: https://artifactory.secret.com/artifactory/libs-snapshot/org/apache/geronimo/specs/specs/1.1/specs-1.1.pom
Downloading from central: https://artifactory.secret.com/artifactory/libs-release/org/apache/geronimo/specs/geronimo-jms_1.1_spec/1.1.1/geronimo-jms_1.1_spec-1.1.1.pom
Downloaded from central: https://artifactory.secret.com/artifactory/libs-release/org/apache/geronimo/specs/geronimo-jms_1.1_spec/1.1.1/geronimo-jms_1.1_spec-1.1.1.pom (2.6 kB at 20 kB/s)
Downloading from central: https://artifactory.secret.com/artifactory/libs-release/org/apache/geronimo/specs/geronimo-jms_2.0_spec/1.0-alpha-2/geronimo-jms_2.0_spec-1.0-alpha-2.pom
Downloaded from central: https://artifactory.secret.com/artifactory/libs-release/org/apache/geronimo/specs/geronimo-jms_2.0_spec/1.0-alpha-2/geronimo-jms_2.0_spec-1.0-alpha-2.pom (4.3 kB at 73 kB/s)
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for Spring Boot Build 2.2.0.BUILD-SNAPSHOT:
[INFO]
[INFO] Spring Boot Docs ................................... FAILURE [ 0.486 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:32 min
[INFO] Finished at: 2019-08-31T17:55:28+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project spring-boot-docs: Could not resolve dependencies for project org.springframework.boot:spring-boot-docs:jar:2.2.0.BUILD-SNAPSHOT: Failed to collect dependencies at org.apache.activemq:activemq-jms-pool:jar:5.15.9 -> org.apache.geronimo.specs:geronimo-jta_1.0.1B_spec:jar:1.0.1: Failed to read artifact descriptor for org.apache.geronimo.specs:geronimo-jta_1.0.1B_spec:jar:1.0.1: Could not find artifact org.apache.geronimo.specs:specs:pom:1.1 in central (https://artifactory.secret.com/artifactory/libs-release) -> [Help 1]
When I look at maven central, the version is there
When I look at central in Artifactory the org.apache.geronimo.specs:specs artifact is also there
But it's never downloaded and cached, there is only 1.4
I've tried purging the whole org.apache.geronimo tree from Artifactory caches and from my local maven cache, but it still only sees the 1.4 version.
Is there some other cache that I should try to refresh? Or is it an Artifactory bug? Thanks
Thanks to #DrorBereznitsky, I was able to figure out the cause of the problem
Using the helpful ?trace as
curl -v -u 'user:password' 'https://artifactory.secret.com/artifactory/libs-release/org/apache/geronimo/specs/specs/1.1/specs-1.1.pom?trace'
I was able to obtain the following logs
Request ID: 9f425b1c
Repo Path ID: libs-release:org/apache/geronimo/specs/specs/1.1/specs-1.1.pom
Method Name: GET
Time: 2019-09-05T15:41:07.877Z
Steps:
2019-09-05T15:41:07.877Z Received request
2019-09-05T15:41:07.877Z Executing any BeforeDownloadRequest user plugins that may exist
2019-09-05T15:41:07.877Z Retrieving info from virtual repository 'libs-release' type Maven
2019-09-05T15:41:07.877Z Consulting the virtual repo download strategy
2019-09-05T15:41:07.877Z Trying to retrieve resource info from the local storage
2019-09-05T15:41:07.879Z Unable to find resource in libs-release:org/apache/geronimo/specs/specs/1.1/specs-1.1.pom
2019-09-05T15:41:07.879Z Intercepting cached virtual resource with 'MavenMetadataInterceptor'
2019-09-05T15:41:07.879Z Intercepting cached virtual resource with 'PomInterceptor'
2019-09-05T15:41:07.879Z Searching for info in aggregated repositories
2019-09-05T15:41:07.879Z Preparing list of aggregated repositories to search in
2019-09-05T15:41:07.879Z Appending the nested virtual repository 'libs-release'
2019-09-05T15:41:07.879Z Appending collective local repositories
2019-09-05T15:41:07.879Z Appending collective local cache repositories
2019-09-05T15:41:07.879Z Appending collective remote repositories
2019-09-05T15:41:07.879Z Appending collective remote repositories
2019-09-05T15:41:07.879Z Appending collective remote repositories
2019-09-05T15:41:07.879Z Appending collective remote repositories
2019-09-05T15:41:07.879Z Appending collective remote repositories
2019-09-05T15:41:07.879Z Intercepting info request with 'MavenMetadataInterceptor'
2019-09-05T15:41:07.879Z Intercepting info request with 'PomInterceptor'
2019-09-05T15:41:07.879Z Processing request as a release resource
2019-09-05T15:41:07.879Z Searching for the resource within libs-release-local
2019-09-05T15:41:07.879Z Unable to find resource in libs-release-local:org/apache/geronimo/specs/specs/1.1/specs-1.1.pom
2019-09-05T15:41:07.879Z Searching for the resource within central-cache
2019-09-05T15:41:07.880Z Unable to find resource in central-cache:org/apache/geronimo/specs/specs/1.1/specs-1.1.pom
2019-09-05T15:41:07.880Z Searching for the resource within repository.spring.milestone-cache
2019-09-05T15:41:07.881Z Unable to find resource in repository.spring.milestone-cache:org/apache/geronimo/specs/specs/1.1/specs-1.1.pom
2019-09-05T15:41:07.881Z Searching for the resource within jcenter-cache
2019-09-05T15:41:07.881Z Unable to find resource in jcenter-cache:org/apache/geronimo/specs/specs/1.1/specs-1.1.pom
2019-09-05T15:41:07.881Z Searching for the resource within jboss-cache
2019-09-05T15:41:07.882Z Unable to find resource in jboss-cache:org/apache/geronimo/specs/specs/1.1/specs-1.1.pom
2019-09-05T15:41:07.882Z Searching for the resource within rabbit-milestone-cache
2019-09-05T15:41:07.882Z Unable to find resource in rabbit-milestone-cache:org/apache/geronimo/specs/specs/1.1/specs-1.1.pom
2019-09-05T15:41:07.882Z Searching for the resource within central
2019-09-05T15:41:07.883Z Unable to find resource in central-cache:org/apache/geronimo/specs/specs/1.1/specs-1.1.pom
2019-09-05T15:41:07.883Z Executing any AltRemotePath user plugins that may exist
2019-09-05T15:41:07.883Z Appending matrix params to remote request URL
2019-09-05T15:41:07.883Z Using remote request URL - https://repo.maven.apache.org/maven2/org/apache/geronimo/specs/specs/1.1/specs-1.1.pom
2019-09-05T15:41:07.883Z Executing HEAD request to https://repo.maven.apache.org/maven2/org/apache/geronimo/specs/specs/1.1/specs-1.1.pom
2019-09-05T15:41:07.906Z Found remote resource with last modified time - Wed Jun 28 09:19:33 UTC 2006
2019-09-05T15:41:07.906Z Found remote resource with ETag - "9bef270e593bf6dcc37a4e3014b5f94a"
2019-09-05T15:41:07.906Z Found remote resource with content length - 13452
2019-09-05T15:41:07.913Z Found remote resource with checksums - [ChecksumInfo{type=SHA-1, original='5274e75bb357203fbc61c529b7bfc174357dbff8', actual='null'}, ChecksumInfo{type=MD5, original='9bef270e593bf6dcc37a4e3014b5f94a', actual='null'}]
2019-09-05T15:41:07.913Z Returning found remote resource info
2019-09-05T15:41:07.913Z Resource was found in central
2019-09-05T15:41:07.913Z Resource is an exact match - returning
2019-09-05T15:41:07.913Z Returning resource as found in the aggregated repositories
2019-09-05T15:41:07.913Z Intercepting found resource with 'MavenMetadataInterceptor'
2019-09-05T15:41:07.913Z Intercepting found resource with 'PomInterceptor'
2019-09-05T15:41:07.913Z The requested resource isn't pre-resolved
2019-09-05T15:41:07.913Z Target repository isn't virtual - verifying that downloading is allowed
2019-09-05T15:41:07.913Z Creating a resource handle from 'central'
2019-09-05T15:41:07.913Z Target repository is configured to retain artifacts locally - resource will be stored and the streamed to the user
2019-09-05T15:41:07.913Z Remote repository is online
2019-09-05T15:41:07.914Z Unable to find resource in central-cache:org/apache/geronimo/specs/specs/1.1/specs-1.1.pom
2019-09-05T15:41:07.914Z Found expired cached resource but remote is newer = false. Cached resource: 0, Remote resource: 1151486373000
2019-09-05T15:41:07.914Z Force expiration on the cached resource = false
2019-09-05T15:41:07.914Z Resource isn't cached and isn't expired = true
2019-09-05T15:41:07.914Z Asserting valid deployment path
2019-09-05T15:41:07.915Z Creating a resource handle from 'central-cache:org/apache/geronimo/specs/specs/1.1/specs-1.1.pom'
2019-09-05T15:41:07.915Z Unable to find the resource - throwing exception
2019-09-05T15:41:07.916Z Unable to find cached resource stream handle, continuing with actual remote download.
2019-09-05T15:41:07.916Z Found no cached resource - starting download
2019-09-05T15:41:07.916Z Downloading and saving
2019-09-05T15:41:07.916Z Eager source JAR fetching enabled = true
2019-09-05T15:41:07.916Z Eager JAR fetching enabled = false
2019-09-05T15:41:07.916Z Valid Maven artifact info = true
2019-09-05T15:41:07.916Z Artifact has classifier = false
2019-09-05T15:41:07.916Z Eager JAR and source JAR fetching is not attempted
2019-09-05T15:41:07.916Z Remote property synchronization enabled = false
2019-09-05T15:41:07.916Z Received remote checksums headers - [ChecksumInfo{type=SHA-1, original='5274e75bb357203fbc61c529b7bfc174357dbff8', actual='null'}, ChecksumInfo{type=MD5, original='9bef270e593bf6dcc37a4e3014b5f94a', actual='null'}]
2019-09-05T15:41:07.916Z Executing any AltRemoteContent user plugins that may exist
2019-09-05T15:41:07.916Z Received no alternative content handle from a user plugin
2019-09-05T15:41:07.916Z Received no alternative content, received remote checksums headers and searching for existing resources on download is enabled
2019-09-05T15:41:07.916Z Searching for existing resource with SHA-1 '5274e75bb357203fbc61c529b7bfc174357dbff8'
2019-09-05T15:41:07.916Z Received no alternative content or existing resource - downloading resource
2019-09-05T15:41:07.916Z Appending matrix params to remote request URL
2019-09-05T15:41:07.916Z Using remote request URL - https://repo.maven.apache.org/maven2/org/apache/geronimo/specs/specs/1.1/specs-1.1.pom
2019-09-05T15:41:07.916Z Executing any BeforeRemoteDownload user plugins that may exist
2019-09-05T15:41:07.916Z Executing GET request to https://repo.maven.apache.org/maven2/org/apache/geronimo/specs/specs/1.1/specs-1.1.pom
2019-09-05T15:41:07.919Z Downloading content
2019-09-05T15:41:07.919Z Saving resource to central-cache
2019-09-05T15:41:07.975Z Failed to download: Failed to read POM for 'org/apache/geronimo/specs/specs/1.1/specs-1.1.pom': expected START_TAG or END_TAG not TEXT (position: TEXT seen ...</developers>\n `\n <p... #91:7) .
2019-09-05T15:41:07.975Z Executing any AfterRemoteDownload user plugins that may exist
2019-09-05T15:41:07.975Z Executed all AfterRemoteDownload user plugins
2019-09-05T15:41:07.975Z Error occurred while downloading artifact: Failed to read POM for 'org/apache/geronimo/specs/specs/1.1/specs-1.1.pom': expected START_TAG or END_TAG not TEXT (position: TEXT seen ...</developers>\n `\n <p... #91:7) .
2019-09-05T15:41:07.976Z Requested resource is found = false
2019-09-05T15:41:07.976Z Request is HEAD = false
2019-09-05T15:41:07.976Z Request is for a checksum = false
2019-09-05T15:41:07.976Z Target repository is not remote or doesn't store locally = false
2019-09-05T15:41:07.976Z Requested resource was not modified = false
2019-09-05T15:41:07.976Z Responding with unfound resource
2019-09-05T15:41:07.976Z Setting default response status to '404' reason to 'Resource not found'
2019-09-05T15:41:07.976Z Response is an instance of UnfoundRepoResourceReason
2019-09-05T15:41:07.976Z Configured to hide un-authorized resources = false
2019-09-05T15:41:07.976Z Original response status is auth related = false
2019-09-05T15:41:07.976Z Using original response status of '404' and message 'Failed to transform pom file: Failed to read POM for 'org/apache/geronimo/specs/specs/1.1/specs-1.1.pom': expected START_TAG or END_TAG not TEXT (position: TEXT seen ...</developers>\n `\n <p... #91:7) .'
2019-09-05T15:41:07.976Z Sending error with status 404 and message 'Failed to transform pom file: Failed to read POM for 'org/apache/geronimo/specs/specs/1.1/specs-1.1.pom': expected START_TAG or END_TAG not TEXT (position: TEXT seen ...</developers>\n `\n <p... #91:7) .'
2019-09-05T15:41:07.976Z Executing any AfterDownloadErrorAction user plugins that may exist
2019-09-05T15:41:07.976Z Response code wasn't modified by the user plugins
2019-09-05T15:41:07.976Z Sending response with the status '404' and the message 'Failed to transform pom file: Failed to read POM for 'org/apache/geronimo/specs/specs/1.1/specs-1.1.pom': expected START_TAG or END_TAG not TEXT (position: TEXT seen ...</developers>\n `\n <p... #91:7) .'
with the interesting part being
Error occurred while downloading artifact:
Failed to read POM for 'org/apache/geronimo/specs/specs/1.1/specs-1.1.pom':
expected START_TAG or END_TAG not TEXT (position: TEXT seen ...</developers>\n `\n <p... #91:7) .
=> They've simply published an invalid POM and that's why Artifactory is unable to download the dependency
my solution was to simply download this file org/apache/geronimo/specs/specs/1.1/specs-1.1.pom and edit it to remove the '`' char, then just upload it manually to my artifactory local repository
I have this repo section:
<repositories>
<repository>
<id>Repo1</id>
<url>http://repo1.maven.org/maven2</url>
<releases>
<enabled>true</enabled>
<checksumPolicy>fail</checksumPolicy>
</releases>
</repository>
<repository>
<id>EclipseLink</id>
<url>http://download.eclipse.org/rt/eclipselink/maven.repo</url>
</repository>
</repositories>
and this dependency:
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-client</artifactId>
<version>1.9.1</version>
<scope>compile</scope>
</dependency>
Why is maven continuously going to download.java.net and maven.glassfish.org ? It's not in my poms anywhere
Downloading: http://download.java.net/maven/glassfish//com/ocpsoft/prettyfaces-parent/3.3.3/prettyfaces-parent-3.3.3.pom
[INFO] Unable to find resource 'com.ocpsoft:prettyfaces-parent:pom:3.3.3' in repository Glassfish (http://download.java.net/maven/glassfish/)
Downloading: http://repo1.maven.org/maven2/com/ocpsoft/prettyfaces-parent/3.3.3/prettyfaces-parent-3.3.3.pom
8K downloaded (prettyfaces-parent-3.3.3.pom)
Downloading: http://download.java.net/maven/glassfish//com/ocpsoft/ocpsoft-parent/2/ocpsoft-parent-2.pom
[INFO] Unable to find resource 'com.ocpsoft:ocpsoft-parent:pom:2' in repository Glassfish (http://download.java.net/maven/glassfish/)
Downloading: http://repo1.maven.org/maven2/com/ocpsoft/ocpsoft-parent/2/ocpsoft-parent-2.pom
1K downloaded (ocpsoft-parent-2.pom)
Downloading: http://repo1.maven.org/maven2/com/sun/jersey/jersey-client/1.9.1/jersey-client-1.9.1.pom
6K downloaded (jersey-client-1.9.1.pom)
Downloading: http://repo1.maven.org/maven2/com/sun/jersey/jersey-project/1.9.1/jersey-project-1.9.1.pom
17K downloaded (jersey-project-1.9.1.pom)
Downloading: http://download.java.net/maven/2/net/java/jvnet-parent/1/jvnet-parent-1.pom
[INFO] Unable to find resource 'net.java:jvnet-parent:pom:1' in repository m2.java.net (http://download.java.net/maven/2)
Downloading: http://repository.jboss.org/nexus/content/groups/public//net/java/jvnet-parent/1/jvnet-parent-1.pom
[INFO] Unable to find resource 'net.java:jvnet-parent:pom:1' in repository repository.jboss.org (http://repository.jboss.org/nexus/content/groups/public/)
Downloading: http://maven.glassfish.org/content/groups/glassfish/net/java/jvnet-parent/1/jvnet-parent-1.pom
185b downloaded (jvnet-parent-1.pom)
[WARNING] *** CHECKSUM FAILED - Checksum failed on download: local = '6c9fd3d150b8a5f0ca676f49b8ed603793cabebb'; remote = '<html>
<head><title>301' - RETRYING
Downloading: http://maven.glassfish.org/content/groups/glassfish/net/java/jvnet-parent/1/jvnet-parent-1.pom
185b downloaded (jvnet-parent-1.pom)
[WARNING] *** CHECKSUM FAILED - Checksum failed on download: local = '6c9fd3d150b8a5f0ca676f49b8ed603793cabebb'; remote = '<html>
<head><title>301' - IGNORING
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error building POM (may not be this project's POM).
Project ID: com.sun.jersey:jersey-project:pom:1.9.1
Reason: Cannot find parent: net.java:jvnet-parent for project: com.sun.jersey:jersey-project:pom:1.9.1 for project com.sun.jersey:jersey-project:pom:1.9.1
EDIT:
As a debug step, I've nuked ~/.m2... I don't know what is going on, but this build used to work.
MOR EDIT:
Ok, so I should have mentioned, the repositories section is in the parent pom and the dependency is in the child pom. If I put the configuration into one big pom it works. Two poms, it fails. What the heck??
EVEN MOR EDIT:
This is absolutely crazy where maven is getting the extra repositories at, I even checked the artifact poms. Anyway, here is my solution to the unexplained behavior. Put this in my settings.xml:
<settings>
<mirrors>
<mirror>
<id>central-mirror</id>
<url>http://repo.maven.apache.org/maven2</url>
<mirrorOf>*,!eclipselink</mirrorOf>
</mirror>
</mirrors>
</settings>
This forces maven to use central, except for when I'm using the eclipselink repo. Sigh, argh!
This is absolutely crazy where maven is getting the extra repositories at, I even checked the artifact poms. Anyway, here is my solution to the unexplained behavior. Put this in my settings.xml:
<settings>
<mirrors>
<mirror>
<id>central-mirror</id>
<url>http://repo.maven.apache.org/maven2</url>
<mirrorOf>*,!eclipselink</mirrorOf>
</mirror>
</mirrors>
</settings>
This forces maven to use central, except for when I'm using the eclipselink repo. This doesn't answer my question, but it's a workaround for whatever crazy reason maven is contacting these external repos.
Repositories can also be specified in your settings.xml and other dependencies' poms. Regardless of which repositories you do directly or indirectly name, maven doesn't guaranty the search order for those repositories, If maven happems to find a bad artifact in one repository, it fails (obviously) and doesn't try any other repositories.
If you can find a good version of the artifact that's giving you trouble, you might try manually placing that artifact in your local .m2 repository.
I have gone to my directory where the project folders and files are and executed a mvn clean and mvn install and yet i get this:
[INFO] Unable to find resource ‘org.eclipse.core:org.eclipse.core.commands:pom:3.5.0.I20090525-2000’ in repository central (http://repo1.maven.org/maven2)
[INFO]-------
[ERROR] BUILD ERROR
[INFO]---------
[INFO] Failed to resolve artifact.
Couldn’t find a version in [1.0.0-v20070606] to match range [1.0.0,2.0.0) org.eclipse.equinox:app:jar:null from the specified remote repositories:
central (http://repo1.maven.org/maven2),
ABC.Pricing.R2(http://mksrvsub.XXXXX/nexus/content/repositories/ABC.pricing.R2),
abc-snapshots(http://artifactory-tmp.xxxxx:8081/nexus/content/groups/repor),
abc123 (http://mksrvsub.XXXXX/nexus/content/repositories/Release),
andromeda (http://artifactory-tmp.xxxxxxx:8081/nexus/content/repositories/andromeda),
path to dependency:
com.xxx:MyServcies:jar:7.7.0-SNAPSHOT
com.xxx:MyBaseServcies:jar:7.7.0-SNAPSHOT
com.xxx:MyStrutsServcies:jar:7.7.0-SNAPSHOT
com.yyy.SomeSpecialService:jar:7.7.0-SNAPSHOT
org.eclipse:get:jar:3.2.100-v20070530
org.eclipse.core:runtime:jar:3.3.100-v20070530
project pom file: link
Info:
Java Version: 1.6.0_26
OS name: windows xp, verison: 5.1 arch:x86,
Apache Maven 2.2.1 (r801777; 2009-08-06 15:16:01-0400)
As you can see Maven cannot resolve dependency org.eclipse.core.commands version 3.5.0.I20090525-2000. Repository http://repo1.maven.org/maven2 does not contain artifact with this version number. Therefore you have to add repository description in your pom file. Something like:
<repositories>
<repository>
<id>jboss-deprecated-repository</id>
<name>JBoss Deprecated Maven Repository</name>
<url>https://repository.jboss.org/nexus/content/repositories/deprecated/</url>
</repository>
...
<repositories>
Also you can read https://community.jboss.org/wiki/MavenGettingStarted-Users