wsdlLocation在mac上构建时是相对的,但在pc上构建时是绝对的(jax-ws maven插件)

时间:2018-01-25 15:55:03

标签: web-services spring-boot wsdl jax-ws jaxws-maven-plugin

我有两个wsdl文件,我需要路径是相对的。

Mac结果:

File01Service.java摘录:

wsdlLocation = "/service-api-definition/File01.wsdl"

File02Service.java摘录:

wsdlLocation = "/service-api-definition/File02.wsdl"

PC结果:

File01Service.java摘录:

wsdlLocation = "C:/Users/USERNAME/git/src/main/resources/service-api-definition/File01.wsdl

File02Service.java摘录:

wsdlLocation = "C:/Users/USERNAME/git/src/main/resources/service-api-definition/File02.wsdl

以下是我的pom.xml

的摘录
<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>jaxws-maven-plugin</artifactId>
            <version>2.5</version>
            <configuration>
                <sourceDestDir>target/generated-sources/wsdlimport/Service1.0</sourceDestDir>
                <wsdlDirectory>${basedir}/src/main/resources/service-api-definition/</wsdlDirectory>
                <vmArgs>
                    <vmArg>-Djavax.xml.accessExternalSchema=all</vmArg>
                </vmArgs>
                <args>
                    <arg>-B-XautoNameResolution</arg>
                </args>
                <verbose>true</verbose>
            </configuration>
            <dependencies>
                <dependency>
                    <groupId>org.jvnet.jaxb2_commons</groupId>
                    <artifactId>jaxb2-namespace-prefix</artifactId>
                    <version>1.3</version>
                </dependency>
            </dependencies>
            <executions>
                <execution>
                    <id>wsdla-exec</id>
                    <goals>
                    <goal>wsimport</goal>
                    </goals>
                    <configuration>
                        <wsdlLocation>/service-api-definition/File01.wsdl</wsdlLocation>
                    </configuration>
                </execution>
                <execution>
                    <id>wsdlb-exec</id>
                    <goals>
                    <goal>wsimport</goal>
                    </goals>
                    <configuration>
                        <wsdlLocation>/service-api-definition/File02.wsdl</wsdlLocation>
                    </configuration>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>build-helper-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>add-source</id>
                <phase>generate-sources</phase>
                <goals>
                  <goal>add-source</goal>
                </goals>
                <configuration>
                  <sources>
                    <source>target/generated-sources/wsdlimport/Service1.0</source>
                  </sources>
                </configuration>
              </execution>
            </executions>
        </plugin>
    </plugins>
</build>

我很难理解为什么同一个项目可以根据平台产生两种不同的结果。我需要两台机器来生产可行且相同的罐子。 mac正在产生正确的结果。有人可以帮助解释一下PC是如何做到这一点的吗?

谢谢!

0 个答案:

没有答案