The project looks like:
Project
/src /a.java
/lib /B.jar
/bin
(a.java use some class in B.jar)
How to link B.jar and build the project by gradle?
First of all create a new build script named build.gradle
on the root level of your project. You will need to apply the Java plugin and set your source directory to src
as it doesn't use the default project layout. We also assign your JAR file dependency to the compile
configuration. Running gradle build
will compile your code, run tests (which you don't have) and assemble your module's artifact.
apply plugin: 'java'
sourceSets {
main {
java {
srcDirs = ['src']
}
}
}
dependencies {
compile fileTree(dir: 'lib', include: 'B.jar')
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With