我是Spring开发和JAVA的新手,我需要您的帮助来解决以下错误。
我正在尝试使用pom文件中的JAXB插件为XSD模式生成JAVA类文件:
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb21-plugin</artifactId>
<version>0.12.3</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<configuration>
<schemaLanguage>WSDL</schemaLanguage>
<generateDirectory>${project.basedir}/src/main/java</generateDirectory>
<generatePackage>com.mud.listcontractsretriever.unmarshal.response</generatePackage>
<strict>false</strict>
<writeCode>true</writeCode>
<forceRegenerate>true</forceRegenerate>
<noFileHeader>true</noFileHeader>
<schemaDirectory>${basedir}/src/main/resources/xsd</schemaDirectory>
<schemaIncludes>
<include>contractListRequest.xsd</include>
<include>contractListResponse.xsd</include>
</schemaIncludes>
</configuration>
</plugin>
以上在pom文件中提到的contractListRequest.xsd和contractListResponse.xsd具有一些共同的元素,由于这些错误,发生下面的错误,说明错误再次生成了,因为它们已经可用。在这里,两个XSD存在冲突几乎没有相同的元素
at com.sun.tools.xjc.ErrorReceiver.error(ErrorReceiver.java:82)
at com.sun.tools.xjc.generator.bean.ObjectFactoryGeneratorImpl.populate(ObjectFactoryGeneratorImpl.java:333)
at com.sun.tools.xjc.generator.bean.PublicObjectFactoryGenerator.populate(PublicObjectFactoryGenerator.java:59)
at com.sun.tools.xjc.generator.bean.BeanGenerator.generateClassBody(BeanGenerator.java:545)
at com.sun.tools.xjc.generator.bean.BeanGenerator.<init>(BeanGenerator.java:252)
at com.sun.tools.xjc.generator.bean.BeanGenerator.generate(BeanGenerator.java:175)
at com.sun.tools.xjc.model.Model.generateCode(Model.java:286)
at org.jvnet.mjiip.v_2_1.XJC21Mojo.generateCode(XJC21Mojo.java:66)
at org.jvnet.mjiip.v_2_1.XJC21Mojo.doExecute(XJC21Mojo.java:41)
at org.jvnet.mjiip.v_2_1.XJC21Mojo.doExecute(XJC21Mojo.java:28)
at org.jvnet.jaxb2.maven2.RawXJC2Mojo.doExecute(RawXJC2Mojo.java:488)
at org.jvnet.jaxb2.maven2.RawXJC2Mojo.execute(RawXJC2Mojo.java:311)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:133)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:108)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:76)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:116)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:361)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:157)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
能否请您帮我,让我知道如何为1个以上具有某些公共元素的XSD模式生成Java类文件。
谢谢