Ivy can't resolve log4j from Maven Central

2019-08-06 04:42发布

问题:

New to Apache Ivy, and can't get it to resolve the latest log4j jar from Maven Central. I'm using IvyDE to manage all of my dependencies and using all of its defaults, which I believe configure it to use either the Maven repo or Ibiblio.

This link takes you to Maven's log4j page. From here I am just using the Apache Ivy <dependency> tag provided on that page:

<dependency org="log4j" name="log4j" rev="1.2.16" >
    <artifact name="log4j" type="bundle" />
</dependency>

When I add this to my ivy.xml file and save it inside Eclipse, IvyDE automatically runs an Ivy resolve...and I am getting an error:

Ivy resolve job of ivy.xml in 'myProject' has encountered a problem.

Impossible to resolve dependencies of myOrg#myProject;working@myMachine

download failed: log4j#log4j;1.2.16!log4j.bundle

download failed: log4j#log4j;1.2.16!log4j.bundle

download failed: log4j#log4j;1.2.16!log4j.bundle

download failed: log4j#log4j;1.2.16!log4j.bundle

(Those last 4 lines, although identical, are in fact repeated 4 times!)

Is something wrong with log4j on Maven Central? All of my other jars resolve without a hitch, and I am using the same technique for getting all of my jars. This is the only one (out of 30 or so) that is failing. Thanks in advance!

回答1:

Leave out the

<artifact name="log4j" type="bundle" />

part and it will download the normal jar file.

I don't think you need the bundle-specification part and it seems (to me) like some kind of anomaly.

bundle is not even a core packaging value for maven:

The current core packaging values are: pom, jar, maven-plugin, ejb, war, ear, rar, par. These define the default list of goals which execute to each corresponding build lifecycle stage for a particular package structure.



回答2:

I used following :

<dependency org="log4j" name="log4j" rev="1.2.17">
            <artifact name="log4j" type="jar" />
        </dependency>

and it worked.