[GRADLE-1651] Improve conventional configuration setup so not to encourage unnecessary artifacts being built as inter-project dependencies Created: 30/Jun/11  Updated: 04/Jan/13  Resolved: 16/Oct/11

Status: Resolved
Project: Gradle
Affects Version/s: None
Fix Version/s: 1.0-milestone-5

Type: Improvement
Reporter: Luke Daley Assignee: Luke Daley
Resolution: Fixed Votes: 1


 Description   

The base plugin adds two configurations; "archives" and "default". All of the userguide documentation about publishing artifacts references the "archives" configuration and all of the upload examples are using the "uploadArchives" task.

This is causing a problem in that users are assigning extra things (e.g. source and javadoc jars) to the "archives" configuration and because "default" extends "archives" and is the default configuration used for project dependencies, unnecessary stuff gets built when the user does not want it. For example, if java subproject "a" has:

task sourcesJar(type: Jar, dependsOn: classes) { 
	classifier = 'sources' 
	from sourceSets.main.allSource
} 

task javadocJar(type: Jar, dependsOn: javadoc) { 
	classifier = 'javadoc' 
	from javadoc.destinationDir 
} 

artifacts {
	archives javadocJar, sourcesJar
}

And java project "b" has:

dependencies {
    compile project(":a")
}

Running :b:build is going to build "a"'s javadoc and source jars unnecessarily. Even worse, it's going to put them on "b"'s compile classpath.

I propose that we have the base plugin introduce another configuration, "published", that extends "archives" and change all of the upload examples in the manual to use "uploadPublished".



 Comments   
Comment by Luke Daley [ 18/Jul/11 ]

I'd say this could be closed as won't fix.

Comment by Adam Murdoch [ 18/Jul/11 ]

Not sure yet. This might be our solution. Perhaps we should rename the issue to describe the problem, rather than the solution.

Comment by Adam Murdoch [ 16/Oct/11 ]

The default configuration no longer extends archives, so this problem is fixes (it's not perfect, though).

Generated at Wed Jun 30 12:00:59 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.