ciscoo / cxf-codegen-gradle

Gradle plugin to generate Java artifacts from WSDL
Apache License 2.0
26 stars 6 forks source link

Translate Apache CXF examples to Gradle examples #43

Closed ciscoo closed 2 years ago

ciscoo commented 2 years ago

See https://github.com/ciscoo/cxf-codegen-gradle/issues/42.

Would help if the examples were translated to Gradle in the documentation.

mdiskin commented 2 years ago

Thank You that worked but I did need to also include additional dependency : (for ToStringBuilder) cxfCodegen "org.apache.cxf.xjcplugins:cxf-xjc-ts"

(*) implementation "org.apache.commons:commons-lang3"

Also while you are updating the documentation one area outside of the xjc plugin I found confusing was the gradle tasks. It looks like the plugin adds a wsdl2java task but it doesn't do anything and followed adding another task of my own. Maybe it's just not configured as a default task (e.g. src/main/schema/*.wsdl) or either it can be disabled/removed or show in examples replacing it with one vs. registering.

ciscoo commented 2 years ago

The wsdl2java task is an aggregate task of Wsdl2Java task types. If there are no tasks of type Wsdl2Java, then nothing will happen. If tasks of type Wsdl2Java are up to date, then nothing will happen again. This isn't something specific to this plugin, see Up-to-date checks (AKA Incremental Build)

mdiskin commented 2 years ago

The wsdl2java task is an aggregate task of Wsdl2Java task types. If there are no tasks of type Wsdl2Java, then nothing will happen. If tasks of type Wsdl2Java are up to date, then nothing will happen again. This isn't something specific to this plugin, see Up-to-date checks (AKA Incremental Build)

That helps not sure if its explained well in the docs or I missed it. Also I find I need to add compileJava.dependsOn("wsdl2java") sourcesJar.dependsOn("wsdl2java")

So am I missing something here to ensure tasks are done in order?

ciscoo commented 2 years ago

That helps not sure if its explained well in the docs or I missed it.

It is not explicitly called out or explained because it is not something specific to this plugin, it is the way Gradle works.

Also I find I need to add

compileJava.dependsOn("wsdl2java") sourcesJar.dependsOn("wsdl2java")

So am I missing something here to ensure tasks are done in order?

This is a deliberate design choice which can be added to the documentation. If you need code generation as part of another task, then you will need to ensure to add a task dependency on either the task or the aggregate task.