I am new to gradle. I converted one of my maven project to gradle. I installed eclipse gradle plugin. After that I configure my gradle like below
Here is my build.gradle
apply plugin: 'application' // implicitly apply java and distribution plugin
apply plugin: 'eclipse'
sourceCompatibility = 1.8
targetCompatibility = sourceCompatibility
mainClassName = "com.softech.ls360.integration.BatchImport"
version = '1.0'
repositories {
mavenCentral()
mavenLocal()
}
ext {
log4jGroupId = "org.apache.logging.log4j"
springFrameworkGroupId = "org.springframework"
springFrameworkVersion = "4.2.4.RELEASE"
....
}
dependencies {
['spring-context-support', 'spring-oxm', 'spring-test', 'spring-jms'].each {
compile "$springFrameworkGroupId:$it:$springFrameworkVersion"
}
...
}
task wrapper(type: Wrapper) {
gradleVersion = '2.11'
}
task copyJars(type: Copy) {
....
}
task copyConfigurationFiles(type: Copy) {
....
}
jar {
....
}
eclipse {
classpath {
downloadSources=true
downloadJavadoc=true
}
}
uploadArchives {
repositories {
flatDir {
dirs 'repos'
}
}
}
I tried by right cliclking on project --> Gradle --> Refresh Dependencies. Also Refresh sources, refresh all. I saw in the console that eclipse downloaded the sources and jars
Here is the javadocs screen shot
If i expand the Gradle dependency and click one of the dependency jars, then it shows the code like
But from the eclipse editor when I click on one of the class then I got screen like this
No course code
Why ? Here is my project build path
In maven project it works perfectly fine. It open the source code. I can put breakpoints there. Although I can't modify the code, but at-least for debugging it works perfect.
How can I configure gradle for this situation? I tried by eclipseClean clean
. Close the eclipse. Then open and importing the project. But result is same.
Am I missing something in build.gradle ?
Thanks
EDIT: __________________________
Here what I noticed.
I get screen like this
See It is pointing to Spring-context
jar instead of spring-jms
jar. But when I change it to location, by clicking on External File
, where gradle downlaoded sources. It starts show sources
I don't know why it is behaving like this. May be I did something wrong while setup the project that's why it is behaving like this.
HHmm don't know hwy ?
Thanks
It has happened for me couple of times. External dependencies are not being added to the IDE's (Eclipse or Spring tool suite).
To overcome this problem,
1) Close the existing IDE. Do a gradle clean build --refresh-dependencies from command prompt.
2) Next, create a new workspace and freshly IMPORT the project from the eclipse into this newly created workspace.