Tell gradle to download the sources of a single dependency (in build.gradle)

Now and then, I use this website to post some notes for myself, so once I forget it, I know where to look it up. This time, it happened again. Since we use our own build chain and scripts (based on gradle or mvn), I wanted to download the sources of a single dependency. My google-fu was not good enough to find the solution (again), and to not waste time (again), I keep a note here:

If you have this dependency declaration:

compile group: 'com.acme', name: 'some-lib', version: '2.1.3'

You can add the classifier sources to make gradle download them.


compile group: 'com.acme', name: 'some-lib', version: '2.1.3', classifier: 'sources'