Documentation example in section 7.3.4 common configuration does not work


(bobpaige) #1

I’m working through the Gradle documentation/tutorials and am particularly interested in multi-project builds.

When working through section 7.3.4 (see http://www.gradle.org/docs/current/userguide/tutorial_java_projects.html) the example fails with "Could not find property ‘spiJar’ on task ‘:api:dist’

I see this same question was logged on issues.gradle.org 3 years ago with no resolution (http://issues.gradle.org/browse/GRADLE-1024)

Does anyone here have some insight to what is wrong with this example?


(Benjamin Muschko) #2

I assume that the task that ‘dist’ depends on, ‘spiJar’, does not exist in your build script. You can either create another task with that name or remove the ‘dependsOn’ declaration. That should fix your build.


(bobpaige) #3

Benjamin,

Thanks for your quick response.

Following the example in section 7.3.4 of the documentation at the link I included above, you will see that the ‘dist’ task is indeed defined in the build script for the sub-project.


(Benjamin Muschko) #4

‘dist’ does exist, ‘spiJar’ does not exist. That’s the problem.


(bobpaige) #5

Commenting out the spiJar references fixes the errors. Does anyone have any idea what the spiJar reference is for?

Is there any way to update the online docs to remedy the errors? AFAICT, this was originally reported 3 years ago.

A small point, I agree, but I would like to do what i can to keep the excellent online docs up to date.


(Benjamin Muschko) #6

The task ‘spiJar’ stands for a task of type ‘Jar’. I’d assume it looks something like this:

task spiJar(type: Jar) {
    // bundle service provider interface classes
}

We should improve on this part of the documentation. Would you be willing to help out with that? We’d love to see contributions on the documentation as it is an important part of Gradle. If you decide to submit a pull request, please make sure to sign the CLA and send it back to us. Please also have a look at the Gradle development guideline page for more information on the contribution process. Thanks for you help!


(bobpaige) #7

I would love the opportunity to help improve the docs, but I’m still a real novice at Gradle so I don’t know that my contributions would be useful unless they were properly reviewed by other people who would probably be able to write my contributions better in the first place :slight_smile:

We are starting a long project and chose to use Gradle so once I’ve climbed the learning curve, I’ll get back to you.


(Benjamin Muschko) #8

No worries, every pull request will be reviewed.