bjornvester / wsdl2java-gradle-plugin

A Gradle plugin for generating Java classes from WSDL files
MIT License
40 stars 14 forks source link

Cannot convert extension 'wsdl2java' to a task #34

Open thomasq0 opened 6 months ago

thomasq0 commented 6 months ago

I have to migrate my wsdl2java plugin from no.nils.wsdl2java to this plugin as I'm upgrading my Gradle version to 8.x.

Most of the options are easy to migrate between two plugins. But I found a weird blocker on my project build tasks.

It seems like this project's extension and task share the same name wsdl2java. As a result, it complains

> Cannot convert extension 'wsdl2java' to a task.

However, I can see the task by running gradle tasks under Build tasks section:

wsdl2java - Generates Java classes from WSDL files.

And I can run Gradle task separately: gradle wsdl2java without any issue.

I understand there was a closed issue #12 mentioning this issue too. And I understand the task is by default running before lifecycle :compileJava, hence it may not be necessary to declare the dependency between these two tasks. But there are cases where some copy actions are required after wsdl2java task. In such scenario, I have to use dependsOn to define the task order in build task.

I tried to search workaround from internet, some suggest to use TaskContainer to get the task reference, but none of the following expressions work:

dependsOn tasks.wsdl2java

dependsOn tasks['wsdl2java']

Appreciated if someone can explain what was wrong and suggest a workaround.

My running environments:

gradle -v

------------------------------------------------------------
Gradle 8.7
------------------------------------------------------------

Build time:   2024-03-22 15:52:46 UTC
Revision:     650af14d7653aa949fce5e886e685efc9cf97c10

Kotlin:       1.9.22
Groovy:       3.0.17
Ant:          Apache Ant(TM) version 1.10.13 compiled on January 4 2023
JVM:          1.8.0_412 (Homebrew 25.412-b00)
OS:           Mac OS X 14.4.1 x86_64