1

I am trying to add log4j as a Maven Dependency. So I added it to the pom.xml

<dependency>
    <groupId>log4j</groupId>
    <artifactId>log4j</artifactId>
    <version>1.2.15</version>
</dependency>

Now I have a warning message that I am missing 6 artifacts (jars that log4j depends on). As described on the following site Maven Repository - log4j.

My goal is to get Maven to install the 6 dependencies for me. I have Eclipse Kepler with embedded Maven, so I cannot run "mvn install". I see from this stackoverflow answer Run Maven Install in Eclipse that I can right click on the project and Run As > Maven Install. But I get the following error:

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 ############# 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.522s
[INFO] Finished at: Wed Nov 27 12:13:11 CST 2013
[INFO] Final Memory: 6M/122M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project #############: Could not resolve dependencies for project #############:#############:jar:0.0.1-SNAPSHOT: The following artifacts could not be resolved: javax.jms:jms:jar:1.1, com.sun.jdmk:jmxtools:jar:1.2.1, com.sun.jmx:jmxri:jar:1.2.1: Could not transfer artifact javax.jms:jms:jar:1.1 from/to java.net (https://maven-repository.dev.java.net/nonav/repository): No connector available to access repository java.net (https://maven-repository.dev.java.net/nonav/repository) of type legacy using the available factories AsyncRepositoryConnectorFactory, WagonRepositoryConnectorFactory -> [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

Please let me know if I am on the right path and how best to proceed to get the log4j dependencies. Thank you in advance for any help.

UPDATE After checking Preferences > Maven > User Settings, I discovered that the settings.xml file that is being referenced does not exist. I clicked "Update Settings" and I get the following error:

ArtifactTransferException: Could not transfer artifact com.sun.jdmk:jmxtools:jar:1.2.1 from/to java.net (https://maven-repository.dev.java.net/nonav/repository): No connector available to access repository java.net (https://maven-repository.dev.java.net/nonav/repository) of type legacy using the available factories AsyncRepositoryConnectorFactory, WagonRepositoryConnectorFactory

UPDATE 2
It looks like my issue is a result of Maven 3 (which comes with Kepler) is trying to access a Maven 2 repository and having compatibility issues. I have yet to figure out how to redirect to an appropriate repository.

Community
  • 1
  • 1
Joe
  • 800
  • 4
  • 10
  • 26
  • For the sake of sanity and IDE independence, I strongly recommend you to install Maven in your machine and run the build by it, instead of using the embedded one. – Gilberto Torrezan Nov 27 '13 at 19:43
  • 1
    For sanity's sake, I think I may be done experimenting with Maven. – Joe Nov 27 '13 at 20:08
  • Manen is a powerful tool, but as uncle Ben said: "With great power comes great responsibility". You can't use it partially, you have to understand it and accept its issues. – Gilberto Torrezan Nov 27 '13 at 20:23

2 Answers2

2

I changed the version from 1.2.15 to 1.2.17 and it worked (1.2.16 works as well). I do not see any of the dependencies listed "here" listed in the Resolved Dependencies frame like I did with 1.2.15. I do not have a full understanding of why this worked, but it worked for me.

Joe
  • 800
  • 4
  • 10
  • 26
0

You can right-click on your project then Maven > Update Snapshots. (Make sure u check the "Force update on snapshots" checkbox. This should work.

cheddarDev
  • 232
  • 1
  • 7
  • 22
  • I have the option Maven > Update Project. I ran that, but it did not help. It did not print a log to the console... – Joe Nov 27 '13 at 18:52
  • When you do Maven > Update Snapshots, it will update the repository from C:/Users//.m2/repository folder in Windows in mac ~/.m2 so the local repository is updated and you dont see anything updated in the console. – cheddarDev Nov 27 '13 at 18:57