First of all, we must recall that
we need to add 2 things first in the idea module section or eclipse classpath section
idea { module { //if you love browsing Javadoc downloadJavadoc = true //if you love reading sources :) downloadSources = true } }
or
apply plugin: 'java' apply plugin: 'eclipse' eclipse { classpath { downloadSources=true downloadJavadoc = true } }
Resource Link:
Secondly
we need to remove the mavenLocal() from the repository section, and the repositories will be placed in the very top section. You have already done this.
repositories { mavenLocal() // remove this mavenCentral() }
Thirdly,
Sometimes you donβt see sources in Eclipse WTP, although they are loaded using gradle. In this case, you need to manually direct the web application libraries to the bottom of the build path. To solve, you need to follow
- Right-click your project, then select "Build Path" β "Configure Build Path";
- Select Order and Export
- Select "Web Application Libraries" and click the "Bottom" button, then the "Web" Application Libraries "will be at the bottom;
And to get this in the Eclipse Gradle plugin (so you donβt have to do it manually every time): Why does Eclipse not attach the source files of third-party libraries to the Gradle project with WTP support?
Credit goes to @jasop
UPDATE:
I want to inform you that now I can download all javadocs and jar files of source files. But I can not copy them to the source folder. My successful attempt to try loading javadocs and jour sources is given below:
build.gradle file is below:
group 'com.waze' version '1.0-SNAPSHOT' apply plugin: 'java' apply plugin: 'eclipse' sourceCompatibility = 1.8 repositories { mavenCentral() } configurations { sources { description = 'sources download' transitive = true } copysource { extendsFrom sources } } eclipse { classpath { downloadSources = true downloadJavadoc = true } } dependencies { compile group: 'org.glassfish.jersey.media', name: 'jersey-media-moxy', version: '2.22.2' sources group: 'org.glassfish.jersey.media', name: 'jersey-media-moxy', version: '2.22.2', classifier: 'javadoc' sources group: 'org.glassfish.jersey.media', name: 'jersey-media-moxy', version: '2.22.2', classifier: 'sources' } task copySources(type: Copy) { println 'Copying dependencies to sources directory' into "sources/" from configurations.copysource } task run (dependsOn: ['copySources']){ println 'Downloading JARs' } run << { println 'Downloads complete. Finished.' }
Command line output: loading javadocs and jar files of source files
Microsoft Windows [Version 6.1.7600] Copyright (c) 2009 Microsoft Corporation. All rights reserved. C:\Users\PCPC>F: F:\>cd F:\eclipse\workspace\log4j_sift-master F:\eclipse\workspace\log4j_sift-master>gradle cleanEclipse eclipse Copying dependencies to sources directory Downloading JARs :cleanEclipseClasspath :cleanEclipseJdt :cleanEclipseProject :cleanEclipse :eclipseClasspath Download https://repo1.maven.org/maven2/org/glassfish/jersey/core/jersey-common/ 2.22.2/jersey-common-2.22.2-sources.jar Download https://repo1.maven.org/maven2/org/glassfish/jersey/core/jersey-common/ 2.22.2/jersey-common-2.22.2-javadoc.jar Download https://repo1.maven.org/maven2/org/glassfish/jersey/ext/jersey-entity-f iltering/2.22.2/jersey-entity-filtering-2.22.2-sources.jar Download https://repo1.maven.org/maven2/org/glassfish/jersey/ext/jersey-entity-f iltering/2.22.2/jersey-entity-filtering-2.22.2-javadoc.jar Download https://repo1.maven.org/maven2/org/eclipse/persistence/org.eclipse.pers istence.moxy/2.6.0/org.eclipse.persistence.moxy-2.6.0-sources.jar Download https://repo1.maven.org/maven2/javax/ws/rs/javax.ws.rs-api/2.0.1/javax. ws.rs-api-2.0.1-sources.jar Download https://repo1.maven.org/maven2/javax/ws/rs/javax.ws.rs-api/2.0.1/javax. ws.rs-api-2.0.1-javadoc.jar Download https://repo1.maven.org/maven2/javax/annotation/javax.annotation-api/1. 2/javax.annotation-api-1.2-sources.jar Download https://repo1.maven.org/maven2/javax/annotation/javax.annotation-api/1. 2/javax.annotation-api-1.2-javadoc.jar Download https://repo1.maven.org/maven2/org/glassfish/jersey/bundles/repackaged/ jersey-guava/2.22.2/jersey-guava-2.22.2-sources.jar Download https://repo1.maven.org/maven2/org/glassfish/hk2/hk2-api/2.4.0-b34/hk2- api-2.4.0-b34-sources.jar Download https://repo1.maven.org/maven2/org/glassfish/hk2/hk2-api/2.4.0-b34/hk2- api-2.4.0-b34-javadoc.jar Download https://repo1.maven.org/maven2/org/glassfish/hk2/external/javax.inject/ 2.4.0-b34/javax.inject-2.4.0-b34-sources.jar Download https://repo1.maven.org/maven2/org/glassfish/hk2/external/javax.inject/ 2.4.0-b34/javax.inject-2.4.0-b34-javadoc.jar Download https://repo1.maven.org/maven2/org/glassfish/hk2/hk2-locator/2.4.0-b34/ hk2-locator-2.4.0-b34-sources.jar Download https://repo1.maven.org/maven2/org/glassfish/hk2/hk2-locator/2.4.0-b34/ hk2-locator-2.4.0-b34-javadoc.jar Download https://repo1.maven.org/maven2/org/glassfish/hk2/osgi-resource-locator/ 1.0.1/osgi-resource-locator-1.0.1-sources.jar Download https://repo1.maven.org/maven2/org/glassfish/hk2/osgi-resource-locator/ 1.0.1/osgi-resource-locator-1.0.1-javadoc.jar Download https://repo1.maven.org/maven2/org/eclipse/persistence/org.eclipse.pers istence.core/2.6.0/org.eclipse.persistence.core-2.6.0-sources.jar Download https://repo1.maven.org/maven2/javax/validation/validation-api/1.1.0.Fi nal/validation-api-1.1.0.Final-sources.jar Download https://repo1.maven.org/maven2/javax/validation/validation-api/1.1.0.Fi nal/validation-api-1.1.0.Final-javadoc.jar Download https://repo1.maven.org/maven2/org/glassfish/javax.json/1.0.4/javax.jso n-1.0.4-sources.jar Download https://repo1.maven.org/maven2/org/glassfish/javax.json/1.0.4/javax.jso n-1.0.4-javadoc.jar Download https://repo1.maven.org/maven2/org/glassfish/hk2/hk2-utils/2.4.0-b34/hk 2-utils-2.4.0-b34-sources.jar Download https://repo1.maven.org/maven2/org/glassfish/hk2/hk2-utils/2.4.0-b34/hk 2-utils-2.4.0-b34-javadoc.jar Download https://repo1.maven.org/maven2/org/glassfish/hk2/external/aopalliance-r epackaged/2.4.0-b34/aopalliance-repackaged-2.4.0-b34-sources.jar Download https://repo1.maven.org/maven2/org/glassfish/hk2/external/aopalliance-r epackaged/2.4.0-b34/aopalliance-repackaged-2.4.0-b34-javadoc.jar Download https://repo1.maven.org/maven2/org/javassist/javassist/3.18.1-GA/javass ist-3.18.1-GA-sources.jar Download https://repo1.maven.org/maven2/org/javassist/javassist/3.18.1-GA/javass ist-3.18.1-GA-javadoc.jar Download https://repo1.maven.org/maven2/org/eclipse/persistence/org.eclipse.pers istence.asm/2.6.0/org.eclipse.persistence.asm-2.6.0-sources.jar Download https://repo1.maven.org/maven2/javax/inject/javax.inject/1/javax.inject -1-sources.jar Download https://repo1.maven.org/maven2/javax/inject/javax.inject/1/javax.inject -1-javadoc.jar :eclipseJdt :eclipseProject :eclipse BUILD SUCCESSFUL Total time: 7 mins 5.896 secs F:\eclipse\workspace\log4j_sift-master>