mojohaus / jaxb2-maven-plugin

JAXB2 Maven Plugin
https://www.mojohaus.org/jaxb2-maven-plugin/
Apache License 2.0
105 stars 76 forks source link

Generating Java classes from remote WSDL #147

Open edevil opened 4 years ago

edevil commented 4 years ago

I'm trying to migrate from maven-jaxb2-plugin but cannot seem to replicate the functionality of generating Java classes from a remote WSDL. The way I'm trying to do it is:

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>jaxb2-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>xjc</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <sourceType>wsdl</sourceType>
                    <externalEntityProcessing>true</externalEntityProcessing>
                    <verbose>true</verbose>
                    <sources>
                            <source>
                                <url>http://localhost:8080/ws/countries.wsdl</url>
                            </source>
                    </sources>
                </configuration>
            </plugin>

However, the element is not supported inside . Is there a way to do this using this plugin?

gtmss commented 1 year ago

Did you find the answer?

Paragdarade commented 1 year ago

Following Configuration worked for me to generate classes, but not in the expected package:

    <plugin> 
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>jaxws-maven-plugin</artifactId>
        <version>1.12</version>
        <executions> 
            <execution> 
                <id>wsimport-from-jdk</id>
                <goals>
                    <goal>wsimport</goal>
                </goals>
            </execution>
        </executions>
        <configuration>
            <!-- using wsdl from an url -->
            <wsdlUrls>
                <wsdlUrl>
                    http://myWSDLurl?wsdl
                </wsdlUrl>
            </wsdlUrls>
            <!-- or using wsdls file directory -->
                <!-- <wsdlDirectory>src/wsdl</wsdlDirectory> -->
            <!-- which wsdl file -->
            <!-- <wsdlFiles> -->
                <!-- <wsdlFile>myWSDL.wsdl</wsdlFile> -->
            <!--</wsdlFiles> -->
            <!-- Keep generated files -->
            <keep>true</keep> 
            <!-- Package name --> 
            <packageName>com.organization.name</packageName> 
            <!-- generated source files destination-->
            <sourceDestDir>target/generatedclasses</sourceDestDir>
        </configuration>
    </plugin>