Index: src/test/groovy/org/gradle/api/tasks/compile/AbstractCompileTest.groovy =================================================================== --- src/test/groovy/org/gradle/api/tasks/compile/AbstractCompileTest.groovy (revision 1011) +++ src/test/groovy/org/gradle/api/tasks/compile/AbstractCompileTest.groovy (working copy) @@ -83,6 +83,11 @@ compile.execute() } + @Test public void testGetClasspath() { + setUpMocksAndAttributes(compile) + assertEquals(TEST_CONVERTED_UNMANAGED_CLASSPATH + TEST_DEPENDENCY_MANAGER_CLASSPATH, compile.getClasspath()) + } + @Test public void testUnmanagedClasspath() { List list1 = ['a', new Object()] assert compile.unmanagedClasspath(list1 as Object[]).is(compile) Index: src/test/groovy/org/gradle/api/tasks/compile/CompileTest.java =================================================================== --- src/test/groovy/org/gradle/api/tasks/compile/CompileTest.java (revision 1011) +++ src/test/groovy/org/gradle/api/tasks/compile/CompileTest.java (working copy) @@ -59,8 +59,8 @@ setUpMocksAndAttributes(compile); context.checking(new Expectations() {{ one(antCompileMock).execute(compile.getSrcDirs(), compile.getIncludes(), compile.getExcludes(), compile.getDestinationDir(), - GUtil.addLists(AbstractCompileTest.TEST_CONVERTED_UNMANAGED_CLASSPATH, AbstractCompileTest.TEST_DEPENDENCY_MANAGER_CLASSPATH), - compile.getSourceCompatibility(), compile.getTargetCompatibility(), compile.getOptions(), compile.getProject().getAnt()); + compile.getClasspath(), compile.getSourceCompatibility(), compile.getTargetCompatibility(), compile.getOptions(), + compile.getProject().getAnt()); }}); compile.execute(); } Index: src/test/groovy/org/gradle/api/tasks/testing/TestTest.groovy =================================================================== --- src/test/groovy/org/gradle/api/tasks/testing/TestTest.groovy (revision 1011) +++ src/test/groovy/org/gradle/api/tasks/testing/TestTest.groovy (working copy) @@ -132,6 +132,11 @@ } } + @org.junit.Test public void testGetClasspath() { + setUpMocks(test) + assertEquals([TEST_TEST_CLASSES_DIR] + TEST_CONVERTED_UNMANAGED_CLASSPATH + TEST_DEPENDENCY_MANAGER_CLASSPATH, test.getClasspath()) + } + @org.junit.Test public void testExecuteWithUnspecifiedCompiledTestsDir() { setUpMocks(test) test.testClassesDir = null Index: src/main/groovy/org/gradle/api/tasks/compile/Compile.java =================================================================== --- src/main/groovy/org/gradle/api/tasks/compile/Compile.java (revision 1011) +++ src/main/groovy/org/gradle/api/tasks/compile/Compile.java (working copy) @@ -103,11 +103,15 @@ if (!GUtil.isTrue(getSourceCompatibility()) || !GUtil.isTrue(getTargetCompatibility())) { throw new InvalidUserDataException("The sourceCompatibility and targetCompatibility must be set!"); } - + + antCompile.execute(existingSourceDirs, includes, excludes, getDestinationDir(), getClasspath(), getSourceCompatibility(), + getTargetCompatibility(), options, getProject().getAnt()); + } + + public List getClasspath() { List classpath = GUtil.addLists(classpathConverter.createFileClasspath(getProject().getRootDir(), getUnmanagedClasspath()), getDependencyManager().resolveTask(getName())); - antCompile.execute(existingSourceDirs, includes, excludes, getDestinationDir(), classpath, getSourceCompatibility(), - getTargetCompatibility(), options, getProject().getAnt()); + return classpath; } /** Index: src/main/groovy/org/gradle/api/tasks/testing/Test.groovy =================================================================== --- src/main/groovy/org/gradle/api/tasks/testing/Test.groovy (revision 1011) +++ src/main/groovy/org/gradle/api/tasks/testing/Test.groovy (working copy) @@ -93,15 +93,19 @@ existingDirsFilter.checkExistenceAndThrowStopActionIfNot(getTestClassesDir()) - List classpath = classpathConverter.createFileClasspath( - project.rootDir, [getTestClassesDir()] + getUnmanagedClasspath()) + getDependencyManager().resolveTask(name) - antJunit.execute(getTestClassesDir(), classpath, getTestResultsDir(), getTestReportDir(), includes, excludes, options, project.ant) + antJunit.execute(getTestClassesDir(), getClasspath(), getTestResultsDir(), getTestReportDir(), includes, excludes, options, project.ant) if (stopAtFailuresOrErrors && project.ant.project.getProperty(AntJunit.FAILURES_OR_ERRORS_PROPERTY)) { throw new GradleException('There were failing tests. See the report at ' + getTestReportDir() + '.') } } + List getClasspath() { + List classpath = classpathConverter.createFileClasspath( + project.rootDir, [getTestClassesDir()] + getUnmanagedClasspath()) + getDependencyManager().resolveTask(name) + return classpath + } + Test include(String[] includes) { this.includes += (includes as List) this