15

When I try to build or compile my Maven project I get the following error message:

[ERROR] Failed to execute goal on project dss-services: Could not resolve dependencies for project net.jnd.thesis:dss-services:jar:0.0.1-SNAPSHOT: Failed to collect dependencies for [log4j:log4j:jar:1.2.16 (compile), org.slf4j:slf4j-api:jar:1.6.4 (compile), org.slf4j:jcl-over-slf4j:jar:1.6.4 (compile), org.slf4j:slf4j-log4j12:jar:1.6.4 (compile), net.sf.flexjson:flexjson:jar:2.1 (compile), commons-beanutils:commons-beanutils:jar:1.8.3 (compile), org.apache.commons:commons-lang3:jar:3.1 (compile), org.eclipse.jetty:jetty-websocket:jar:8.1.4.v20120524 (compile), net.jnd.thesis:dss-common:jar:0.0.1-SNAPSHOT (compile)]: Failed to read artifact descriptor for net.jnd.thesis:dss-common:jar:0.0.1-SNAPSHOT: Could not find artifact net.jnd.thesis:dss:pom:0.0.1-SNAPSHOT -> [Help 1]

During my research I found two possible solutions:

However, the answers provided do not apply because I already re-created the project from zero (and I do not see how changing the name of the directory will help) and because my error message differs from the error messages presented in those specific cases.

I think that my m2e plugin in Eclipse must have some sort of configurations issue and therefore it cannot download nor find the needed Maven artifacts, but I have no idea on how to solve the problem :S

Community
  • 1
  • 1
Flame_Phoenix
  • 16,489
  • 37
  • 131
  • 266

5 Answers5

10

Could you try use only console ?

"mvn clean compile" should be enough to check if problem is with eclipse or not.

Sometimes I had problem with dependencies in some maven project, and usually was because i didn't add a specific repository for them. Some dependencies are not installed in maven central repo, so you must check if your dependencies ara available in this repo. If not, you can add more repositories in your pom in order to tell maven "hey look for my dependencies in this other repo too".

Arun Bertil
  • 4,598
  • 4
  • 33
  • 59
Ignasi
  • 5,887
  • 7
  • 45
  • 81
  • When I use mvn clean compile I get "BUILD SUCCESSFULL", but when i try in Eclipse "Run as -> Maven build -> compile" or Maven Install, I always get an error :S – Flame_Phoenix Sep 09 '13 at 16:01
  • How do I tell Eclipse to look into a certain repository? – Flame_Phoenix Sep 09 '13 at 16:23
  • I still have a lot of problems with the m2e plugin, but at least now I have the project working. Thanks for the help! – Flame_Phoenix Sep 09 '13 at 17:31
  • How do you add more repositories in your pom? I have tried numerous things but it never picks up. – Anton Jan 04 '17 at 13:26
  • @WillByers check this out: http://maven.apache.org/guides/mini/guide-multiple-repositories.html – Ignasi Mar 27 '18 at 13:34
  • @ilopezluna That's where I get all my maven info! I had it listed exactly like this. Do I need to add something to my settings.xml? – Anton Mar 29 '18 at 13:17
6

After a lot of headaches and time I simply realized that there is a huge problem with the m2e plugin and its versions. Thus I solved my problem by making entering the project and making mvn clean compile followed by mvn install.

Thanks for the help anyway!

Flame_Phoenix
  • 16,489
  • 37
  • 131
  • 266
  • 5
    When you tip mvn clean install, compile phase is already executed, so you only need one command. – Ignasi Sep 09 '13 at 18:43
1

Looks like you are missing some Maven repos. Ask for your friend's .m2/settings.xml, and you'll probably want to update the POM to include the repositories there.

prashant.kr.mod
  • 1,178
  • 13
  • 28
0

Try to update the path for settings.xml file in your IDE. Windows--> Preferences -->Maven--> user settings--> navigate to settings file. It worked for me

Jaaz
  • 1
0

I was also facing similar issue for a different dependency. So first check whether all the paths like JAVA_HOME , M2_HOME etc are properly set or not. Than check if you see similar dependency in maven repository or not. In my case , it was not present , so check if you find the jars somewhere and manually put them in your repository folder in .m2 folder. This worked for me .