Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to execute goal org.codehaus.mojo:jaxb2-maven-plugin:2.3:xjc (xjc) Java Version 11 #132

Closed
anmonu opened this issue May 31, 2019 · 6 comments
Assignees
Milestone

Comments

@anmonu
Copy link

anmonu commented May 31, 2019

Please find below error

[ERROR] Failed to execute goal org.codehaus.mojo:jaxb2-maven-plugin:2.3:xjc (xjc) on project abc: Execution xjc of goal org.codehaus.mojo:jaxb2-maven-plugin:2.3:xjc failed: A required class was missing while executing org.codehaus.mojo:jaxb2-maven-plugin:2.3:xjc: com/sun/codemodel/CodeWriter
[ERROR] -----------------------------------------------------
[ERROR] realm = plugin>org.codehaus.mojo:jaxb2-maven-plugin:2.3
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/C:/Users/anurodhkumar/.m2/repository/org/codehaus/mojo/jaxb2-maven-plugin/2.3/jaxb2-maven-plugin-2.3.jar
[ERROR] urls[1] = file:/C:/Users/anurodhkumar/.m2/repository/javax/xml/bind/jaxb-api/2.2.11/jaxb-api-2.2.11.jar
[ERROR] urls[2] = file:/C:/Users/anurodhkumar/.m2/repository/org/glassfish/jaxb/jaxb-core/2.2.11/jaxb-core-2.2.11.jar
[ERROR] urls[3] = file:/C:/Users/anurodhkumar/.m2/repository/org/glassfish/jaxb/jaxb-runtime/2.2.11/jaxb-runtime-2.2.11.jar
[ERROR] urls[4] = file:/C:/Users/anurodhkumar/.m2/repository/org/glassfish/jaxb/jaxb-xjc/2.2.11/jaxb-xjc-2.2.11.jar
[ERROR] urls[5] = file:/C:/Users/anurodhkumar/.m2/repository/org/glassfish/jaxb/jaxb-jxc/2.2.11/jaxb-jxc-2.2.11.jar
[ERROR] urls[6] = file:/C:/Users/anurodhkumar/.m2/repository/com/thoughtworks/qdox/qdox/2.0-M3/qdox-2.0-M3.jar
[ERROR] urls[7] = file:/C:/Users/anurodhkumar/.m2/repository/org/sonatype/sisu/sisu-inject-bean/2.3.0/sisu-inject-bean-2.3.0.jar
[ERROR] urls[8] = file:/C:/Users/anurodhkumar/.m2/repository/org/sonatype/sisu/sisu-guice/3.1.0/sisu-guice-3.1.0-no_aop.jar
[ERROR] urls[9] = file:/C:/Users/anurodhkumar/.m2/repository/org/sonatype/sisu/sisu-guava/0.9.9/sisu-guava-0.9.9.jar
[ERROR] urls[10] = file:/C:/Users/anurodhkumar/.m2/repository/org/sonatype/aether/aether-util/1.13.1/aether-util-1.13.1.jar
[ERROR] urls[11] = file:/C:/Users/anurodhkumar/.m2/repository/org/codehaus/plexus/plexus-interpolation/1.14/plexus-interpolation-1.14.jar
[ERROR] urls[12] = file:/C:/Users/anurodhkumar/.m2/repository/org/codehaus/plexus/plexus-component-annotations/1.5.5/plexus-component-annotations-1.5.5.jar
[ERROR] urls[13] = file:/C:/Users/anurodhkumar/.m2/repository/org/sonatype/plexus/plexus-sec-dispatcher/1.3/plexus-sec-dispatcher-1.3.jar
[ERROR] urls[14] = file:/C:/Users/anurodhkumar/.m2/repository/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar
[ERROR] urls[15] = file:/C:/Users/anurodhkumar/.m2/repository/org/codehaus/plexus/plexus-compiler-api/2.5/plexus-compiler-api-2.5.jar
[ERROR] urls[16] = file:/C:/Users/anurodhkumar/.m2/repository/org/codehaus/plexus/plexus-utils/3.0.22/plexus-utils-3.0.22.jar
[ERROR] urls[17] = file:/C:/Users/anurodhkumar/.m2/repository/org/sonatype/plexus/plexus-build-api/0.0.7/plexus-build-api-0.0.7.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import from realm ClassRealm[maven.api, parent: null]]
[ERROR]
[ERROR] -----------------------------------------------------
[ERROR] : com.sun.codemodel.CodeWriter
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:jaxb2-maven-plugin:2.3:xjc (xjc) on project soi: Execution xjc of goal org.codehaus.mojo:jaxb2-maven-plugin:2.3:xjc failed: A required class was missing while executing org.codehaus.mojo:jaxb2-maven-plugin:2.3:xjc: com/sun/codemodel/CodeWriter

$ java -version
java version "11.0.3" 2019-04-16 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.3+12-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.3+12-LTS, mixed mode)

$ mvn -v
Apache Maven 3.6.1 (d66c9c0b3152b2e69ee9bac180bb8fcc8e6af555; 2019-04-05T03:00:29+08:00)
Maven home: C:\bin\maven-3.6.1
Java version: 11.0.3, vendor: Oracle Corporation, runtime: C:\bin\java\jdk-11.0.3_windows-x64_bin\jdk-11.0.3
Default locale: en_SG, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

pom.xml

                      <plugin>
                            <groupId>org.codehaus.mojo</groupId>
                            <artifactId>jaxb2-maven-plugin</artifactId>
                            <version>2.3</version>
                            <executions>
                                    <execution>
                                            <id>xjc</id>
                                            <goals>
                                                    <goal>xjc</goal>
                                            </goals>
                                    </execution>
                            </executions>
                            <configuration>
                            
                                    <sources>
                                            <source>src/main/resources/schema/Card.xsd</source>
                                    </sources>
                                    <outputDirectory>${project.build.directory}/generated-sources/</outputDirectory>
                                    <clearOutputDir>false</clearOutputDir>
                            </configuration>
                    </plugin>
@PascalSchumacher
Copy link

PascalSchumacher commented Jul 3, 2019

I guess this is a duplicate of #43

Maybe the solution in #43 (comment) works for you.

@lennartj
Copy link
Member

lennartj commented Jul 7, 2019

This is solved by #138, which is currently merged into Master.

@lennartj lennartj added this to the Release 2.4.2 milestone Jul 7, 2019
@lennartj lennartj self-assigned this Jul 7, 2019
@lennartj lennartj closed this as completed Jul 7, 2019
@sherinein
Copy link

<plugin>
			<groupId>org.codehaus.mojo</groupId>
			<artifactId>jaxb2-maven-plugin</artifactId>
			<version>2.3.1</version>
			<executions>
				<execution>
					<id>xjc</id>
					<goals>
						<goal>xjc</goal>
					</goals>
				</execution>
			</executions>
			<configuration>
				<schemaDirectory>${project.basedir}/src/main/resources/</schemaDirectory>
				<outputDirectory>${project.basedir}/src/main/java</outputDirectory>
				<clearOutputDir>false</clearOutputDir>
			</configuration>

		</plugin>

(org.codehaus.mojo:jaxb2-maven-plugin:2.3.1:xjc:xjc:generate-sources) org.apache.maven.plugin.MojoExecutionException: at
org.codehaus.mojo.jaxb2.javageneration.AbstractJavaGeneratorMojo.performExecution(AbstractJavaGeneratorMojo.java:481)
at org.codehaus.mojo.jaxb2.AbstractJaxbMojo.execute(AbstractJaxbMojo.java:257) at
org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137) at
org.eclipse.m2e.core.internal.embedder.MavenImpl.execute(MavenImpl.java:333) at
org.eclipse.m2e.core.internal.embedder.MavenImpl.lambda$7(MavenImpl.java:1380) at
org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:177) at
org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:112) at
org.eclipse.m2e.core.internal.embedder.MavenImpl.execute(MavenImpl.java:1379) at
org.eclipse.m2e.core.project.configurator.MojoExecutionBuildParticipant.build(MojoExecutionBuildParticipant.java:52) at
org.eclipse.m2e.core.internal.builder.MavenBuilderImpl.build(MavenBuilderImpl.java:137) at
org.eclipse.m2e.core.internal.builder.MavenBuilder$1.method(MavenBuilder.java:173) at
org.eclipse.m2e.core.internal.builder.MavenBuilder$1.method(MavenBuilder.java:1) at
org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod$1$1.call(MavenBuilder.java:116) at
org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:177) at
org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:112) at
org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod$1.call(MavenBuilder.java:106) at
org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:177) at
org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:151) at
org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:99) at
org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod.execute(MavenBuilder.java:87) at
org.eclipse.m2e.core.internal.builder.MavenBuilder.build(MavenBuilder.java:201) at
org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:833) at
org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45) at
org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:220) at
org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:263) at
org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:316) at
org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45) at
org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:319) at
org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:371) at
org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:392) at
org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:154) at
org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:244) at
org.eclipse.core.internal.jobs.Worker.run(Worker.java:63) Caused by: org.codehaus.mojo.jaxb2.NoSchemasException at
org.codehaus.mojo.jaxb2.javageneration.AbstractJavaGeneratorMojo.getXjcArguments(AbstractJavaGeneratorMojo.java:593)
at
org.codehaus.mojo.jaxb2.javageneration.AbstractJavaGeneratorMojo.performExecution(AbstractJavaGeneratorMojo.java:387) ...
32 more

@sherinein
Copy link

Can you give me solution? how to solve this issue?

@sherinein
Copy link

i am using jdk 8 .Is this version problem?

@lewisMachilika
Copy link

try 11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants