Maven Could not resolve dependencies - maven

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.

Related

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 build giving "[WARNING] The POM for sqljdbc:sqljdbc:jar:4 is missing, no dependency information available" from jenkins CL server

I am using Jenkins to perform build and test to my maven project. but while build process i am getting this issue "[WARNING] The POM for sqljdbc:sqljdbc:jar:4 is missing, no dependency information available", how to resolve it...for jenkins CL server
sqljdbc.jar is not available in maven central. It is possible that someone in your organization has uploaded it manually in your artifactory or nexus. The correct way is to use artifactory or nexus user interface. This will auto add pom.xml which is used to download transitive dependency.
I think its a warning since maven assumes that transitive dependency problem will probably be caught as compilation failure.

What is the purpose of providing a downloaded pom.xml on mvnrepository.com

On mvnrepositry, when you search for a certain module, there's a link to download the binary. For some versions it has a pom.xml file available for download instead of the jar. What are you supposed to do with that pom.xml? It seems like if I specify a version that does not have a downloadable jar, but instead downloadable pom.xml, my maven build will fail. Is what I'm seeing correct?
Modules that only have pom files are maven modules with pom packaging. They are used to aggregate multiple modules into one unit. You can use such a module as a dependency for your maven project. Maven will download the pom file, analyze the dependencies included in that pom file and download those & add it to your automatically.
Even modules that have jars (jar packaging) have a pom file associated with them. This pom file defines the other dependencies that are required for using it. Maven will automatically process and fetch those dependencies (transitive dependencies).
This makes specifying and managing dependency for any project. You will specify the top level modules that your projects directly depends on and other things required will automatically figured out and downloaded. It also makes it easier when you have upgrade to a new version - all the transitive dependencies will get upgraded automatically.
One of the reason that cause this is because of licensing issue.
License for such JARs prohibit public redistribution in such approach. So someone provide only the POM so that you can get the JAR yourself and install it to your local maven repo/ internal repo, together with the POM provided.

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."

maven dependency resolving problem

maven is downloading every dependency when doing ' mvn clean package' . along with the dependencies , its also trying to download maven-metadata.xml with each dependency. In my system maven is not able to download this maven-metadata.xml . Does anyone know , what is this maven-metadata.xml ? and the possibilities of download failure ?
maven-metadata.xml is required only if you do not know the group id, artifact id and version information. Please post your pom.xml here. There could be some issues with it. Also, ensure your local Maven repository (on Windows, D:\Documents and Settings\user.name.m2\repository) contains the needed dependencies.
For example, log4j can be considered correctly installed locally only if the repository\log4j\log4j\1.2.12 folder contains a Jar file and POM file. When these two are present and you mention artifact id, group id and version correctly in pom.xml, Maven will pick up the jar file locally and will NOT download each time you build.

Resources