how to override default download of gradle binary during gradle build ?

412 views
Skip to first unread message

Jason Vas Dias

unread,
May 29, 2015, 9:10:06 AM5/29/15
to gradl...@googlegroups.com
Good day -

I need to be able to debug into an instance of gradle-1.3
with IntellIJ Idea, but, after downloading the sources
from https://downloads.gradle.org/distributions/gradle-1.3-src.zip
and unpacking them,
and downloading and installing the gradle-1.3 binary distribution
from https://downloads.gradle.org/distributions/gradle-1.3-src.zip ,
and ensuring the unpacked gradle-1.3/bin is in my $PATH,
there appears to be no way of preventing gradlew trying to download:

http://services.gradle.org/distributions-snapshots/..
gradle-1.3-20121109123943+0000-bin.zip

which does not exist.

Idea will not load the gradle-1.3 source project because of this
problem either. So there appears to be no way of debugging into
gradle-1.3, which I must do for a work related project .

$ ./gradlew --help
Downloading
http://services.gradle.org/distributions-snapshots/gradle-1.3-20121109123943+0000-bin.zip

Exception in thread "main" java.io.FileNotFoundException:
http://downloads.gradle.org/distributions-snapshots/gradle-1.3-20121109123943+0000-bin.zip
at
sun.net.www.protocol.http.HttpURLConnection.getInputStream
(HttpURLConnection.java:1457)
at org.gradle.wrapper.Download.downloadInternal
(Download.java:63)
at org.gradle.wrapper.Download.download
(Download.java:49)
at org.gradle.wrapper.Install.createDist
(Install.java:51)
at org.gradle.wrapper.WrapperExecutor.execute
(WrapperExecutor.java:129)
at org.gradle.wrapper.GradleWrapperMain.main
(GradleWrapperMain.java:48)


Adding --offline to the gradlew command line does not help either .

Could anyone suggest a way either of preventing gradlew downloading
gradle-1.3-20121109123943+0000-bin.zip or of bypassing this step
and loading gradle 1.3 into a debugger where the sources can be
picked up ?

Thanks in advance for any replies,

Regards, Jason

Marcin Erdmann

unread,
May 29, 2015, 11:21:11 AM5/29/15
to gradl...@googlegroups.com
This is what I would do:

* clone gradle repo from github
* checkout the tag for 1.3 (this is an ancient version, you should think about upgrading)
* generate IntelliJ project using "./gradlew idea" in the cloned gradle repo
* load the generated project in IntelliJ
* put a breakpoint somewhere
* setup gradle to wait for the debugger to be attached by setting the appropriate env variables in the terminal you will use for running the build you want to debug:
    - GRADLE_OPTS="-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005" if you're not using the daemon
    - GRADLE_OPTS="-Dorg.gradle.jvmargs='-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005'" if you're using the daemon
* start the build you want to debug
* attach the debugger from IntelliJ to port 5005 using a "remote" run configuration
* wait for your breakpoint to be reached

Good luck!


--
You received this message because you are subscribed to the Google Groups "gradle-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gradle-dev+...@googlegroups.com.
To post to this group, send email to gradl...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gradle-dev/loom.20150529T144821-311%40post.gmane.org.
For more options, visit https://groups.google.com/d/optout.

Daz DeBoer

unread,
May 31, 2015, 4:17:56 PM5/31/15
to Gradle Development List
If you want to run your locally installed version of gradle from the PATH, use 'gradle' instead of 'gradlew' as the command.
If you want 'gradlew' to use version 1.3 instead of the snapshot it's currently using, change the `gradle/wrapper/gradle-wrapper.properties' file in the project so it points at "https://services.gradle.org/distributions/gradle-1.3-bin.zip".

Daz

--
You received this message because you are subscribed to the Google Groups "gradle-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gradle-dev+...@googlegroups.com.
To post to this group, send email to gradl...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gradle-dev/loom.20150529T144821-311%40post.gmane.org.
For more options, visit https://groups.google.com/d/optout.



--
Daz DeBoer
Principal Softare Engineer
Reply all
Reply to author
Forward
0 new messages