Inject properties before task

I’m trying to create a task to inject a property that should be used by another task configuration to choose a specific value.

In my case I have the generateBuildConfig task from gmazzo’s BuildConfig plugin where I want to set a value that I need to use in my Java code. But I want this value to depend on the specific custom build task I created named testJar that will generate a JAR file that has the before mentioned value in the code.

My idea for an attempt was to set a project property when executing thetestJar that will be used in generateBuildConfig to set the value needed. Unfortunately as testJar depends on generateBuildConfig the second on obviously executes first.

Do you have any suggestions on how I could get to my desired behaviour for generateBuildConfig?