# Change of behaviour for @Finalize between 2.3 and 2.4 release

**URL:** <https://discuss.gradle.org/t/change-of-behaviour-for-finalize-between-2-3-and-2-4-release/9564>\
**Category:** Bugs\
**Created:** [May 9, 2015, 8:54am UTC](https://discuss.gradle.org/t/change-of-behaviour-for-finalize-between-2-3-and-2-4-release/9564 "2015-05-09T08:54:41Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![luke\_daley](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/luke_daley/32/9890_2.png) [@luke\_daley](https://discuss.gradle.org/u/luke_daley)\
**Post date:** [May 12, 2015, 2:41am UTC](https://discuss.gradle.org/t/change-of-behaviour-for-finalize-between-2-3-and-2-4-release/9564/6 "2015-05-12T02:41:17Z")

</div>

The basic problem here is that Gradle no longer creates all tasks. Part of the rules based mechanism is the ability to not create something unless it is needed. Where it’s falling down here is that the constructs you are using don’t actually express that it is needed. Unfortunately, there’s no way right now to express that all `CustomTask` objects depend on all `PublishToIvyRepository` tasks. That’s what you really need. It’s coming.

Your options for right now are to:

1. Call `tasks.realize()` at the end of your script to force the creation of all tasks (please note: this is an internal method)
2. Use naming conventions to wire things together

Example…

```gradle
	static class Rule extends RuleSource{
		@Finalize
		public void addFinalizeOnCustomTask(org.gradle.api.tasks.TaskContainer tasks){
			tasks.withType (CustomTask) {myTask ->
				myTask.finalizedBy { tasks.names.findAll { it.startsWith "publishIvy" } }
			}
		}
	}

```

---

_[View the full topic](https://discuss.gradle.org/t/change-of-behaviour-for-finalize-between-2-3-and-2-4-release/9564)._
