Search code examples
dependenciesivy

How to include only one class


I am attempting to use the log4j-1.2.17 jar, and I only want the EnhancedPatternLayout class.

My ivy dependency looks like:

<dependency org="log4j" name="log4j" rev="1.2.17">
        <include name="org.apache.log4j.EnhancedPatternLayout"/>
        </dependency>

The ivy resolver isn't complaining about what I've wrote, but I don't seem to be able to grab it. Appending .class doesn't seem to do the trick either, so I figure I'm going about it the wrong way. How can I make it so I only get that class specifically?


Solution

  • Sorry, not possible to download just a single class. When you declare a dependency it's normally against a specific point in time of a java package whose classes are captured collectively in a jar file.

    The jar/was/ear formats were invented to make compiled java artifacts portable. It is jars that are stored and versioned in the Maven Central repository.