我目前正在做一个需要wsimport的项目,但是我们使用的是JDK11,我刚刚发现wsimport从JDK中删除了。
我寻找答案,并尝试添加此依赖项,但目前不起作用。
<dependency>
<groupId>javax.xml.ws</groupId>
<artifactId>jaxws-api</artifactId>
<version>2.2.11</version>
</dependency>
有没有我不知道的wsimport的替代品?
谢谢!
发布于 2019-01-16 19:43:58
jaxws-maven-plugin还没有更新到JDK11。项目上有一个pull request,但它还没有合并。
这里提出了wsimport的一个临时解决方案:https://github.com/javaee/metro-jax-ws/issues/1251#issuecomment-441424365,它可能在Linux上工作得很好。
在我们的项目中,我们使用Windows环境,并根据以下示例修复了wsimport:
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<phase>generate-sources</phase>
<configuration>
<target>
<mkdir dir="target/generated-sources/wsimport"/>
<property name="plugin_classpath" refid="maven.plugin.classpath" />
<exec executable="java">
<arg value="-classpath"/>
<arg value="${plugin_classpath}"/>
<arg value="com.sun.tools.ws.WsImport"/>
<arg value="-extension"/>
<arg value="-Xnocompile"/>
<arg value="-wsdllocation"/>
<arg value="/MyWSDL.wsdl"/>
<arg value="-s"/>
<arg value="target/generated-sources/wsimport"/>
<arg value="-p"/>
<arg value="com.company.client.generated"/>
<arg value="src/main/resources/MyWSDL.wsdl"/>
</exec>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>ant-contrib</groupId>
<artifactId>ant-contrib</artifactId>
<version>1.0b2</version>
</dependency>
<dependency>
<groupId>javax.jws</groupId>
<artifactId>javax.jws-api</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-core</artifactId>
<version>2.3.0.1</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.3.2</version>
</dependency>
<!-- xml.ws module -->
<dependency>
<groupId>javax.xml.ws</groupId>
<artifactId>jaxws-api</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-rt</artifactId>
<version>2.3.1</version>
<exclusions>
<exclusion>
<!-- declare the exclusion here -->
<groupId>org.glassfish.jaxb</groupId>
<artifactId>txw2</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- javax.activation -->
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<version>1.1.1</version>
</dependency>
<!-- wsimport -->
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-tools</artifactId>
<version>2.3.1</version>
<scope>compile</scope>
</dependency>
</dependencies>
</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/wsimport</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
https://stackoverflow.com/questions/53266846
复制相似问题