Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using other cxf-xjc-plugins: how to go about that? #1553

Open
gkfirst8 opened this issue Oct 16, 2024 · 4 comments
Open

Using other cxf-xjc-plugins: how to go about that? #1553

gkfirst8 opened this issue Oct 16, 2024 · 4 comments

Comments

@gkfirst8
Copy link

When using CXF-project-external cxf-xjc-plugins we can normally add dependencies to the CXF-plugin in Maven like this:

<plugin>
    <groupId>org.apache.cxf</groupId>
    <artifactId>cxf-codegen-plugin</artifactId>
    <version>${cxf.version}</version>
    <executions>
        <execution>
            <phase>generate-sources</phase>
            <configuration>
                ...
                <sourceRoot>${project.build.directory}/generated-sources/soap</sourceRoot>
                <wsdlOptions>
                    <wsdlOption>
                        <wsdl>${basedir}/src/main/resources/path/to/my.wsdl</wsdl>
                        <bindingFiles>
                            <bindingFile>${basedir}/src/main/resources/dates.xjb</bindingFile>
                            <bindingFile>${basedir}/src/main/resources/namespace-prefixes.xjb</bindingFile>
                        </bindingFiles>
                        <extraargs>
                            <extraarg>-xjc-Xnamespace-prefix</extraarg>
                        </extraargs>
                    </wsdlOption>
                </wsdlOptions>
            </configuration>
            <goals>
                <goal>wsdl2java</goal>
            </goals>
        </execution>
    </executions>
    <dependencies>
        <dependency>
            <!-- Pushing cxf-codegen-plugin to use Jakarta package -->
            <groupId>jakarta.jws</groupId>
            <artifactId>jakarta.jws-api</artifactId>
            <version>3.0.0</version>
        </dependency>
        <dependency>
            <!-- For pre-defines namespace prefixes -->
            <groupId>org.jvnet.jaxb</groupId>
            <artifactId>jaxb-plugins</artifactId>
            <version>4.0.0</version>
        </dependency>
        <dependency>
            <groupId>org.jvnet.jaxb</groupId>
            <artifactId>jaxb-plugin-annotate</artifactId>
            <version>4.0.0</version>
        </dependency>
        <dependency>
            <!-- Make sure the plugin can log properly -->
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-slf4j2-impl</artifactId>
            <version>2.20.0</version>
        </dependency>
    </dependencies>
</plugin>

Where should we add these when using quarkus-cxf? We understand that quarkus-cxf-xjc-plugins pulls in dependencies in a special way and we tried to put our/these dependencies in these places:

  • main location for normal dependencies with scope provided
  • as dependencies for the quarkus-maven-plugin plugin

Both result in "XJC reported 'BadCommandLineException' for -xjc argument:-extension -Xnamespace-prefix"

@gkfirst8
Copy link
Author

I did have an intermediate solution: by putting it in the normal dependencies under scope compile I got it to work. But this is not as clean as quarkus-cxf-xjc-plugins does it. quarkus-cxf-xjc-plugins makes sure that the dependencies themselves are not shipped.
Is there a better way?

@ppalaga
Copy link
Contributor

ppalaga commented Oct 16, 2024

Thanks for the report, @gkfirst8! I am afraid, there is no good way to do that currently. I'd suggest using the good old cxf-codegen-plugin for now.

I guess we could create a new extension inside Quarkus CXF in the same way like we have quarkus-cxf-xjc-plugins. Would you like to try it?

@gkfirst8
Copy link
Author

@ppalaga I would like to give it a try. Not to afraid of pom-files ;-) so that should be a good start as I think I read that the other module also just had some pom-magic.

Do you have a good start for this? Then I will try to give it a go. (I'm currently travelling so it will have to wait till next week to have me fully start. But I can already read-up on any pointers you can give. (I think the given example already provides nice plugins that could be valuable to the community to be available in quarkus-cxf.))

@ppalaga
Copy link
Contributor

ppalaga commented Oct 19, 2024

Thanks for being ready to contribute, @gkfirst8 ! Indeed, quarkus-cxf-xjc-plugins is the best place to look into. Some tests can be seen in https://github.com/quarkiverse/quarkus-cxf/tree/main/integration-tests/wsdl2java

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants