We have Bouncycastle dependencies, coming from one dependency and another one. Sothey are something like that:
implementation 'org.bouncycastle:bcprov-jdk14:1.61' <- explicitly added
'bouncycastle:bcprov-jdk14:138' <- taken from another dependency
They have the different group name, so I can’t just exclude 138. But I can’t inrement it to 161 too, as is hosts nowhere in the repos.
Can I set up something to my Gradle script to
-
Take
org.bouncycastle:bcprov-jdk14:1.61 jar -
Do something like
mvn install:install-file -Dfile=<path-to-file> -DgroupId=<group-id> -DartifactId=<artifact-id> -Dversion=<version> -Dpackaging=<packaging>
but with Gradle where I’ll put the desired format like bouncycastle:bcprov-jdk14:161
- Only then do the rest of the build?
>Solution :
You can do it locally when you have the Jar file. Create a folder named lib in your project directory to store the Bouncy Castle JAR file. Place the bcprov-jdk14-1.61.jar file in the lib folder.
Modify your Gradle script (build.gradle) to include the following configuration,The configurations block defines a custom configuration named bouncyCastle
configurations {
bouncyCastle
}
dependencies {
// Other dependencies...
bouncyCastle 'org.bouncycastle:bcprov-jdk14:1.61'
}
task installBouncyCastleJar {
doLast {
def bcFile = file('lib/bcprov-jdk14-1.61.jar')
def groupId = 'bouncycastle'
def artifactId = 'bcprov-jdk14'
def version = '161'
def packaging = 'jar'
project.repositories.mavenInstaller.install([
file: bcFile,
groupId: groupId,
artifactId: artifactId,
version: version,
packaging: packaging
])
}
}
project.afterEvaluate {
build.dependsOn(installBouncyCastleJar)
}