Maven transitive dependency not found. Leads to build error - maven

I'm trying to build a Java project with Maven. My pom.xml includes mainly dependencies, some of which have their own transitive depedencies.
When I run 'mvn compile' most dependencies are loaded fine, but some of the transitive ones are not found, giving the warning "[WARNING] The POM for artifact_name is missing, no dependency information available". This leads to the Maven compile to fail.
The logs show, that the dependencies have been searched from Maven and Jboss public repositories.
What can I do in this situation, when a transitive dependency is not found?
How can I determine what dependency requires this transitive dependency? Command 'mvn dependency:tree' does not work, as it ends in build failure
Thanks in advance!
EDIT: I decided to delete all changes made to the pom.xml and downloaded the original one. After that the warnings with the transitive dependencies went away. So it seems that the issue was possibly with the syntax or some other change in the pom.xml.

I decided to delete all changes made to the pom.xml and downloaded the original one from our repository. After that the warnings with the transitive dependencies went away. So it seems that the issue was probably with the syntax or some other change in the pom.xml

Related

Build gradle dependency tree without downloading jars

A jar has been removed from organization's repository for being unsafe, but we can download its pom. We are trying to figure which dependencies of a project are dependent on it. Tried running gradle dependencies but that doesn't complete due to the same missing jar.
Is there any gradle command or something similar to create dependency tree for the project without trying to download jars? As far as I understand, creating dependency tree should only require POMs. Please correct me if I am wrong. I am somewhat new with gradle.

Getting an error "Missing artifact com.beust:jcommander:jar:1.66" in maven pom.xml file.Any suggestion how to resolve this?

I have added the required dependencies in maven pom.xml file.
Downloaded the dependencies in pom.xml file via Maven Install option
Updated the project.
After updating the project, i found the error message "Missing artifact com.beust:jcommander:jar:1.66" in pom.xml file.
I have tried including the dependency of jcommander 1.66 version in pom.xml file but there is no change.
Any suggestions would be of great help. Thanks
Maven does not only need the dependencies in your POM, but also the transitive dependencies, i.e. their dependencies, the dependencies of their dependencies and so on.
This is why you let Maven connect to standard Maven repositories like MavenCentral. Except for unavailable artifacts, manual installation of artifacts should be avoided.

Maven Could not resolve dependencies

Now, i have a project which runs fine on my windows computer. But after I copied it to a linux computer, when compiling it reports following error:
Failed to execute goal on project alert: Could not resolve dependencies for project com.cloud.ras:alert.
The POM for com.external:commons-logging:jar:1.0.4.1 is missing, no dependency information available
The POM for com.external:freemarker:jar:2.3.4 is missing, no dependency information available
The POM for com.external:log4j:jar:1.2.14 is missing, no dependency information available
The POM for com.soa.lib:eBoxServiceCommon:jar:2.5.3 is missing, no dependency information available
but i have copied these jars to the maven repository. And can anyone give me a help?
You should NOT copy JARs in the first place. That's Maven job to resolve the dependencies for you.
It would be helpful if you explain the reason why you need to use your own groupId e.g. com.external in the first place i.e. commons-logging is from Apache but you use com.external as its groupId.
If you really insist on wanting to use your own groupId, at least download the JAR and install it using Maven. See here:
http://maven.apache.org/guides/mini/guide-3rd-party-jars-local.html.

How to find out which maven artifact/plugin is requesting for the download of a no longer available dependency

I was compiling an "old" open sourced project, while encountered this problem:
[ERROR] Failed to execute goal on project .... Can not transfer artifact x:y:z from ...
the artifact x:y:z is not found from all repositories defined in the project pom.xml.
After looked up the effective pom.xml, I could not find any references to x:y:z.
How can I find out which artifact or plugin is requesting a missing dependency without analyze all transitive dependencies?
If you use eclipe - you can see dep tree like this: open pom.xml and tick "Dependency Hierarchy" tab.
Also you can try to use mvn dependency:tree but I am not totally sure that it will work if some of your deps are missing.
UPDATE: seems like both eclipse and dependency:tree require sucessfull artifact resolution to work whch is not your case.
In this case I guess you're left with 3 opttions:
clean your cache (wipe everything under ~/.m2/repository), run your build and do occurence search (search for something like "problematic-artifact-id") on files in your ~/.m2/repository. One or couple of the artifacts should reference the problematic artifact in their pom. This should give you a hint.
clean your cache and run your build with -X switch. This will put maven in verbosity mode and you should find some hints about what might reference dead dependency (point your attention on download order, what artifacts got resolved, check dependencies of resolved artifacts in their poms)
dumb as hell - comment/uncomment deps in your pom and see what causes the mentioned error.

Maven POM error - POM is missing

I am trying to build a maven project. My other team members are able to build it without issues. I get the following errors:
[WARNING] The POM for org.hectorclient:hector-core:jar:1.0-3 is missing, no dependency information
available
[WARNING] The POM for org.hectorclient:hector-test:jar:1.0-3 is missing, no dependency information
available
Then the build fails with the error: Could not resolve dependencies for the project XYZ. What could be possibly going wrong?
Surely the jar is missing from your .m2 local repository.
Assuming the dependency is written in the pom.
What I suggest:
Case: When you have internet
fire mvn install that will follow your POM.xml and it will download all the necessary jars.
then fire mvn compile to build.
Case: You are having restricted internet connection that is restricting / no Internet
Take the repository + POM from other machine that is compiling successfully
then fire mvn -o compile
I assume it will solve your case.
#Vaibs You are correct. Adding to your answer:
"Check the settings.xml of yours and the others. If you are not able to download the dependencies from internet like the one you mentioned due to some reason then you will need to set up maven somewhere else and and fire "mvn install" there to get the latest dependencies and put those .m2 into yours."

Resources