# Plug-in task dependencies

**URL:** <https://discuss.gradle.org/t/plug-in-task-dependencies/26053>\
**Category:** Help/Discuss\
**Tags:** plugins\
**Created:** [March 1, 2018, 4:38pm UTC](https://discuss.gradle.org/t/plug-in-task-dependencies/26053 "2018-03-01T16:38:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![PeponeOnrez](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/peponeonrez/32/149_2.png) [@PeponeOnrez](https://discuss.gradle.org/u/PeponeOnrez)\
**Post date:** [March 1, 2018, 4:38pm UTC](https://discuss.gradle.org/t/plug-in-task-dependencies/26053/1 "2018-03-01T16:38:12Z")

</div>

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](https://github.com/zeroc-ice/ice-builder-gradle/blob/master/src/main/groovy/com/zeroc/gradle/icebuilder/slice/SlicePlugin.groovy#L42)

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?
