Confused about task dependency and builds

Hi,

Gradle 1.3 Java 1.7u10

I’m really confused about this. I have this defined:

defaultTasks 'build'
  task extendedTests(type: Test, dependsOn: 'test') << {
   // do stuff
}

However, when I simply do :

gradle

the extendedTests run all the time. I only want the extendedTests to run if I do ‘gradle extendedTests’ I would have thought that even although my task depends on ‘test’, the association is that test won’t run extendedTests since test in itself doesn’t depend on it!

I’ve tried putting:

dependsOn = []

in extendedTests and still no joy.

Any pointers please on this? It’s really harder than it looks! :slight_smile:

Is there more to your build script - do you have the java plugin applied?

Please paste the full output of running gradle.

Hi,

Sorry, yes I do. I’ll here’s some output:

$ gradle :compileJava UP-TO-DATE :processResources UP-TO-DATE :classes UP-TO-DATE :compileTestJava UP-TO-DATE :processTestResources UP-TO-DATE :testClasses UP-TO-DATE :test UP-TO-DATE > Building > :admin:extendedTests :admin:extendedTests Running: UserServiceImplCT : addUser Running: UserServiceImplCT : findAllGroups Running: UserServiceImplCT : getAllUsers Running: UserServiceImplCT : updateUserByHimself Running: UserServiceImplCT : updateUser Running: UserServiceImplCT : deleteUser Running: MXRecordManagementProviderCT : validateMail ^C at that point

I don’t see how it should be running those extendedTests.

I dont see it either from what you have posted. Can you paste: rootProject/build.gradle rootProject/settings.gradle rootProject/admin/build.gradle

Hi,

I’m a little reluctant since these are business-specific scripts that I would not like to share publically for legal reasons. I apologise - is there perhaps I can get them to you confidentially?

I understand. Why not give me a call at the number below? Regards, Peter Walker COO Gradleware Inc. peter.walker@gradleware.com http://www.gradleware.com/team#peter-walker http://www.linkedin.com/in/peterbwalker Phone: 914 418 4010

email sent.

Hello All,

It appeared the problem was that I had as I had an aggregateTests task (similar to what one can find scattered around t’interwebs), it was collating all tests including my extendedTest together - thus indirectly invoking it as my build had a “build.dependsOn aggregateTests” invocation.

Big thanks to Peter for helping to resolve this. Mucho gracious

-=david=-

Fixed.