简体   繁体   中英

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM