尝试从WSDL文件生成时出现Maven麻烦

尝试从WSDL文件生成时出现Maven麻烦

本文介绍了尝试从WSDL文件生成时出现Maven麻烦的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图从wsdl文件生成源代码,但是我仍然遇到我的pom.xml错误,我认为这可能是我的问题?以下是我从我的pom和我的pom文件中得到的错误。另外我无法使用mvn clean install来构建项目。我似乎没有真正的错误。



生成标签的错误:

 执行默认目标org.jvnet.jaxb2.maven2:maven-jaxb2-plugin:0.12.3:generate failed:执行org.jvnet.jaxb2.maven2时缺少必需的类:maven- jaxb2-plugin:0.12.3:generate:com / sun / codemodel / CodeWriter 
----------------------------- ------------------------
realm = plugin> org.jvnet.jaxb2.maven2:maven-jaxb2-plugin:0.12.3- 715230752
strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
urls [0] = file:/ C:/Users/Windows/.m2/repository/org/jvnet/jaxb2/maven2/ maven-jaxb2-plugin / 0.12.3 / maven-jaxb2-plugin-0.12.3.jar
urls [1] = file:/ C:/Users/Windows/.m2/repository/org/jvnet/jaxb2 /maven2/maven-jaxb2-plugin-core/0.12.3/maven-jaxb2-plugin-core-0.12.3.jar
urls [2] = file:/ C:/Users/Windows/.m2/存储库/ org / slf4j / slf4j-api / 1.7.7 / slf4j-api-1.7.7.jar
urls [3] = file:/ C:/Users/Windows/.m2/repository/org/a pache / commons / commons-lang3 / 3.2.1 / commons-lang3-3.2.1.jar
urls [4] = file:/ C:/Users/Windows/.m2/repository/com/sun/org /apache/xml/internal/resolver/20050927/resolver-20050927.jar
urls [5] = file:/ C:/Users/Windows/.m2/repository/junit/junit/4.8.1/junit- 4.8.1.jar
urls [6] = file:/ C:/Users/Windows/.m2/repository/org/codehaus/plexus/plexus-utils/1.5.15/plexus-utils-1.5.15文件:/ C:/Users/Windows/文件:/ C:/Users/Windows/ .jar
urls [9] = file:/ C:/Users/Windows/.m2/repository/org/glassfish/jaxb/jaxb-xjc/2.2.11/jaxb-xjc-2.2.11.jar
urls [10] = file:/ C:/Users/Windows/.m2/repository/org/apache/maven/plugin-tools/maven-plugin-annotations/3.2/maven-plugin-annotations-3.2.jar
外国进口数量:5
import:Entry [import org.sonatype.plexus.build.incremental from realm ClassRealm [plexus.core,parent:null]]
import:Entry [import org.codehaus.plexus.util.Scanner from realm ClassRealm [plexus.core,parent:null]]
import:Entry [从领域导入org.codehaus.plexus.util.DirectoryScanner ClassRealm [plexus.core,parent:null]]
import:Entry [import org.codehaus.plexus.util.AbstractScanner from realm ClassRealm [plexus.core,parent :null]]
import:Entry [从领域导入ClassRealm [maven.api,parent:null]]

---------------- -------------------------------------
(org.jvnet.jaxb2.maven2: maven-jaxb2-plugin:0.12.3:generate:default:generate-sources)

xml文件:

 <依赖关系> 
<依赖关系>
< groupId> org.springframework.boot< / groupId>
< artifactId> spring-boot-starter< / artifactId>
< / dependency>
<依赖关系>
< groupId> org.springframework.ws< / groupId>
< artifactId> spring-ws-core< / artifactId>
< / dependency>
<依赖关系>
< groupId> com.bigthunk< / groupId>
< artifactId> BigThunkCore< / artifactId>
< version> 0.0.7-SNAPSHOT< / version>
< / dependency>
<依赖关系>
< groupId> com.bigthunk< / groupId>
< artifactId> BigThunkWeb< / artifactId>
< version> 0.0.4-SNAPSHOT< / version>
< / dependency>
< / dependencies>

< build>
< plugins>
< plugin>
< groupId> org.springframework.boot< / groupId>
< artifactId> spring-boot-maven-plugin< / artifactId>
< / plugin>
<! - tag :: wsdl [] - >
< plugin>
< groupId> org.jvnet.jaxb2.maven2< / groupId>
< artifactId> maven-jaxb2-plugin< / artifactId>
<执行>
< execution>
< goals>
< goal>生成< / goal>
< / goals>
< / execution>
< / executions>
< configuration>
< schemaLanguage> WSDL< / schemaLanguage>
< generatePackage> hello.wsdl< / generatePackage>
< forceRegenerate> true< / forceRegenerate>
< schemas>
< schema>
< url> http://172.19.137.21:8280 / services / umarketsc?wsdl< / url>
< / schema>
< / schemas>
< / configuration>
< / plugin>
<! - end :: wsdl [] - >
< / plugins>
< / build>

< repositories>
< repository>
< id> project.local< / id>
< name> project< / name>
< url> file:$ {project.basedir} / repo< / url>
< / repository>
< repository>
< id> spring-releases< / id>
< name> Spring Releases< / name>
< url> https://repo.spring.io/libs-release< / url>
< / repository>
< / repositories>
< pluginRepositories>
< pluginRepository>
< id> spring-releases< / id>
< url> https://repo.spring.io/libs-release< / url>
< / pluginRepository>
< / pluginRepositories>
解决方案

< pluginManagement> 标签内附加< plugins> 标签(如下所述:)为我解决了问题。


Im trying to generate sources from a wsdl file, but I keep running into an error on my pom.xml that I believe might be my issue? Below is the error that I get from my pom, and my pom file. Also I cannot build the project with "mvn clean install". I just seem to get an error with no real cause.

The error at the generates tag:

Execution default of goal org.jvnet.jaxb2.maven2:maven-jaxb2-plugin:0.12.3:generate failed: A required class was missing while executing org.jvnet.jaxb2.maven2:maven-jaxb2-plugin:0.12.3:generate: com/sun/codemodel/CodeWriter
-----------------------------------------------------
realm =    plugin>org.jvnet.jaxb2.maven2:maven-jaxb2-plugin:0.12.3-715230752
strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
urls[0] = file:/C:/Users/Windows/.m2/repository/org/jvnet/jaxb2/maven2/maven-jaxb2-plugin/0.12.3/maven-jaxb2-plugin-0.12.3.jar
urls[1] = file:/C:/Users/Windows/.m2/repository/org/jvnet/jaxb2/maven2/maven-jaxb2-plugin-core/0.12.3/maven-jaxb2-plugin-core-0.12.3.jar
urls[2] = file:/C:/Users/Windows/.m2/repository/org/slf4j/slf4j-api/1.7.7/slf4j-api-1.7.7.jar
urls[3] = file:/C:/Users/Windows/.m2/repository/org/apache/commons/commons-lang3/3.2.1/commons-lang3-3.2.1.jar
urls[4] = file:/C:/Users/Windows/.m2/repository/com/sun/org/apache/xml/internal/resolver/20050927/resolver-20050927.jar
urls[5] = file:/C:/Users/Windows/.m2/repository/junit/junit/4.8.1/junit-4.8.1.jar
urls[6] = file:/C:/Users/Windows/.m2/repository/org/codehaus/plexus/plexus-utils/1.5.15/plexus-utils-1.5.15.jar
urls[7] = file:/C:/Users/Windows/.m2/repository/org/jvnet/jaxb2/maven2/maven-jaxb22-plugin/0.12.3/maven-jaxb22-plugin-0.12.3.jar
urls[8] = file:/C:/Users/Windows/.m2/repository/org/glassfish/jaxb/jaxb-runtime/2.2.11/jaxb-runtime-2.2.11.jar
urls[9] = file:/C:/Users/Windows/.m2/repository/org/glassfish/jaxb/jaxb-xjc/2.2.11/jaxb-xjc-2.2.11.jar
urls[10] = file:/C:/Users/Windows/.m2/repository/org/apache/maven/plugin-tools/maven-plugin-annotations/3.2/maven-plugin-annotations-3.2.jar
Number of foreign imports: 5
import: Entry[import org.sonatype.plexus.build.incremental from realm ClassRealm[plexus.core, parent: null]]
import: Entry[import org.codehaus.plexus.util.Scanner from realm ClassRealm[plexus.core, parent: null]]
import: Entry[import org.codehaus.plexus.util.DirectoryScanner from realm ClassRealm[plexus.core, parent: null]]
import: Entry[import org.codehaus.plexus.util.AbstractScanner from realm ClassRealm[plexus.core, parent: null]]
import: Entry[import  from realm ClassRealm[maven.api, parent: null]]

-----------------------------------------------------
 (org.jvnet.jaxb2.maven2:maven-jaxb2-plugin:0.12.3:generate:default:generate-sources)

my pom.xml file :

<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>com.bigthunk</groupId>
        <artifactId>BigThunkCore</artifactId>
        <version>0.0.7-SNAPSHOT</version>
    </dependency>
    <dependency>
        <groupId>com.bigthunk</groupId>
        <artifactId>BigThunkWeb</artifactId>
        <version>0.0.4-SNAPSHOT</version>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
        <!-- tag::wsdl[] -->
        <plugin>
            <groupId>org.jvnet.jaxb2.maven2</groupId>
            <artifactId>maven-jaxb2-plugin</artifactId>
            <executions>
                <execution>
                    <goals>
                        <goal>generate</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <schemaLanguage>WSDL</schemaLanguage>
                <generatePackage>hello.wsdl</generatePackage>
                <forceRegenerate>true</forceRegenerate>
                <schemas>
                    <schema>
                        <url>http://172.19.137.21:8280/services/umarketsc?wsdl</url>
                    </schema>
                </schemas>
            </configuration>
        </plugin>
        <!-- end::wsdl[] -->
    </plugins>
</build>

<repositories>
    <repository>
        <id>project.local</id>
        <name>project</name>
        <url>file:${project.basedir}/repo</url>
    </repository>
    <repository>
        <id>spring-releases</id>
        <name>Spring Releases</name>
        <url>https://repo.spring.io/libs-release</url>
    </repository>
</repositories>
<pluginRepositories>
    <pluginRepository>
        <id>spring-releases</id>
        <url>https://repo.spring.io/libs-release</url>
    </pluginRepository>
</pluginRepositories>
解决方案

Enclosing the <plugins> tag inside <pluginManagement> tag (as detailed here: How to solve "Plugin execution not covered by lifecycle configuration" for Spring Data Maven Builds) fixed the issue for me.

这篇关于尝试从WSDL文件生成时出现Maven麻烦的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-18 21:09