Where is the set of repositories to search defined in the Dependencies report of the Maven Project Info Reports Plugin? - maven

I have a Maven project that has a dependency on another internal project. At this stage, the version is feature branch snapshot.
When the maven-project-info-reports-plugin generates its "Dependencies" report, it tries to look up the version in several public repositories (see log), eventually failing to do so. I have not configured those repos, neither in the global settings.xml nor in my private one, so where do they come from? How do I get rid of them?
The goal documentation does not mention any parameter that sets the repos to check.
Apparently, this happens to snapshots only. I run mvn from the command line on Ubuntu.
Log snippet:
[INFO] Generating "Dependencies" report --- maven-project-info-reports-plugin:3.4.1:dependencies
Downloading from cdh.snapshots.repo: https://repository.confluent.com/content/repositories/snapshots/com/mycompany/myproject/feature-XYZ-SNAPSHOT/maven-metadata.xml
Downloading from java.net2: http://download.java.net/maven/2/com/mycompany/myproject/feature-XYZ-SNAPSHOT/maven-metadata.xml
Downloading from version99: http://version99.qos.ch/com/mycompany/myproject/feature-XYZ-SNAPSHOT/maven-metadata.xml
Downloading from jitpack.io: https://jitpack.io/com/mycompany/myproject/feature-XYZ-SNAPSHOT/maven-metadata.xml
[WARNING] Could not transfer metadata com.mycompany:myproject:feature-XYZ-SNAPSHOT/maven-metadata.xml from/to cdh.snapshots.repo (https://repository.confluent.com/content/repositories/snapshots): Transfer failed for https://repository.confluent.com/content/repositories/snapshots/com/mycompany/myproject/feature-XYZ-SNAPSHOT/maven-metadata.xml

Related

Maven verify on a sub-module fails with 'dependencies.dependency.version' for some.artefact:jar is missing

In a Jenkins CI job, a single module of a multi-module Maven project is checked out from svn and the following Maven goals are specified:
clean verify pmd:pmd
The build fails with the error message
org.apache.maven.project.ProjectBuildingException: Some problems were
encountered while processing the POMs: [ERROR]
'dependencies.dependency.version' for org.jdom:jdom2:jar is missing. #
line 162, column 21
The missing version is only specified in the main (master) pom, which was not checked out.
To fix this I can check out the whole multi-module project, but are there other options which limit the check-out to only the required files - the master pom.xml and the module?
Additional information: the build worked well in the past, with many other dependency versions which were not specified in the module. All these artefacts were already in the local .m2 repository. Now with a new dependency this error occurs. I guess that it has something to do how Maven handles version matching when artefacts are already installed.
Jenkins offers to perform more than one check-out operation for a Maven build job. In the first one I specifiy the path to main (master) project, and set repository depth to "files". The second contains the module to-be-verified.

At what phase and goal in Maven is the dependencies of the project downloaded?

When I build a maven project, I see in cmd the dependencies download commands, but I do not see in which goal of which plugin the download is performed. And at what phase it happens ?
Resolving dependency is Maven core feature is done during project model build (reading project structure).
So no plugin and no phase is applicable for dependency resolution - it is done before first plugin is run.
When some of dependencies was resolved early and are currently saved in ~/.m2/repository - next downloading will not occurs, so you can not see Downloading from ... for next project build.

maven deploy:deploy-file fails (409 Conflict), yet artifact uploads successfully

NOTE:
I now realize that the jar got placed into my repository, but the pom.xml did not. Now, I have another project where the pom.xml fails to get promoted, but the jar is placed in the repository.
However, another project, both the pom.xml and the jar do get placed in the repository.
I have a project in Jenkins where I use the promotion plugin to deploy my artifacts in Maven via the deploy:deploy-file goal.
This works for several other projects I have in Maven, but it fails for this project. The funny thing is that the file (but not the pom.xml) uploads anyway. I've verified this by removing the artifact from our Maven repository, then running the promotion. The artifact is in our repository after the promotion.
Here's the log I'm getting. Broke up the extra long lines the best I could:
[workspace] $ /bin/bash -xe /opt/tomcat/apache-tomcat-7.0.27/temp/hudson7357923598740079329.sh
+ FILE_LOC=/mnt/jenkins/builds/metricsdb-trunk/21/archive/target/archive
+ mvn deploy:deploy-file
-Dversion=0.8.0
-Dfile=/mnt/jenkins/builds/metricsdb-trunk/21/archive/target/archive/metricsdb-etl.jar
-DpomFile=/mnt/jenkins/builds/metricsdb-trunk/21/archive/target/archive/pom.xml
-Durl=http://repo.vegicorp.com/artifactory/ext-release-local -DrepositoryId=VegiCorp
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Command Line Spring Batch Module 0.8.0.CI-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-deploy-plugin:2.7:deploy-file (default-cli) # metricsdb-etl ---
Uploading: http://repo.vegicorp.com/artifactory/ext-release-local/com/vegicorp/batch/metricsdb/metricsdb-etl/0.8.0/metricsdb-etl-0.8.0.jar
2/38 KB
4/38 KB
[...]
Uploaded: http://repo.vegicorp.com/artifactory/ext-release-local/com/vegicorp/batch/metricsdb/metricsdb-etl/0.8.0/metricsdb-etl-0.8.0.jar (38 KB at 202.2 KB/sec)
Uploading: http://repo.vegicorp.com/artifactory/ext-release-local/com/vegicorp/batch/metricsdb/metricsdb-etl/0.8.0/metricsdb-etl-0.8.0.pom
2/7 KB
4/7 KB
[...]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.243s
[INFO] Finished at: Thu Oct 04 14:38:52 CDT 2012
[INFO] Final Memory: 4M/119M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy-file
(default-cli) on project metricsdb-etl: Failed to deploy artifacts:
Could not transfer artifact com.vegicorp.batch.metricsdb:metricsdb-etl:pom:0.8.0 from/to
VegiCorp (http://repo.vegicorp.com/artifactory/ext-release-local):
Failed to transfer file: http://repo.vegicorp.com/artifactory/ext-release-local/com/vegicorp/batch/metricsdb/metricsdb-etl/0.8.0/metricsdb-etl-0.8.0.pom.
Return code is: 409, ReasonPhrase:Conflict. -> [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
failed build hudson.tasks.Shell#24a6e7f9 SUCCESS
Finished: FAILURE
Output with the debug flag (-X) is in Pastebin.
I found the problem. Two problems actually:
I only had the release repository setup, and I was attempting to save a snapshot release in the release repository. Artifactory was setup to only allow releases in the release repository. This can be modified in the Artifactory setting, but I decided against this.
My pom.xml has a different version in it than I was trying to save it to. For example, the pom.xml said version 2.0 and I was trying to save the release as 2.0.2. Artifactory rejected the pom (but not the jar) for this reason.
I found the Artifactory setting (which is per repository) that asks whether or not to "Suppress POM consistency checks". Checking this box will allow me to set the version to one, but have the pom say another.
I also had to modify my Maven "settings.xml" file to allow for both a Release and Snapshot repository. I also have to modify my URL to the snapshot repository.
We were only using Ivy for a while (which doesn't have a snapshot concept), so we were just putting stuff in the release repository. This is a Maven project, and the developer marked the version in the POM as a SNAPSHOT.
Unfortunately, Maven documentation is pretty poor, and there still aren't any good books on Maven. Even worse is that the error messages are simply poor. What does "409, ReasonPhrase:Conflict. -> [Help 1]" mean?
Not that Ivy documentation is so much better, but Ant in Action has some excellent sections on using Ivy.
Ensure that you include -SNAPSHOT as part of your version if you are publishing to the snapshot repository.
And remove -SNAPSHOT in case you are publishing it to a non-snapshot repository.
Yeah....Multiple Reason for same error. May be it will help somebody
1. Login as Admin to Artifactory
2. Configuration -> Repositories
3. Edit the Local Repository ---> Suppress POM Consistency Checks
This solves my problem.... Not sure. Right approach or not ?
I also face this problem, and I found the reason is the parent project didn't deploy in the snapshot repository.
I run mvn deploy in the parent folder, and the problem resolved.
Had that error message too. For me the problem was that the setup of the server is to accept only release, not SNAPSHOT. After removing the SNAPSHOT from the pom, it worked fine.
In my case the POM file associated with the jar file (external, in same dir) had a dependency to itself. This was a offline zipped repo from a third party that I needed to load into artifactory.
I modified the POM files, removed the self-dependency and made sure the package info was right. Then artifacts deployed with no problems. Sent email to vendor so they can fix in their build.
I had this issue as well and it turned out that we had include/exclude rules set up on the repository I was trying to deploy to and my deployment didn't match those rules.
My solution was to point the deployment at a new repository that had **/* as the include rule (and the pattern from my other repository as an exclude rule to keep them separate).
I have been experiencing the same problem.
(TL;DR: solution see last line)
During the deploy from jenkins to Artifactory, sometimes (magic!) a 409 - conflict error appeared with the following error message on the Artifactory log:
[WARN ] (o.a.e.UploadServiceImpl:239) - Sending HTTP error code 409: Checksum policy 'LocalRepoChecksumPolicy: CLIENT' rejected the artifact 'gradle-integration:com.redacted.java/fooProject/123/foo-123.jar'. Checksums info: ChecksumsInfo{checksums={SHA-1=ChecksumInfo{type=SHA-1, original='da39a3ee5e6b4b0d3255bfef95601890afd80709', actual='1459689f0be058f4ecef7e6fe3576f1550a8afda'}, MD5=ChecksumInfo{type=MD5, original='d41d8cd98f00b204e9800998ecf8427e', actual='14c7a498de028d6eb5882b3c698bc456'}}}.
As the trained eye might notice: The MD5# d41d8cd98f00b204e9800998ecf8427e is the checksum for an empty file or string.
Which means that the following must be happening:
The copy job that prepares the Artifacts in the publish folder had not finished and therefore the file was empty when the checksum was calculated.
However when the deploy happened the file was there, Artifactory now receives a checksum which is incorrect and correctly refuses the file with the error code 409.
THE SOLUTION (is simple):
Make 100% sure the files are definitely there before you start the deploy job (add a pause or proper logic).
There is a good possibility that the space on your remote repo is full. Verify that before going all technical and wasting time. Wasted 2-3 hrs thinking its a logical problem.
In my case the root cause for that very error was dependency version property that was not in the root pom.
The solution was moving the property to root pom where the version for the dependency was required.
So, missing version property of a dependency.
Very misleading error message indeed.
The world snapshot was written in lower case inside the pom.xml file. It must be written in upper case.
Ali

Maven build : How to resolve the workspace artifacts without installing them to repo and without using m2eclipse

I've worked a little with m2eclipse in Eclipse Indigo and now I'm trying to use Maven from command line without Eclipse and without m2eclipse plugin. The m2eclipse has abililty to resolve the artifacts from the workspace without installing them to repository and this feature allows me to run my build without problems in Eclipse , but in CMD I'm getting the errors of missing jars.
[WARNING] The POM for AAA_7.1.1:ConfigurationView:jar:0.0.1-SNAPSHOT is missing, no dependency information available
[WARNING] The POM for AAA_7.1.1:Beans:jar:0.0.1-SNAPSHOT is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[ERROR] Failed to execute goal on project Client: Could not resolve dependencies for project AAA_7.1.1:Client:pom:0.0.1-SNAPSHOT:.......
Our goal is to keep the repo clean as much as possible , that's the reason why I'd like to keep it working in a such way.
So my question is how to resolve the dependencies without installing them to repo and if it's possible at all?
IMO, the standard way to go with Maven is mvn clean install.
But if I understand well your problem, you want to keep your local repository as clean as possible ?
One way to do that would be to use multiple local repositories, but I don't think it's possible at the moment (Maven 3.0).
However you can use alternate local repo with -Dmaven.repo.local or alternate settings with mvn --settings (see answer).
See also :
Previous question : maven workspace local repository
JIRA : Allow multiple local repositories (Unresolved)
Local repository separation -> workspaces don't seem to be implemented at the moment...
Basically you want a maven build, where the reactor contains all your 97 modules. To do this:
Create a parent, which contains all those 97 modules as children (if you are already multi module, you just need to configure the already existing parents to be the children of this new parent). Than start your build at that new parent. The convention is normally to have the parent in the upper directory. But you may also use relative paths that contain .. for the module location specification. There is also no need to inherit from the new parent in the existing parents. So you do not need to change any of the existing poms.

Maven 3 dependency resolution fails until maven-metadata-local.xml files are deleted [maven-invoker-plugin related]

In one of my Maven projects, dependency resolution will succeed once, then fail for later build attempts:
[WARNING] The POM for commons-logging:commons-logging:jar:1.1.1 is missing, no dependency information available
[WARNING] The POM for commons-httpclient:commons-httpclient:jar:3.1 is missing, no dependency information available
[WARNING] The POM for javax.mail:mail:jar:1.4.4 is missing, no dependency information available
…and so on, until I delete the maven-metadata-local.xml files corresponding to the failing artifacts (e.g. ~/.m2/repository/commons-logging/commons-logging/maven-metadata-local.xml). After those files are deleted, the next mvn invocation proceeds properly; the metadata files are restored by that invocation (presumably as part of the process of checking my upstream repositories/mirrors for updated artifacts), and I am again presented with the above errors until I again delete the metadata files.
This impacts multiple projects, though it appears to be limited to a particular set of dependencies. I suppose I could go nuclear and blow away my local repo, but I'd like to understand what the problem is.
Thoughts?
Update: It looks like it's the maven-invoker-plugin (which these builds are using for general-purpose integration testing) that is producing these maven-metadata-local.xml files. I'm not using an integration-testing-only local repo as described here, simply because doing so causes the re-downloading of all transitive dependencies (unless you want to maintain an integration-specific settings.xml file!!!). I've used the invoker plugin with a variety of other projects in this way with good results -- certainly never encountering a wedged local repository in the process like this.
Update 2 OK, this is repeatable, even after starting with a completely fresh local repository. This is on OS X, Java 1.6.0_24 with Maven 3.0.3; note that Maven 2.2.1 does NOT exhibit this problem.
Here's one of the projects in question: the 1.3.0-compat branch of rummage. To reproduce:
> mvn clean test
# no error -- can run this and other builds that don't involve maven-invoker-plugin all day w/o problems
> mvn clean integration-test
# FAIL: "Could not resolve dependencies", with warnings as noted above
> mvn clean test
# FAIL: "Could not resolve dependencies", with warnings as noted above
Once the local repository is borked (by the generation of the maven-metadata-local.xml files, AFAICT), no builds will get past the dependency resolution stage.
Running mvn -X reveals lines like this for each artifact that is later apparently not found:
[DEBUG] Verifying availability of /Users/chas/.m2/repository/javax/mail/mail/1.4.4/mail-1.4.4.jar from []
Of course, /Users/chas/.m2/repository/javax/mail/mail/1.4.4/mail-1.4.4.jar et al. does exist, as does /Users/chas/.m2/repository/javax/mail/mail/1.4.4/mail-1.4.4.pom. Totally puzzled. At this point, I'm assuming this is a bug in Maven 3 (or some underlying library), now that I see that 2.2.1 is clean.
Update 3 Bug report filed with Maven project.
This issue is resolved in aether 1.12, one rev above the aether 1.11 library that ships with Maven 3.0.3. Replacing aether 1.11 with 1.12 in one's Maven install results in expected behaviour (as noted in the bug I filed). Here's hoping Maven 3.0.4 is released with aether 1.12 ASAP. :-)
you do not mention what you may have tried, so maybe you didn't try this one: adding the -U option to force update ? (tho maybe this -U option is only relevant for SNAPSHOTs ...)
I've seen similar errors caused by corrupted files in my local repository. For example, if a download failed partway through, or a file in a remote repository changed after I downloaded it. Deleting the affected directories under ~/.m2 fixed it.

Resources