Errors in pom.xml with dependencies (Missing artifact...) - maven

A friend has passed me a Maven project that I'm trying to run locally in my computer. All that I have done in Eclipse, I selected:
File -> Import -> Existing Maven Projects
After that, the project showed me 4 errors in my pom.xml (Missing artifact..):
I tried removing the content of .m2 folder and then in Eclipse I clicked on my project and chose "Run as" -> "Maven clean" and then "Run as" -> "Maven install". But I still have the same errors. I'm new with Spring so I dont know what else to do.
EDIT:
When I try to do: run as/ maven install, this is what my console says:
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building DataLayer 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for javax.persistence:javax.persistence:jar:1.0.0 is missing, no dependency information available
[WARNING] The POM for hibernate-core:hibernate-core:jar:4.2.1.Final is missing, no dependency information available
[WARNING] The POM for hibernate-commons-annotations:hibernate-commons-annotations:jar:4.0.1.Final is missing, no dependency information available
[WARNING] The POM for jboss-logging:jboss-logging:jar:3.1.0.CR2 is missing, no dependency information available
[WARNING] The POM for jta:jta:jar:1.1 is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.065s
[INFO] Finished at: Wed Aug 07 11:41:45 VET 2013
[INFO] Final Memory: 4M/90M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project DataLayer: Could not resolve dependencies for project SocialManager:DataLayer:jar:0.0.1-SNAPSHOT: The following artifacts could not be resolved: javax.persistence:javax.persistence:jar:1.0.0, hibernate-core:hibernate-core:jar:4.2.1.Final, hibernate-commons-annotations:hibernate-commons-annotations:jar:4.0.1.Final, jboss-logging:jboss-logging:jar:3.1.0.CR2, jta:jta:jar:1.1: Failure to find javax.persistence:javax.persistence:jar:1.0.0 in http://repository.jboss.org/nexus/content/groups/public/ was cached in the local repository, resolution will not be reattempted until the update interval of JBoss repository has elapsed or updates are forced -> [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.
EDIT2: This is my complete pom.xml: https://dl.dropboxusercontent.com/u/31349296/pom.xml It looks pretty awful when I try to paste the code here.

It seemed that a lot of dependencies were incorrect.
Download the whole POM here
A good place to look for the correct dependencies is the Maven Repository website.

I know it is an old question. But I hope my answer will help somebody. I had the same issue and I think the problem is that it cannot find those .jar files in your local repository. So what I did is I added the following code to my pom.xml and it worked.
<repositories>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/libs-milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>

It means maven is not able to download artifacts from repository.
Following steps will help you:
Go to repository browser and check if artifact exist.
Check settings.xml to see if proper respository is specified.
Check proxy settings.

This is a very late answer,but this might help.I went to this link and searched for ojdbc8(I was trying to add jdbc oracle driver)
When clicked on the result , a note was displayed like this:
I clicked the link in the note and the correct dependency was mentioned like below

I was running into this trying to resolve a separate issue with a Maven/Java/Selenium/Cucumber project. For some reason, even though the Maven repo page for com.google.guava snippet had this in it, I resolved this by removing bundle from it.
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>31.1-jre</version>
<!--type>bundle</type-->
</dependency>
Exact error message:
Missing artifact com.google.guava:guava:bundle:31.1-jre
I also found this article helpful.
How to Debug Dependency Conflicts in Maven and Gradle

I somehow had this issue after I lost internet connection. I was able to fix it by updating the Maven indexes in Eclipse and then selecting my project and updating the Snapshots/releases.

SIMPLE..
First check with the closing tag of project. It should be placed after all the dependency tags are closed.This way I solved my error.
--Sush
happy coding :)

In my case, My STS was pointing to JRE. I have modified the build path to connect with JDK.
Once I connected to JDK, the pom.xml issue was resolved.

Related

Maven+Tycho POM-less Unresolved dependencies for Eclipse XMLEditor Example Project

I have been stumped by this for close to a week. I am trying my had at creating an eclipse editor plugin for one of my company's DSLs.
I followed this tutorial to set up a plug-in, feature and update site. Clean and verify works as expected since there really isn't anything there! I do get a warning about a plugin having to contain at least one extension or extension point.
I then add an extension using the Extension Wizard in Eclipse for the basic XML Editor:
This adds 4 dependencies:
Now when I run mvn clean verify I get errors about not being able to resolve the dependencies:
[INFO] Scanning for projects...
C:\ui\bundles\com.mycompany.example.ui.editors.ontology\.polyglot.build.properties
C:\ui\features\com.mycompany.example.ui.feature\.polyglot.build.properties
[INFO] Computing target platform for MavenProject: com.mycompany.example.ui:com.mycompany.example.ui.editors.ontology:1.0.0-SNAPSHOT # C:\ui\bundles\com.mycompany.example.ui.editors.ontology\.polyglot.build.properties
[INFO] Resolving dependencies of MavenProject: com.mycompany.example.ui:com.mycompany.example.ui.editors.ontology:1.0.0-SNAPSHOT # C:\ui\bundles\com.mycompany.example.ui.editors.ontology\.polyglot.build.properties
[INFO] {osgi.os=win32, osgi.ws=win32, org.eclipse.update.install.features=true, osgi.arch=x86_64}
[ERROR] Cannot resolve project dependencies:
[ERROR] Software being installed: com.mycompany.example.ui.editors.ontology 1.0.0.qualifier
[ERROR] Missing requirement: com.mycompany.example.ui.editors.ontology 1.0.0.qualifier requires 'osgi.bundle; org.eclipse.core.runtime 0.0.0' but it could not be found
[ERROR]
[ERROR] See http://wiki.eclipse.org/Tycho/Dependency_Resolution_Troubleshooting for help.
[ERROR] Cannot resolve dependencies of MavenProject: com.mycompany.example.ui:com.mycompany.example.ui.editors.ontology:1.0.0-SNAPSHOT # C:\ui\bundles\com.mycompany.example.ui.editors.ontology\.polyglot.build.properties: See log for details -> [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/MavenExecutionException
In the parent project POM I have the eclipse release repository like so:
<properties>
<eclipse-repo.url>https://download.eclipse.org/releases/2019-06/</eclipse-repo.url>
</properties>
<repositories>
<repository>
<id>eclipse-release</id>
<url>${eclipse-repo.url}</url>
<layout>p2</layout>
</repository>
</repositories>
Any help would be greatly appreciated! I also know about Xtext, but we already have a bunch of parsing/modeling/validation infrastructure and I was hoping to use this as the backbone of the editor instead of re-creating the DLS in xtext just to get an editor and then having two grammars to keep in sync.
there is another Bug in Maven 3.6.1 (https://issues.apache.org/jira/browse/MNG-6642) that prevents
<repository>
<id>eclipse-release</id>
<url>${eclipse-repo.url}</url>
<layout>p2</layout>
</repository>
from working. so use 3.6.0 (or 3.6.2 if you find a workaround for that other bug)
or you use a real target platform instead of that repo list
https://wiki.eclipse.org/Tycho/Target_Platform#Target_files

Maven can't find dependencies [dependencyResolutionException]

I added a Maven dependency to my project and my project compiles locally, while it doesn't compile on server. It can not resolve the newly added dependency.
This is my pom.xml file:
<repositories>
<repository>
<id>rep</id>
<name>Repository</name>
<url>http://artifacts.com/rep</url>
<releases>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</releases>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.project.rest</groupId>
<artifactId>common</artifactId>
<version>2.0.5</version>
</dependency>
</dependencies>
And this my console output with an error:
Downloading: http://artifacts.com/rep/com/project/rest/common/2.0.5/common-2.0.5.pom
[WARNING] The POM for com.project.rest:common:jar:2.0.5 is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.154s
[INFO] Finished at: Tue Feb 03 06:58:35 BRT 2015
[INFO] Final Memory: 9M/152M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project server: Could not resolve dependencies for project org.server:
server:jar:2.5.1-SNAPSHOT: The following artifacts could not be resolved: com.project.rest:common:jar:2.0.5:
Could not find artifact com.project.rest:common:jar:2.0.5 in rep (http://artifacts.com/rep) -> [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/DependencyResolutionException
(I hid all real URLs and package.)
What could be the problem?
The first line "Downloading:..." only says that maven tries to download the artifact. It is no statement about success. If maven is successful you will get another line starting with "Downloaded: ..."
So in your case maven was not able to download the file. Check the logged url in your browser if it does exist and if it is protected.
BTW <updatePolicy>always</updatePolicy> is quite uncommon for release repos, because releases should not change any more.
Make sure your repository is configured properly. Try to search, in your repo, for
com.project.rest:common of version 2.0.5.
Is this your own project? some jar that you have built? are you sure you deployed it to your repo? if it is not in your repo, try to search for it in your local repo (usually .m2/repository/com/project...)
DependencyResolutionException
(source: Maven Confluence)
This error generally occurs when Maven could not download dependencies. Possible causes for this error are:
The POM misses the declaration of the <repository> which hosts the artifact.
The repository you have configured requires authentication and Maven failed to provide the correct credentials to the server. In this case, make sure your ${user.home}/.m2/settings.xml contains a <server> declaration whose <id> matches the <id> of the remote repository to use. See the Maven Settings Reference for more details.
The remote repository in question uses SSL and the JVM running Maven does not trust the certificate of the server.
There is a general network problem that prevents Maven from accessing any remote repository, e.g. a missing proxy configuration.
You have configured Maven to perform strict checksum validation and the files to download got corrupted.
Maven failed to save the files to your local repository, see LocalRepositoryNotAccessibleException for more details.
In Maven 3 if you just had a failed download and have fixed it (e.g. by uploading the jar to a repository) it will cache the failure. To force a refresh add -U to the command line.
In case of a general network-related problem, you could also consult the following articles:
Configuring a Proxy
Security and Deployment Settings
Guide to Remote Repository Access through Authenticated HTTPS
The project you mentioned doesn't contains POM i.e. it is not a MAVEN project. The .m2(look this at c drive or where you have installed) repository contains all the dependencies folders look there whether it contains the required project or not i.e. com.project.rest.
Like suggested by console output, you can check the Maven Wiki page (http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException) for more information on where the problem might lay.
Given the information you provided. I would guess we are looking at the point one issue:
The POM misses the declaration of the which hosts the artifact.
Maven repositories are of three types: local, central and remote.
In your case, your local repository contains the project specific artifacts, but the central repository doesn't.
Local repository is on your local machine. When you run a Maven build, Maven automatically downloads all the dependency jars into the local repository.
Central repository is web repository provided by a community and it contains a number of commonly used libraries, found here https://repo1.maven.org/maven2/.
Remote repository is developer's own custom repository containing required libraries or other project jars. Developer defines these repositories in POM file using tags.
I would suggest the following:
check your repository tag, if the repository is correct
check if the repository contains the artifacts specified in your dependency tag
If you are using IntelliJ IDE (Jetbrains) and code is correct then
Check the TOGGLE OFFLINE MODE button. If we enable offline mode, then IDE do not let maven download a dependency and it cannot found the library that causes error.
So make sure your project is build in ONLINE mode.

Maven Jenkins Plugin POMs missing for dependency information on JARs

I have been trying to follow the tutorial here: https://wiki.jenkins-ci.org/display/JENKINS/Plugin+tutorial
I have spent about 7 hours on this now and finally decided to just ask and hope for a response.
I haven't edited the pom file at all from the create command. I am pretty sure I have my settings file correct. When I try to run or package the project though I get this:
[WARNING] The POM for org.apache.maven.surefire:surefire-booter:jar:2.9 is missing, no dependency information available
[WARNING] The POM for org.apache.maven.surefire:maven-surefire-common:jar:2.9 is missing, no dependency information available
[WARNING] The POM for org.apache.maven:maven-toolchain:jar:2.0.9 is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 8.260s
[INFO] Finished at: Tue Jan 29 16:07:56 EST 2013
[INFO] Final Memory: 41M/387M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.9:test (default-test) on project helloworld: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.9:test failed: Plugin org.apache.maven.plugins:maven-surefire-plugin:2.9 or one of its dependencies could not be resolved: The following artifacts could not be resolved: org.apache.maven.surefire:surefire-booter:jar:2.9, org.apache.maven.surefire:maven-surefire-common:jar:2.9, org.codehaus.plexus:plexus-utils:jar:2.1: Failure to find org.apache.maven.surefire:surefire-booter:jar:2.9 in http://repo.jenkins-ci.org/public/ was cached in the local repository, resolution will not be reattempted until the update interval of repo.jenkins-ci.org has elapsed or updates are forced ->
So I am assuming that it is supposed to be downloading these 3 jar files from the repositories I set up in the settings file... but it isn't. Is there any reason this would happen? Anything I can do to make it download these files? Or is it downloading them I am just not referencing them correctly somewhere? I'm pretty new to this so i could be completely off.
If it helps I have maven 3.0.4 and jdk 1.7.0_02. Everything else I have pretty much copy and pasted from the tutorial I think. Any help would be greatly appreciated!
Something went probably wrong when you attempted to get the artefacts the first time, and now you are stuck because of a nasty maven bug. Maven might have created an empty folder in your local repository (.m2) and now thinks you already have the dependency. So you should check if this is what happened and, if so, deleted the folder.
See my answer here :
Compiler error "archive for required library could not be read" - Spring Tool Suite
And you can also check why there was a problem in the first place. Do you access the following url with your browser ?
http://repo.jenkins-ci.org/public/org/apache/maven/surefire/surefire-booter/2.9/

Get the dependency tree of a maven project with a missing dependency

First of all, let me start by saying mvn dependency:tree does not work in my scenario.
I'm working on an already existing codebase which is giving a build failure. The issue was that the maven repos (including nexus) does not have a POM for a transitive dependency (org.apache.ws.security:wss4j:pom:1.5.2) in this project.
I want to find where this dependency came from. It's probably a transitive dependency, because it isn't listed in the project's pom nor in parent poms. Invoking mvn dependency:tree does not work because it also fails with the same error I get when I use mvn install (Connection timeout). The error is given below.
So, how can I identify which dependency tries to download this pom? I'd like a general answer to find the dependency tree rather than focusing on wss4j pom stated above.
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Sample/XKMS 4.5.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
Downloading: http://ws.zones.apache.org/repository2/org/apache/ws/security/wss4j/1.5.2/wss4j-1.5.2.pom
[WARNING] The POM for bouncycastle:bcprov-jdk13:jar:132 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3:10.155s
[INFO] Finished at: Wed Mar 14 10:35:20 IST 2012
[INFO] Final Memory: 7M/490M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project wso2appserver-samples-xkms: Could not resolve dependencies
for project org.wso2.appserver:wso2appserver-samples-xkms:jar:4.5.0-SNAPSHOT: Failed to collect dependencies for [org.wso2.xkms:xkms:jar:2.2 (compile)]: Failed to read artifact descriptor for org.apache.ws.security:wss4j:jar:1.5.2:
Could not transfer artifact org.apache.ws.security:wss4j:pom:1.5.2 from/to ws-zones-repository (http://ws.zones.apache.org/repository2): Error transferring file: Connection timed out -> [Help 1]
mvn dependency:tree --debug
outputs the tree before failing in my case.
One way to find this out, is to install the m2eclipse Maven plugin for Eclipse. (If you have and are using Eclipse, that is.) The name is unrelated to the version; it works happily with at least Maven 2.2.1 and 3.
http://www.eclipse.org/m2e/
Then, open your root pom in Eclipse, and click on the Dependency Hierarchy tab. On the right-hand side will be all the dependencies the project will download, and on the left is what dependencies ask for what. If a dependency says (managed from X), it means another dependency wants a different version of this dependency This isn't flawless, however. I still had too look at some of the other poms to find the dependency I was looking for. But it should make life easier, and at least point you in the right direction.

Jenkins (hudson) plugin development meet maven-enforcer-plugin:1.1-SNAPSHOT issue

I try to develop one jenkins (a.k.a hudson) plugin, and follow the Tutorial, and generated source code tree after mvn -cpu hpi:create command.
While when I do "mvn package", it reports error like
[INFO] Building Unnamed - com.example.jenkins:redmine2:hpi:1.0-SNAPSHOT
[INFO] task-segment: [clean]
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error building POM (may not be this project's POM).
Project ID: org.apache.maven.plugins:maven-enforcer-plugin
Reason: Error getting POM for 'org.apache.maven.plugins:maven-enforcer-plugin' from the repository: Failed to resolve artifact, possibly due to a repository list that is not appropriately equipped for this artifact's metadata.
org.apache.maven.plugins:maven-enforcer-plugin:pom:1.1-SNAPSHOT
from the specified remote repositories:
nexus (http://maven.nexus.local:8888/nexus/content/groups/public)
for project org.apache.maven.plugins:maven-enforcer-plugin
From my nexus server, it has maven-enforcer-plugin:1.0 version only, but this dependence is generated from jenkins by default, anyone can help me to solve it ?
(How) Can I change to plugin-1.0 version.
what can I add in nexus server
I just have basic knowledge of maven.
I fixed it by myself by doing two things.
1. Added Apache snapshot from here into my nexus repo group besides those setting in Tutorial
2. It seems my local maven repo is messed up as well, so I can clean it up and reload from nexus.
And it still use maven-enforcer-plugin:pom:1.1-SNAPSHOT plugins.
Hope it helps you as well.

Resources