Plug-in task dependencies

I have a plug-in for a Slice to Java compiler that must run before the compileJava task, in the apply method we have this

project.tasks.getByName("compileJava").dependsOn('compileSlice');

See full code on github

This works well with the old dynamic configuration, but when try to use my plugin with the plugins block I get this exception

An exception occurred applying plugin request [id: 'com.zeroc.gradle.ice-builder.slice', version: '1.4.5']
> Failed to apply plugin [id 'com.zeroc.gradle.ice-builder.slice']
   > Task with name 'compileJava' not found in root project 'printer'.

My test project is just

plugins {
    // Apply the java plugin to add support for Java
    id 'java'

    // Apply the Ice builder plugin to compile Slice files to Java
    id 'com.zeroc.gradle.ice-builder.slice' version '1.4.5'
}

Any ideas about the right solution here?

1 Like