Reputation: 5
The Eclipse IDE for Java Developers (Neon) as well as the default Gradle plugin (Buildship?) are used.
A Gradle Git project was created using the Eclipse IDE. A local JAR is stored within the workspace/ProjectName/lib/nameOfJAR.jar
directory. It was added to this project as a dependency, using the following build.gradle configuration.
...
repositories {
// Use 'jcenter' for resolving your dependencies.
// You can declare any Maven/Ivy/file repository here.
jcenter()
flatDir {
dirs 'lib/'
}
}
dependencies {
// The production code uses the SLF4J logging API at compile time
compile 'org.slf4j:slf4j-api:1.7.21'
compile name: 'nameOfJAR'
// Declare the dependency for your favourite test framework you want to use in your tests.
// TestNG is also supported by the Gradle Test task. Just change the
// testCompile dependency to testCompile 'org.testng:testng:6.8.1' and add
// 'test.useTestNG()' to your build script.
testCompile 'junit:junit:4.12'
}
Then Project Explorer > Project A > Gradle > Refresh Gradle Project
was used to update the Eclipse GUI, to display this new local dependency, via Project Explorer > Project A > Build Path > Configure Build Path > Libraries > Project and External Dependencies > [Name of JAR]
.
However, when expanding this section, source attachment, Javadoc location and native library location are shown as non modifiable. Can these be set from the Gradle configuration files?
How can these be set through Eclipse and Gradle?
Upvotes: 0
Views: 568
Reputation: 2617
You can place nameOfJar-sources.jar
file next to the actual library in the same directory. Gradle will use that as a source attachment. I suppose the same would work for javadocs, that is nameOfJar-javadoc.jar
would be picked up. I don't know how native libs are handled.
This is probably described somewhere in the Gradle docs, but I don't know where to find them.
Upvotes: 0