Java – multiple dependency versions in gradle

I'm building a java project that uses gradle for version control

I'm starting from the old version of drools rule engine 5.5 0 to 6.2 0. Instead of going to the big bang and changing the everey class to use the new version, I want to change a class at that time and delete the old dependencies when migrating all classes

In my gradle In build, I set:

compile 'org.drools:drools-compiler:6.2.0.Final'
compile 'org.kie:kie-api:6.2.0.Final'  
compile 'org.drools:drools-core:6.2.0.Final'

compile 'org.drools:drools-core:5.5.0.Final'
compile 'org.drools:drools-compiler:5.5.0.Final'

But it only downloads the latest version of the library Does gradle support multiple versions of the same library?

Solution

To download multiple versions of the same library:

repositories {
  mavenCentral()
}
  configurations {
  compile5
  compile6
}
  dependencies {
  compile5 'org.osgi:org.osgi.core:5.0.0'
  compile6 'org.osgi:org.osgi.core:6.0.0'
}
  task libs(type: Sync) {
  from configurations.compile5
  from configurations.compile6
  into "$buildDir/libs"
}

How to get multiple versions of the sample library

By the way

>Download two versions above and compile only one version at the same time

See: 23.2 3. Resolve version conflicts of Chapter 23

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>