gpt4 book ai didi

java - 无法在 eclipse 中从 wsdl 生成 Java 类

转载 作者:太空宇宙 更新时间:2023-11-04 12:12:34 26 4
gpt4 key购买 nike

Pom.xml:

<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.ServiceTest</groupId>
<artifactId>SpericalClient</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>SpericalClient</name>
<url>http://maven.apache.org</url>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<basedir>
E:\Radhika\Eclipse_Projects\SpericalClient
</basedir>
</properties>


<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>0.13.1</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<configuration>
<schemaLanguage>WSDL</schemaLanguage>
<generatePackage>com.ServiceTest.SpericalClient</generatePackage>
<schemas>
<schema>
<url>https://50.204.173.177:443/SphericallService</url>
</schema>
</schemas>
<configuration>
<packageName>com.ServiceTest.SpericalClient</packageName>
<wsdl>true</wsdl>
<xmlschema>false</xmlschema>
<schemaFiles>service.wsdl</schemaFiles>
</configuration>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>1.12</version>
<configuration>
<wsdlDirectory>${basedir}/src/main/resources/wsdl</wsdlDirectory>
<packageName>com.raps.code.generate.ws</packageName>
<keep>true</keep>
<sourceDestDir>${basedir}/target/generated/src/main/java</sourceDestDir>
</configuration>
<executions>
<execution>
<goals>
<goal>wsimport</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>

</project>

当我尝试从 Maven 生成类生成类时,输出低于输出

[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building SpericalClient 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.121 s
[INFO] Finished at: 2016-09-28T11:22:07+05:30
[INFO] Final Memory: 5M/75M
[INFO] ------------------------------------------------------------------------

文件夹结构:wsdl 文件位于 src->main->resources->wsdl 文件夹中xsd 文件位于 src->main->resources->schema 文件夹

包名称也是 com.ServiceTest.SpericalClient

最佳答案

你的插件永远不会被执行,因为它只在pluginManagement中声明

看看这里:https://stackoverflow.com/a/10483284/1811730

您可以添加

<plugins>
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
</plugin>
</plugins>

像这样的构建标签

<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.ServiceTest</groupId>
<artifactId>SpericalClient</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>SpericalClient</name>
<url>http://maven.apache.org</url>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<basedir>
E:\Radhika\Eclipse_Projects\SpericalClient
</basedir>
</properties>


<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
</plugin>
</plugins>

<pluginManagement>
<plugins>
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>0.13.1</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<configuration>
<schemaLanguage>WSDL</schemaLanguage>
<generatePackage>com.ServiceTest.SpericalClient</generatePackage>
<schemas>
<schema>
<url>https://50.204.173.177:443/SphericallService</url>
</schema>
</schemas>
<configuration>
<packageName>com.ServiceTest.SpericalClient</packageName>
<wsdl>true</wsdl>
<xmlschema>false</xmlschema>
<schemaFiles>service.wsdl</schemaFiles>
</configuration>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>1.12</version>
<configuration>
<wsdlDirectory>${basedir}/src/main/resources/wsdl</wsdlDirectory>
<packageName>com.raps.code.generate.ws</packageName>
<keep>true</keep>
<sourceDestDir>${basedir}/target/generated/src/main/java</sourceDestDir>
</configuration>
<executions>
<execution>
<goals>
<goal>wsimport</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>

</project>

关于java - 无法在 eclipse 中从 wsdl 生成 Java 类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39739313/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com