无法从本地WSDL文件

时间:2018-01-25 21:06:33

标签: xjc maven-jaxb2-plugin

我已经就此做了很多阅读。似乎非常直率。如果你看到pom文件,你可以看到,而不是从远程URL创建类文件,我有文件必须是项目的一部分。注释掉的配置有效...找到WSDL并创建正确的文件。当我尝试在本地驾驶时,没有任何作用。我展示的版本是我尝试使用maven $ {project.basedir}变量的地方。我试过“/ src / main / java”,“src / main / java”,硬编码路径。我该怎么做呢?我已经尝试了所见过的所有例子。这是我的pom.xml

    <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.mycompany</groupId>
    <artifactId>abc</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>abc</name>
    <description>consume soap</description>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.8</java.version>
    </properties>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.5.9.RELEASE</version>
        <relativePath/>
    </parent>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.ws</groupId>
            <artifactId>spring-ws-core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                </plugin>
                <plugin>
                    <groupId>org.jvnet.jaxb2.maven2</groupId>
                    <artifactId>maven-jaxb2-plugin</artifactId>
                    <version>0.12.3</version>
                    <executions>
                        <execution>
                            <goals>
                                <goal>generate</goal>
                            </goals>
                        </execution>
                    </executions>

                <configuration>
                    <packageName>com.mycompany.abc.domain</packageName>
                    <wsdl>true</wsdl>
                    <xmlschema>false</xmlschema>
                    <schemaFiles>abc.wsdl</schemaFiles>
                    <schemaDirectory>${project.basedir}/src/main/resources</schemaDirectory>
                    <outputDirectory>${project.basedir}/src/main/java</outputDirectory>
                    <clearOutputDir>true</clearOutputDir>
                </configuration>

    <!-- THIS CONFIGURATION WORKS...IF IT COMES FROM A REMOTE PLACE
                    <configuration>
                        <schemaLanguage>WSDL</schemaLanguage>
                        <generatePackage>com.mycompany.abc.domain</generatePackage>
                        <schemas>
                            <schema>
                                <url>http://www.webservicex.com/stockquote.asmx?WSDL</url>
                            </schema>
                        </schemas>
                        <clearOutputDir>false</clearOutputDir>
                    </configuration>
    -->

                </plugin>
            </plugins>
        </pluginManagement>
    </build>

</project>

1 个答案:

答案 0 :(得分:3)

经过多次试验,这是我的解决方案。仍然不确定为什么以前的迭代不会起作用......也许我正在越过v1&amp; V2

<configuration>
    <generatePackage>com.ezcorp.peoplesoft.ws</generatePackage>
    <schemaDirectory>${project.basedir}/src/main/resources/wsdl</schemaDirectory>
    <schemaIncludes>
        <include>*.wsdl</include>
    </schemaIncludes>
    <clearOutputDir>true</clearOutputDir>
</configuration>