bhumphrey
bhumphrey

Reputation: 635

Excluding specific files from gradle dependency download

I am transitioning a java build from ANT to Gradle. I am attempting to filter what actually gets downloaded from the repository by file name or extension.

For example, the ANT dependency looks like this:

<dependency org="org.hibernate" name="hibernate" rev="${hibernate.version}" conf="compile,        runtime->default">
        <exclude ext="zip"/>
</dependency>

I have my Gradle set up like so currently but does not seem to be working

runtime (group:"org.hibernate", name:"hibernate", version:"${hibernate_version}"){
        exclude (group:"javax.transaction", module:'javadoc')
}

Thanks

Upvotes: 1

Views: 1679

Answers (1)

Peter Niederwieser
Peter Niederwieser

Reputation: 123890

I'm not aware of a way to exclude specific artifacts of an Ivy publication. (exclude excludes transitive Ivy modules.) One potential solution is to use the "single artifact" notation ("org.hibernate:hibernate:${gradleVersion}@jar") and handle transitive dependencies yourself. Another solution is to adapt the ivy.xml on Artifactory.

Upvotes: 2

Related Questions