Two Questions: Gradle API Sources and Default Task Unimplemented Methods

(Alex Couch) #1

Not sure if I can do two questions in one cause both would need their own answers and discussions but I’m giving it a shot. If it’s not recommended to do so then I’ll separate them.

Question 1) I am trying to view the documentation of the Gradle API in IDEA but for some reason when I click to downloaded sources, it’s not able to find them. I tried to google for it but I got nothing. I was wondering if there was any way that I could include the sources from within my buildscript. I am using the compile gradleApi() call but I’m not sure if there is a way to include the sources. I’m sure that something as big as Gradle should have a way to include its own API sources.

EDIT: I ended up writing the task in kotlin and it was just fine. I don’t know why it acts the way it does in Groovy. Nevertheless, I will keep it in Kotlin.

Question 2) I’m trying to create a new Default Task class but when I extend the DefaultTask class, it gives me an “unimplemented methods” error and I’ve practiced a little bit with Gradle before but barely any up until now. In the past, I’ve never needed to implement a bunch of methods, and it’s like 6 or 7 methods. They’re stuff like doLast and doFirst and even a compareTo method. I looked at the documentation for half an hour and found nothing that said anything about implementing methods from the DefaultTask class. I also cannot view the source code to read the javadoc and see the actual code so I can understand it better.

I am using IntelliJ IDEA 2017.3 on a Macbook Pro OSX Sierra.

The night prior to writing this post was when I updated IDEA to 2017.3 along with Gradle and ever since then I have been having a shite time trying to be productive. I am new to writing custom Gradle scripts and using the API so I am positive that it is a user error. I just can’t find anything online whatsoever that can solve my problems. It’s been hours since I started all of this and I really need some help.