[GRADLE-1489] Assemble in Multi Project build does to much Created: 21/Apr/11  Updated: 04/Jan/13  Resolved: 16/Oct/11

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

Type: Bug
Reporter: Bas Jansen Assignee: Adam Murdoch
Resolution: Fixed Votes: 0

Attachments: Zip Archive gradleTest.zip    

 Description   

I have two subprojects. In my main gradle build I add a task to build a testJar (containing the test classes).

subprojects {
        [...]
	task testJar (type: Jar, dependsOn: compileTestJava) {
		from sourceSets.test.classesDir
		classifier = "tests"
		doFirst {		
			println "-------------- Building Test Jar for ${project.name} -----------------------"
		}
	}
}

Now only in project2, I add the testJar to the artifacts:

artifacts {
	archives testJar
}

The output of an assemble build now looks like:

bjansen@CNL1443 ~/Development/gradle-test $ gradle clean assemble
:project-1:clean
:project-2:clean
:project-1:compileJava
:project-1:processResources UP-TO-DATE
:project-1:classes
:project-1:jar
:project-1:compileTestJava
:project-1:testJar
-------------- Building Test Jar for project-1 -----------------------
:project-1:assemble
:project-2:compileJava
:project-2:processResources UP-TO-DATE
:project-2:classes
:project-2:jar
:project-2:compileTestJava
:project-2:testJar
-------------- Building Test Jar for project-2 -----------------------
:project-2:assemble

BUILD SUCCESSFUL

Total time: 4.025 secs

Problem: Also project 1 gets a testJar, although it is not defined as artifact of project 1!

See also attached zip for de code.


Generated at Wed Jun 30 11:56:49 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.