To remove the dependency to https://artifactory***/***
we have to move either source code or custom jar files into repository. There is one custom lib lcl-core-1.0.4.RELEASE.jar
.
In root project folder was created a directory externalLibs
and pasted the file lcl-core-1.0.4.RELEASE.jar
. Also in project build.grade in dependencies
section was added line
compile fileTree(include: ['*.jar'], dir: 'externalLibs')
And in module base:dynamic-validation
in dependencies
section was added
compile files('externalLibs/lcl-core-1.0.4.RELEASE.jar')
After trying to build project I receive
/***/base/dynamic-validation/src/main/java/sdk/finance/validation/Data.java:41: error: cannot find symbol
private static final Processor DTO_PROCESSOR = new SimpleProcessor().configure();
^
symbol: class Processor
location: class Data<T>
where T is a type-variable:
T extends Object declared in class Data
In Intelij IDEA in the project settings I can add classpath and then import all required classes from the lib and, therefore, use them into my classes. However, went other developer will clone this project they have to do the same manipulations again to compile and build the project.
How to add classpass to external lib into gradle project?
Your dependency in base:dynamic-validation
won't work with a declaration like this: it's a relative path to the current project, not the root.
To be able to use file dependency, just add this code to the repositories list in the main build.gradle:
repositories {
flatDir {
dirs "$rootProject.projectDir/externalLib"
}
...
}
https://riptutorial.com/gradle/example/8349/add-a-local-jar-file-dependency
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.