cxf-xjc-plugin:3.3.0 中的 Maven MojoExecutionException
Maven MojoExecutionException in cxf-xjc-plugin:3.3.0
这个问题几乎与 重复,但有两个例外:
- 该问题中已接受的答案提供了一种解决方法,但无需回答该问题。
- 该问题中讨论的问题可能是 Java 11 环境所特有的。
在 Eclipse 环境中,我有一个 Java 项目。构建过程的一部分是从 XML 架构文件 (.XSD) 生成 Java 源代码。我正在尝试使用 Apache 的 CXF Maven 插件来调用 XJC 进程以从 .XSD 生成 Java 类。这是我的 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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mbm</groupId>
<artifactId>properties</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>Properties</name>
<description>Define and process program arguments</description>
<dependencies>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-xjc-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<id>xjc</id>
<phase>generate-sources</phase>
<goals>
<goal>xsdtojava</goal>
</goals>
<configuration>
<xsdOptions>
<xsdOption>
<xsd>${basedir}/src/main/java/com/mbm/properties/schema/Properties.xsd</xsd>
<packagename>com.mbm.properties.jaxb</packagename>
</xsdOption>
</xsdOptions>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>sablecc-maven-plugin</artifactId>
<version>2.4-SNAPSHOT</version>
<configuration>
<sourceDirectory>${basedir}/src/main/java/com/mbm/properties/grammar</sourceDirectory>
<outputDirectory>${basedir}/src/main/gen-java</outputDirectory>
</configuration>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
这是 Maven 的输出(结果并不好):
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: C:\Users\mbmas_000\workspace\Properties\EMBEDDED
Java version: 1.8.0_221, vendor: Oracle Corporation, runtime: C:\Program Files\Java\jdk1.8.0_221\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
[DEBUG] Created new class realm maven.api
[DEBUG] Importing foreign packages into class realm maven.api
[DEBUG] Imported: javax.annotation.* < plexus.core
[DEBUG] Imported: javax.annotation.security.* < plexus.core
[DEBUG] Imported: javax.enterprise.inject.* < plexus.core
[DEBUG] Imported: javax.enterprise.util.* < plexus.core
[DEBUG] Imported: javax.inject.* < plexus.core
[DEBUG] Imported: org.apache.maven.* < plexus.core
[DEBUG] Imported: org.apache.maven.artifact < plexus.core
[DEBUG] Imported: org.apache.maven.classrealm < plexus.core
[DEBUG] Imported: org.apache.maven.cli < plexus.core
[DEBUG] Imported: org.apache.maven.configuration < plexus.core
[DEBUG] Imported: org.apache.maven.exception < plexus.core
[DEBUG] Imported: org.apache.maven.execution < plexus.core
[DEBUG] Imported: org.apache.maven.execution.scope < plexus.core
[DEBUG] Imported: org.apache.maven.lifecycle < plexus.core
[DEBUG] Imported: org.apache.maven.model < plexus.core
[DEBUG] Imported: org.apache.maven.monitor < plexus.core
[DEBUG] Imported: org.apache.maven.plugin < plexus.core
[DEBUG] Imported: org.apache.maven.profiles < plexus.core
[DEBUG] Imported: org.apache.maven.project < plexus.core
[DEBUG] Imported: org.apache.maven.reporting < plexus.core
[DEBUG] Imported: org.apache.maven.repository < plexus.core
[DEBUG] Imported: org.apache.maven.rtinfo < plexus.core
[DEBUG] Imported: org.apache.maven.settings < plexus.core
[DEBUG] Imported: org.apache.maven.toolchain < plexus.core
[DEBUG] Imported: org.apache.maven.usability < plexus.core
[DEBUG] Imported: org.apache.maven.wagon.* < plexus.core
[DEBUG] Imported: org.apache.maven.wagon.authentication < plexus.core
[DEBUG] Imported: org.apache.maven.wagon.authorization < plexus.core
[DEBUG] Imported: org.apache.maven.wagon.events < plexus.core
[DEBUG] Imported: org.apache.maven.wagon.observers < plexus.core
[DEBUG] Imported: org.apache.maven.wagon.proxy < plexus.core
[DEBUG] Imported: org.apache.maven.wagon.repository < plexus.core
[DEBUG] Imported: org.apache.maven.wagon.resource < plexus.core
[DEBUG] Imported: org.codehaus.classworlds < plexus.core
[DEBUG] Imported: org.codehaus.plexus.* < plexus.core
[DEBUG] Imported: org.codehaus.plexus.classworlds < plexus.core
[DEBUG] Imported: org.codehaus.plexus.component < plexus.core
[DEBUG] Imported: org.codehaus.plexus.configuration < plexus.core
[DEBUG] Imported: org.codehaus.plexus.container < plexus.core
[DEBUG] Imported: org.codehaus.plexus.context < plexus.core
[DEBUG] Imported: org.codehaus.plexus.lifecycle < plexus.core
[DEBUG] Imported: org.codehaus.plexus.logging < plexus.core
[DEBUG] Imported: org.codehaus.plexus.personality < plexus.core
[DEBUG] Imported: org.codehaus.plexus.util.xml.Xpp3Dom < plexus.core
[DEBUG] Imported: org.codehaus.plexus.util.xml.pull.XmlPullParser < plexus.core
[DEBUG] Imported: org.codehaus.plexus.util.xml.pull.XmlPullParserException < plexus.core
[DEBUG] Imported: org.codehaus.plexus.util.xml.pull.XmlSerializer < plexus.core
[DEBUG] Imported: org.eclipse.aether.* < plexus.core
[DEBUG] Imported: org.eclipse.aether.artifact < plexus.core
[DEBUG] Imported: org.eclipse.aether.collection < plexus.core
[DEBUG] Imported: org.eclipse.aether.deployment < plexus.core
[DEBUG] Imported: org.eclipse.aether.graph < plexus.core
[DEBUG] Imported: org.eclipse.aether.impl < plexus.core
[DEBUG] Imported: org.eclipse.aether.installation < plexus.core
[DEBUG] Imported: org.eclipse.aether.internal.impl < plexus.core
[DEBUG] Imported: org.eclipse.aether.metadata < plexus.core
[DEBUG] Imported: org.eclipse.aether.repository < plexus.core
[DEBUG] Imported: org.eclipse.aether.resolution < plexus.core
[DEBUG] Imported: org.eclipse.aether.spi < plexus.core
[DEBUG] Imported: org.eclipse.aether.transfer < plexus.core
[DEBUG] Imported: org.eclipse.aether.version < plexus.core
[DEBUG] Imported: org.fusesource.jansi.* < plexus.core
[DEBUG] Imported: org.slf4j.* < plexus.core
[DEBUG] Imported: org.slf4j.event.* < plexus.core
[DEBUG] Imported: org.slf4j.helpers.* < plexus.core
[DEBUG] Imported: org.slf4j.spi.* < plexus.core
[DEBUG] Populating class realm maven.api
[INFO] Error stacktraces are turned on.
[DEBUG] Message scheme: plain
[DEBUG] Reading global settings from settings.xml
[DEBUG] Reading user settings from C:\Users\mbmas_000\.m2\settings.xml
[DEBUG] Reading global toolchains from toolchains.xml
[DEBUG] Reading user toolchains from C:\Users\mbmas_000\.m2\toolchains.xml
[DEBUG] Using local repository at C:\Users\mbmas_000\.m2\repository
[DEBUG] Using manager EnhancedLocalRepositoryManager with priority 10.0 for C:\Users\mbmas_000\.m2\repository
[INFO] Scanning for projects...
[DEBUG] Extension realms for project com.mbm:properties:jar:0.0.1-SNAPSHOT: (none)
[DEBUG] Looking up lifecycle mappings for packaging jar from ClassRealm[plexus.core, parent: null]
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.mbm:properties:jar:0.0.1-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. @ line 13, column 12
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[DEBUG] === REACTOR BUILD PLAN ================================================
[DEBUG] Project: com.mbm:properties:jar:0.0.1-SNAPSHOT
[DEBUG] Tasks: [generate-sources]
[DEBUG] Style: Regular
[DEBUG] =======================================================================
[INFO]
[INFO] -------------------------< com.mbm:properties >-------------------------
[INFO] Building Properties 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[DEBUG] Lifecycle default -> [validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy]
[DEBUG] Lifecycle clean -> [pre-clean, clean, post-clean]
[DEBUG] Lifecycle site -> [pre-site, site, post-site, site-deploy]
[DEBUG] Lifecycle default -> [validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy]
[DEBUG] Lifecycle clean -> [pre-clean, clean, post-clean]
[DEBUG] Lifecycle site -> [pre-site, site, post-site, site-deploy]
[DEBUG] === PROJECT BUILD PLAN ================================================
[DEBUG] Project: com.mbm:properties:0.0.1-SNAPSHOT
[DEBUG] Dependencies (collect): []
[DEBUG] Dependencies (resolve): [compile+runtime]
[DEBUG] Repositories (dependencies): [redhat-ga-repository (http://maven.repository.redhat.com/ga/, default, releases), central (https://repo.maven.apache.org/maven2, default, releases)]
[DEBUG] Repositories (plugins) : [redhat-ga-repository (http://maven.repository.redhat.com/ga/, default, releases), central (https://repo.maven.apache.org/maven2, default, releases)]
[DEBUG] -----------------------------------------------------------------------
[DEBUG] Goal: org.apache.cxf:cxf-xjc-plugin:3.3.0:xsdtojava (xjc)
[DEBUG] Style: Regular
[DEBUG] Configuration: <?xml version="1.0" encoding="UTF-8"?>
<configuration>
<additionalJvmArgs>${cxf.xjc.jvmArgs}</additionalJvmArgs>
<encoding default-value="${project.build.sourceEncoding}"/>
<fork default-value="false"/>
<javaExecutable default-value="${java.home}/bin/java"/>
<markerDirectory default-value="${project.build.directory}/cxf-xsd-plugin-markers">${cxf.markerDirectory}</markerDirectory>
<pluginArtifacts>${plugin.artifacts}</pluginArtifacts>
<remoteRepos default-value="${project.remotePluginRepositories}"/>
<repoSession default-value="${repositorySystemSession}"/>
<sourceRoot default-value="${project.build.directory}/generated/src/main/java"/>
<xsdOptions>
<xsdOption>
<xsd>C:\Users\mbmas_000\workspace\Properties/src/main/java/com/mbm/properties/schema/Properties.xsd</xsd>
<packagename>com.mbm.properties.jaxb</packagename>
</xsdOption>
</xsdOptions>
<project default-value="${project}"/>
</configuration>
[DEBUG] -----------------------------------------------------------------------
[DEBUG] Goal: org.codehaus.mojo:sablecc-maven-plugin:2.4-SNAPSHOT:generate (default)
[DEBUG] Style: Regular
[DEBUG] Configuration: <?xml version="1.0" encoding="UTF-8"?>
<configuration>
<outputDirectory>C:\Users\mbmas_000\workspace\Properties/src/main/gen-java</outputDirectory>
<project>${project}</project>
<sourceDirectory>C:\Users\mbmas_000\workspace\Properties/src/main/java/com/mbm/properties/grammar</sourceDirectory>
<staleMillis default-value="0">${lastModGranularityMs}</staleMillis>
<timestampDirectory>${basedir}/target</timestampDirectory>
</configuration>
[DEBUG] =======================================================================
[DEBUG] Dependency collection stats: {ConflictMarker.analyzeTime=126299, ConflictMarker.markTime=810400, ConflictMarker.nodeCount=1, ConflictIdSorter.graphTime=49100, ConflictIdSorter.topsortTime=1477800, ConflictIdSorter.conflictIdCount=0, ConflictIdSorter.conflictIdCycleCount=0, ConflictResolver.totalTime=2503800, ConflictResolver.conflictItemCount=0, DefaultDependencyCollector.collectTime=409299, DefaultDependencyCollector.transformTime=8338501}
[DEBUG] com.mbm:properties:jar:0.0.1-SNAPSHOT
[INFO]
[INFO] --- cxf-xjc-plugin:3.3.0:xsdtojava (xjc) @ properties ---
[DEBUG] Dependency collection stats: {ConflictMarker.analyzeTime=3369200, ConflictMarker.markTime=336300, ConflictMarker.nodeCount=42, ConflictIdSorter.graphTime=744200, ConflictIdSorter.topsortTime=103699, ConflictIdSorter.conflictIdCount=28, ConflictIdSorter.conflictIdCycleCount=0, ConflictResolver.totalTime=10962100, ConflictResolver.conflictItemCount=41, DefaultDependencyCollector.collectTime=430410000, DefaultDependencyCollector.transformTime=15655300}
[DEBUG] org.apache.cxf:cxf-xjc-plugin:jar:3.3.0
[DEBUG] org.sonatype.plexus:plexus-build-api:jar:0.0.7:compile
[DEBUG] org.codehaus.plexus:plexus-utils:jar:2.0.5:compile
[DEBUG] org.codehaus.plexus:plexus-archiver:jar:1.2:compile
[DEBUG] org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1:compile
[DEBUG] junit:junit:jar:4.12:compile (version managed from default)
[DEBUG] org.hamcrest:hamcrest-core:jar:1.3:compile
[DEBUG] classworlds:classworlds:jar:1.1-alpha-2:compile
[DEBUG] org.codehaus.plexus:plexus-io:jar:1.0.1:compile
[DEBUG] org.apache.maven.shared:maven-artifact-resolver:jar:1.0:compile
[DEBUG] jakarta.xml.bind:jakarta.xml.bind-api:jar:2.3.2:compile
[DEBUG] jakarta.activation:jakarta.activation-api:jar:1.2.1:compile
[DEBUG] org.glassfish.jaxb:jaxb-xjc:jar:2.3.2:compile
[DEBUG] org.glassfish.jaxb:xsom:jar:2.3.2:compile
[DEBUG] org.glassfish.jaxb:codemodel:jar:2.3.2:compile
[DEBUG] com.sun.xml.bind.external:rngom:jar:2.3.2:compile
[DEBUG] com.sun.xml.dtd-parser:dtd-parser:jar:1.4.1:compile
[DEBUG] com.sun.istack:istack-commons-tools:jar:3.0.8:compile
[DEBUG] org.apache.ant:ant:jar:1.10.5:compile
[DEBUG] org.apache.ant:ant-launcher:jar:1.10.5:compile
[DEBUG] com.sun.istack:istack-commons-runtime:jar:3.0.8:compile
[DEBUG] com.sun.xml.bind.external:relaxng-datatype:jar:2.3.2:compile
[DEBUG] org.glassfish.jaxb:jaxb-runtime:jar:2.3.2:compile
[DEBUG] org.glassfish.jaxb:txw2:jar:2.3.2:compile
[DEBUG] org.jvnet.staxex:stax-ex:jar:1.8.1:compile
[DEBUG] com.sun.xml.fastinfoset:FastInfoset:jar:1.2.16:compile
[DEBUG] xml-resolver:xml-resolver:jar:1.2:compile
[DEBUG] org.javassist:javassist:jar:3.18.2-GA:compile
[DEBUG] Created new class realm plugin>org.apache.cxf:cxf-xjc-plugin:3.3.0
[DEBUG] Importing foreign packages into class realm plugin>org.apache.cxf:cxf-xjc-plugin:3.3.0
[DEBUG] Imported: < maven.api
[DEBUG] Populating class realm plugin>org.apache.cxf:cxf-xjc-plugin:3.3.0
[DEBUG] Included: org.apache.cxf:cxf-xjc-plugin:jar:3.3.0
[DEBUG] Included: org.sonatype.plexus:plexus-build-api:jar:0.0.7
[DEBUG] Included: org.codehaus.plexus:plexus-utils:jar:2.0.5
[DEBUG] Included: org.codehaus.plexus:plexus-archiver:jar:1.2
[DEBUG] Included: junit:junit:jar:4.12
[DEBUG] Included: org.hamcrest:hamcrest-core:jar:1.3
[DEBUG] Included: org.codehaus.plexus:plexus-io:jar:1.0.1
[DEBUG] Included: org.apache.maven.shared:maven-artifact-resolver:jar:1.0
[DEBUG] Included: jakarta.xml.bind:jakarta.xml.bind-api:jar:2.3.2
[DEBUG] Included: jakarta.activation:jakarta.activation-api:jar:1.2.1
[DEBUG] Included: org.glassfish.jaxb:jaxb-xjc:jar:2.3.2
[DEBUG] Included: org.glassfish.jaxb:xsom:jar:2.3.2
[DEBUG] Included: org.glassfish.jaxb:codemodel:jar:2.3.2
[DEBUG] Included: com.sun.xml.bind.external:rngom:jar:2.3.2
[DEBUG] Included: com.sun.xml.dtd-parser:dtd-parser:jar:1.4.1
[DEBUG] Included: com.sun.istack:istack-commons-tools:jar:3.0.8
[DEBUG] Included: org.apache.ant:ant:jar:1.10.5
[DEBUG] Included: org.apache.ant:ant-launcher:jar:1.10.5
[DEBUG] Included: com.sun.istack:istack-commons-runtime:jar:3.0.8
[DEBUG] Included: com.sun.xml.bind.external:relaxng-datatype:jar:2.3.2
[DEBUG] Included: org.glassfish.jaxb:jaxb-runtime:jar:2.3.2
[DEBUG] Included: org.glassfish.jaxb:txw2:jar:2.3.2
[DEBUG] Included: org.jvnet.staxex:stax-ex:jar:1.8.1
[DEBUG] Included: com.sun.xml.fastinfoset:FastInfoset:jar:1.2.16
[DEBUG] Included: xml-resolver:xml-resolver:jar:1.2
[DEBUG] Included: org.javassist:javassist:jar:3.18.2-GA
[DEBUG] Configuring mojo org.apache.cxf:cxf-xjc-plugin:3.3.0:xsdtojava from plugin realm ClassRealm[plugin>org.apache.cxf:cxf-xjc-plugin:3.3.0, parent: sun.misc.Launcher$AppClassLoader@4e25154f]
[DEBUG] Configuring mojo 'org.apache.cxf:cxf-xjc-plugin:3.3.0:xsdtojava' with basic configurator -->
[DEBUG] (f) fork = false
[DEBUG] (f) javaExecutable = C:\Program Files\Java\jdk1.8.0_221\jre/bin/java
[DEBUG] (f) markerDirectory = C:\Users\mbmas_000\workspace\Properties\target\cxf-xsd-plugin-markers
[DEBUG] (f) pluginArtifacts = [org.apache.cxf:cxf-xjc-plugin:maven-plugin:3.3.0:, org.sonatype.plexus:plexus-build-api:jar:0.0.7:compile, org.codehaus.plexus:plexus-utils:jar:2.0.5:compile, org.codehaus.plexus:plexus-archiver:jar:1.2:compile, org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1:compile, junit:junit:jar:4.12:compile, org.hamcrest:hamcrest-core:jar:1.3:compile, classworlds:classworlds:jar:1.1-alpha-2:compile, org.codehaus.plexus:plexus-io:jar:1.0.1:compile, org.apache.maven.shared:maven-artifact-resolver:jar:1.0:compile, jakarta.xml.bind:jakarta.xml.bind-api:jar:2.3.2:compile, jakarta.activation:jakarta.activation-api:jar:1.2.1:compile, org.glassfish.jaxb:jaxb-xjc:jar:2.3.2:compile, org.glassfish.jaxb:xsom:jar:2.3.2:compile, org.glassfish.jaxb:codemodel:jar:2.3.2:compile, com.sun.xml.bind.external:rngom:jar:2.3.2:compile, com.sun.xml.dtd-parser:dtd-parser:jar:1.4.1:compile, com.sun.istack:istack-commons-tools:jar:3.0.8:compile, org.apache.ant:ant:jar:1.10.5:compile, org.apache.ant:ant-launcher:jar:1.10.5:compile, com.sun.istack:istack-commons-runtime:jar:3.0.8:compile, com.sun.xml.bind.external:relaxng-datatype:jar:2.3.2:compile, org.glassfish.jaxb:jaxb-runtime:jar:2.3.2:compile, org.glassfish.jaxb:txw2:jar:2.3.2:compile, org.jvnet.staxex:stax-ex:jar:1.8.1:compile, com.sun.xml.fastinfoset:FastInfoset:jar:1.2.16:compile, xml-resolver:xml-resolver:jar:1.2:compile, org.javassist:javassist:jar:3.18.2-GA:compile]
[DEBUG] (f) remoteRepos = [redhat-ga-repository (http://maven.repository.redhat.com/ga/, default, releases), central (https://repo.maven.apache.org/maven2, default, releases)]
[DEBUG] (f) repoSession = org.eclipse.aether.DefaultRepositorySystemSession@726386ed
[DEBUG] (f) sourceRoot = C:\Users\mbmas_000\workspace\Properties\target/generated/src/main/java
[DEBUG] (s) xsd = C:\Users\mbmas_000\workspace\Properties/src/main/java/com/mbm/properties/schema/Properties.xsd
[DEBUG] (s) packagename = com.mbm.properties.jaxb
[DEBUG] (f) xsdOptions = [org.apache.cxf.maven_plugin.XsdOption@69adf72c]
[DEBUG] (f) project = MavenProject: com.mbm:properties:0.0.1-SNAPSHOT @ C:\Users\mbmas_000\workspace\Properties\pom.xml
[DEBUG] -- end configuration --
[DEBUG] Args: [-p, com.mbm.properties.jaxb, -verbose, -encoding, null, -d, C:\Users\mbmas_000\workspace\Properties\target/generated/src/main/java, file:/C:/Users/mbmas_000/workspace/Properties/src/main/java/com/mbm/properties/schema/Properties.xsd]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.262 s
[INFO] Finished at: 2020-05-05T16:54:24-07:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.cxf:cxf-xjc-plugin:3.3.0:xsdtojava (xjc) on project properties: null: MojoExecutionException: NullPointerException -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.cxf:cxf-xjc-plugin:3.3.0:xsdtojava (xjc) on project properties: null
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:215)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:957)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:289)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:193)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)
Caused by: org.apache.maven.plugin.MojoExecutionException
at org.apache.cxf.maven_plugin.AbstractXSDToJavaMojo.execute(AbstractXSDToJavaMojo.java:289)
at org.apache.cxf.maven_plugin.XSDToJavaMojo.execute(XSDToJavaMojo.java:41)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210)
... 20 more
Caused by: java.lang.NullPointerException
at com.sun.tools.xjc.Options.requireArgument(Options.java:763)
at com.sun.tools.xjc.Options.parseArgument(Options.java:680)
at com.sun.tools.xjc.Options.parseArguments(Options.java:827)
at org.apache.cxf.maven_plugin.XSDToJavaRunner.run(XSDToJavaRunner.java:173)
at org.apache.cxf.maven_plugin.AbstractXSDToJavaMojo.run(AbstractXSDToJavaMojo.java:368)
at org.apache.cxf.maven_plugin.AbstractXSDToJavaMojo.execute(AbstractXSDToJavaMojo.java:276)
... 23 more
[ERROR]
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
导致此错误的原因是什么?我试图研究这个,但关于这个插件的信息并不多。
此问题是由于插件3.3.0版本的bug导致的。参见 https://github.com/ewerk/gradle-plugins/issues/89。
错误已修复,因此在 POM.XML 文件中需要做的就是将版本号从 3.3.0 更改为 3.3.1:
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-xjc-plugin</artifactId>
<version>3.3.1</version>
这个问题几乎与
- 该问题中已接受的答案提供了一种解决方法,但无需回答该问题。
- 该问题中讨论的问题可能是 Java 11 环境所特有的。
在 Eclipse 环境中,我有一个 Java 项目。构建过程的一部分是从 XML 架构文件 (.XSD) 生成 Java 源代码。我正在尝试使用 Apache 的 CXF Maven 插件来调用 XJC 进程以从 .XSD 生成 Java 类。这是我的 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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mbm</groupId>
<artifactId>properties</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>Properties</name>
<description>Define and process program arguments</description>
<dependencies>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-xjc-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<id>xjc</id>
<phase>generate-sources</phase>
<goals>
<goal>xsdtojava</goal>
</goals>
<configuration>
<xsdOptions>
<xsdOption>
<xsd>${basedir}/src/main/java/com/mbm/properties/schema/Properties.xsd</xsd>
<packagename>com.mbm.properties.jaxb</packagename>
</xsdOption>
</xsdOptions>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>sablecc-maven-plugin</artifactId>
<version>2.4-SNAPSHOT</version>
<configuration>
<sourceDirectory>${basedir}/src/main/java/com/mbm/properties/grammar</sourceDirectory>
<outputDirectory>${basedir}/src/main/gen-java</outputDirectory>
</configuration>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
这是 Maven 的输出(结果并不好):
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: C:\Users\mbmas_000\workspace\Properties\EMBEDDED
Java version: 1.8.0_221, vendor: Oracle Corporation, runtime: C:\Program Files\Java\jdk1.8.0_221\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
[DEBUG] Created new class realm maven.api
[DEBUG] Importing foreign packages into class realm maven.api
[DEBUG] Imported: javax.annotation.* < plexus.core
[DEBUG] Imported: javax.annotation.security.* < plexus.core
[DEBUG] Imported: javax.enterprise.inject.* < plexus.core
[DEBUG] Imported: javax.enterprise.util.* < plexus.core
[DEBUG] Imported: javax.inject.* < plexus.core
[DEBUG] Imported: org.apache.maven.* < plexus.core
[DEBUG] Imported: org.apache.maven.artifact < plexus.core
[DEBUG] Imported: org.apache.maven.classrealm < plexus.core
[DEBUG] Imported: org.apache.maven.cli < plexus.core
[DEBUG] Imported: org.apache.maven.configuration < plexus.core
[DEBUG] Imported: org.apache.maven.exception < plexus.core
[DEBUG] Imported: org.apache.maven.execution < plexus.core
[DEBUG] Imported: org.apache.maven.execution.scope < plexus.core
[DEBUG] Imported: org.apache.maven.lifecycle < plexus.core
[DEBUG] Imported: org.apache.maven.model < plexus.core
[DEBUG] Imported: org.apache.maven.monitor < plexus.core
[DEBUG] Imported: org.apache.maven.plugin < plexus.core
[DEBUG] Imported: org.apache.maven.profiles < plexus.core
[DEBUG] Imported: org.apache.maven.project < plexus.core
[DEBUG] Imported: org.apache.maven.reporting < plexus.core
[DEBUG] Imported: org.apache.maven.repository < plexus.core
[DEBUG] Imported: org.apache.maven.rtinfo < plexus.core
[DEBUG] Imported: org.apache.maven.settings < plexus.core
[DEBUG] Imported: org.apache.maven.toolchain < plexus.core
[DEBUG] Imported: org.apache.maven.usability < plexus.core
[DEBUG] Imported: org.apache.maven.wagon.* < plexus.core
[DEBUG] Imported: org.apache.maven.wagon.authentication < plexus.core
[DEBUG] Imported: org.apache.maven.wagon.authorization < plexus.core
[DEBUG] Imported: org.apache.maven.wagon.events < plexus.core
[DEBUG] Imported: org.apache.maven.wagon.observers < plexus.core
[DEBUG] Imported: org.apache.maven.wagon.proxy < plexus.core
[DEBUG] Imported: org.apache.maven.wagon.repository < plexus.core
[DEBUG] Imported: org.apache.maven.wagon.resource < plexus.core
[DEBUG] Imported: org.codehaus.classworlds < plexus.core
[DEBUG] Imported: org.codehaus.plexus.* < plexus.core
[DEBUG] Imported: org.codehaus.plexus.classworlds < plexus.core
[DEBUG] Imported: org.codehaus.plexus.component < plexus.core
[DEBUG] Imported: org.codehaus.plexus.configuration < plexus.core
[DEBUG] Imported: org.codehaus.plexus.container < plexus.core
[DEBUG] Imported: org.codehaus.plexus.context < plexus.core
[DEBUG] Imported: org.codehaus.plexus.lifecycle < plexus.core
[DEBUG] Imported: org.codehaus.plexus.logging < plexus.core
[DEBUG] Imported: org.codehaus.plexus.personality < plexus.core
[DEBUG] Imported: org.codehaus.plexus.util.xml.Xpp3Dom < plexus.core
[DEBUG] Imported: org.codehaus.plexus.util.xml.pull.XmlPullParser < plexus.core
[DEBUG] Imported: org.codehaus.plexus.util.xml.pull.XmlPullParserException < plexus.core
[DEBUG] Imported: org.codehaus.plexus.util.xml.pull.XmlSerializer < plexus.core
[DEBUG] Imported: org.eclipse.aether.* < plexus.core
[DEBUG] Imported: org.eclipse.aether.artifact < plexus.core
[DEBUG] Imported: org.eclipse.aether.collection < plexus.core
[DEBUG] Imported: org.eclipse.aether.deployment < plexus.core
[DEBUG] Imported: org.eclipse.aether.graph < plexus.core
[DEBUG] Imported: org.eclipse.aether.impl < plexus.core
[DEBUG] Imported: org.eclipse.aether.installation < plexus.core
[DEBUG] Imported: org.eclipse.aether.internal.impl < plexus.core
[DEBUG] Imported: org.eclipse.aether.metadata < plexus.core
[DEBUG] Imported: org.eclipse.aether.repository < plexus.core
[DEBUG] Imported: org.eclipse.aether.resolution < plexus.core
[DEBUG] Imported: org.eclipse.aether.spi < plexus.core
[DEBUG] Imported: org.eclipse.aether.transfer < plexus.core
[DEBUG] Imported: org.eclipse.aether.version < plexus.core
[DEBUG] Imported: org.fusesource.jansi.* < plexus.core
[DEBUG] Imported: org.slf4j.* < plexus.core
[DEBUG] Imported: org.slf4j.event.* < plexus.core
[DEBUG] Imported: org.slf4j.helpers.* < plexus.core
[DEBUG] Imported: org.slf4j.spi.* < plexus.core
[DEBUG] Populating class realm maven.api
[INFO] Error stacktraces are turned on.
[DEBUG] Message scheme: plain
[DEBUG] Reading global settings from settings.xml
[DEBUG] Reading user settings from C:\Users\mbmas_000\.m2\settings.xml
[DEBUG] Reading global toolchains from toolchains.xml
[DEBUG] Reading user toolchains from C:\Users\mbmas_000\.m2\toolchains.xml
[DEBUG] Using local repository at C:\Users\mbmas_000\.m2\repository
[DEBUG] Using manager EnhancedLocalRepositoryManager with priority 10.0 for C:\Users\mbmas_000\.m2\repository
[INFO] Scanning for projects...
[DEBUG] Extension realms for project com.mbm:properties:jar:0.0.1-SNAPSHOT: (none)
[DEBUG] Looking up lifecycle mappings for packaging jar from ClassRealm[plexus.core, parent: null]
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.mbm:properties:jar:0.0.1-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. @ line 13, column 12
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[DEBUG] === REACTOR BUILD PLAN ================================================
[DEBUG] Project: com.mbm:properties:jar:0.0.1-SNAPSHOT
[DEBUG] Tasks: [generate-sources]
[DEBUG] Style: Regular
[DEBUG] =======================================================================
[INFO]
[INFO] -------------------------< com.mbm:properties >-------------------------
[INFO] Building Properties 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[DEBUG] Lifecycle default -> [validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy]
[DEBUG] Lifecycle clean -> [pre-clean, clean, post-clean]
[DEBUG] Lifecycle site -> [pre-site, site, post-site, site-deploy]
[DEBUG] Lifecycle default -> [validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy]
[DEBUG] Lifecycle clean -> [pre-clean, clean, post-clean]
[DEBUG] Lifecycle site -> [pre-site, site, post-site, site-deploy]
[DEBUG] === PROJECT BUILD PLAN ================================================
[DEBUG] Project: com.mbm:properties:0.0.1-SNAPSHOT
[DEBUG] Dependencies (collect): []
[DEBUG] Dependencies (resolve): [compile+runtime]
[DEBUG] Repositories (dependencies): [redhat-ga-repository (http://maven.repository.redhat.com/ga/, default, releases), central (https://repo.maven.apache.org/maven2, default, releases)]
[DEBUG] Repositories (plugins) : [redhat-ga-repository (http://maven.repository.redhat.com/ga/, default, releases), central (https://repo.maven.apache.org/maven2, default, releases)]
[DEBUG] -----------------------------------------------------------------------
[DEBUG] Goal: org.apache.cxf:cxf-xjc-plugin:3.3.0:xsdtojava (xjc)
[DEBUG] Style: Regular
[DEBUG] Configuration: <?xml version="1.0" encoding="UTF-8"?>
<configuration>
<additionalJvmArgs>${cxf.xjc.jvmArgs}</additionalJvmArgs>
<encoding default-value="${project.build.sourceEncoding}"/>
<fork default-value="false"/>
<javaExecutable default-value="${java.home}/bin/java"/>
<markerDirectory default-value="${project.build.directory}/cxf-xsd-plugin-markers">${cxf.markerDirectory}</markerDirectory>
<pluginArtifacts>${plugin.artifacts}</pluginArtifacts>
<remoteRepos default-value="${project.remotePluginRepositories}"/>
<repoSession default-value="${repositorySystemSession}"/>
<sourceRoot default-value="${project.build.directory}/generated/src/main/java"/>
<xsdOptions>
<xsdOption>
<xsd>C:\Users\mbmas_000\workspace\Properties/src/main/java/com/mbm/properties/schema/Properties.xsd</xsd>
<packagename>com.mbm.properties.jaxb</packagename>
</xsdOption>
</xsdOptions>
<project default-value="${project}"/>
</configuration>
[DEBUG] -----------------------------------------------------------------------
[DEBUG] Goal: org.codehaus.mojo:sablecc-maven-plugin:2.4-SNAPSHOT:generate (default)
[DEBUG] Style: Regular
[DEBUG] Configuration: <?xml version="1.0" encoding="UTF-8"?>
<configuration>
<outputDirectory>C:\Users\mbmas_000\workspace\Properties/src/main/gen-java</outputDirectory>
<project>${project}</project>
<sourceDirectory>C:\Users\mbmas_000\workspace\Properties/src/main/java/com/mbm/properties/grammar</sourceDirectory>
<staleMillis default-value="0">${lastModGranularityMs}</staleMillis>
<timestampDirectory>${basedir}/target</timestampDirectory>
</configuration>
[DEBUG] =======================================================================
[DEBUG] Dependency collection stats: {ConflictMarker.analyzeTime=126299, ConflictMarker.markTime=810400, ConflictMarker.nodeCount=1, ConflictIdSorter.graphTime=49100, ConflictIdSorter.topsortTime=1477800, ConflictIdSorter.conflictIdCount=0, ConflictIdSorter.conflictIdCycleCount=0, ConflictResolver.totalTime=2503800, ConflictResolver.conflictItemCount=0, DefaultDependencyCollector.collectTime=409299, DefaultDependencyCollector.transformTime=8338501}
[DEBUG] com.mbm:properties:jar:0.0.1-SNAPSHOT
[INFO]
[INFO] --- cxf-xjc-plugin:3.3.0:xsdtojava (xjc) @ properties ---
[DEBUG] Dependency collection stats: {ConflictMarker.analyzeTime=3369200, ConflictMarker.markTime=336300, ConflictMarker.nodeCount=42, ConflictIdSorter.graphTime=744200, ConflictIdSorter.topsortTime=103699, ConflictIdSorter.conflictIdCount=28, ConflictIdSorter.conflictIdCycleCount=0, ConflictResolver.totalTime=10962100, ConflictResolver.conflictItemCount=41, DefaultDependencyCollector.collectTime=430410000, DefaultDependencyCollector.transformTime=15655300}
[DEBUG] org.apache.cxf:cxf-xjc-plugin:jar:3.3.0
[DEBUG] org.sonatype.plexus:plexus-build-api:jar:0.0.7:compile
[DEBUG] org.codehaus.plexus:plexus-utils:jar:2.0.5:compile
[DEBUG] org.codehaus.plexus:plexus-archiver:jar:1.2:compile
[DEBUG] org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1:compile
[DEBUG] junit:junit:jar:4.12:compile (version managed from default)
[DEBUG] org.hamcrest:hamcrest-core:jar:1.3:compile
[DEBUG] classworlds:classworlds:jar:1.1-alpha-2:compile
[DEBUG] org.codehaus.plexus:plexus-io:jar:1.0.1:compile
[DEBUG] org.apache.maven.shared:maven-artifact-resolver:jar:1.0:compile
[DEBUG] jakarta.xml.bind:jakarta.xml.bind-api:jar:2.3.2:compile
[DEBUG] jakarta.activation:jakarta.activation-api:jar:1.2.1:compile
[DEBUG] org.glassfish.jaxb:jaxb-xjc:jar:2.3.2:compile
[DEBUG] org.glassfish.jaxb:xsom:jar:2.3.2:compile
[DEBUG] org.glassfish.jaxb:codemodel:jar:2.3.2:compile
[DEBUG] com.sun.xml.bind.external:rngom:jar:2.3.2:compile
[DEBUG] com.sun.xml.dtd-parser:dtd-parser:jar:1.4.1:compile
[DEBUG] com.sun.istack:istack-commons-tools:jar:3.0.8:compile
[DEBUG] org.apache.ant:ant:jar:1.10.5:compile
[DEBUG] org.apache.ant:ant-launcher:jar:1.10.5:compile
[DEBUG] com.sun.istack:istack-commons-runtime:jar:3.0.8:compile
[DEBUG] com.sun.xml.bind.external:relaxng-datatype:jar:2.3.2:compile
[DEBUG] org.glassfish.jaxb:jaxb-runtime:jar:2.3.2:compile
[DEBUG] org.glassfish.jaxb:txw2:jar:2.3.2:compile
[DEBUG] org.jvnet.staxex:stax-ex:jar:1.8.1:compile
[DEBUG] com.sun.xml.fastinfoset:FastInfoset:jar:1.2.16:compile
[DEBUG] xml-resolver:xml-resolver:jar:1.2:compile
[DEBUG] org.javassist:javassist:jar:3.18.2-GA:compile
[DEBUG] Created new class realm plugin>org.apache.cxf:cxf-xjc-plugin:3.3.0
[DEBUG] Importing foreign packages into class realm plugin>org.apache.cxf:cxf-xjc-plugin:3.3.0
[DEBUG] Imported: < maven.api
[DEBUG] Populating class realm plugin>org.apache.cxf:cxf-xjc-plugin:3.3.0
[DEBUG] Included: org.apache.cxf:cxf-xjc-plugin:jar:3.3.0
[DEBUG] Included: org.sonatype.plexus:plexus-build-api:jar:0.0.7
[DEBUG] Included: org.codehaus.plexus:plexus-utils:jar:2.0.5
[DEBUG] Included: org.codehaus.plexus:plexus-archiver:jar:1.2
[DEBUG] Included: junit:junit:jar:4.12
[DEBUG] Included: org.hamcrest:hamcrest-core:jar:1.3
[DEBUG] Included: org.codehaus.plexus:plexus-io:jar:1.0.1
[DEBUG] Included: org.apache.maven.shared:maven-artifact-resolver:jar:1.0
[DEBUG] Included: jakarta.xml.bind:jakarta.xml.bind-api:jar:2.3.2
[DEBUG] Included: jakarta.activation:jakarta.activation-api:jar:1.2.1
[DEBUG] Included: org.glassfish.jaxb:jaxb-xjc:jar:2.3.2
[DEBUG] Included: org.glassfish.jaxb:xsom:jar:2.3.2
[DEBUG] Included: org.glassfish.jaxb:codemodel:jar:2.3.2
[DEBUG] Included: com.sun.xml.bind.external:rngom:jar:2.3.2
[DEBUG] Included: com.sun.xml.dtd-parser:dtd-parser:jar:1.4.1
[DEBUG] Included: com.sun.istack:istack-commons-tools:jar:3.0.8
[DEBUG] Included: org.apache.ant:ant:jar:1.10.5
[DEBUG] Included: org.apache.ant:ant-launcher:jar:1.10.5
[DEBUG] Included: com.sun.istack:istack-commons-runtime:jar:3.0.8
[DEBUG] Included: com.sun.xml.bind.external:relaxng-datatype:jar:2.3.2
[DEBUG] Included: org.glassfish.jaxb:jaxb-runtime:jar:2.3.2
[DEBUG] Included: org.glassfish.jaxb:txw2:jar:2.3.2
[DEBUG] Included: org.jvnet.staxex:stax-ex:jar:1.8.1
[DEBUG] Included: com.sun.xml.fastinfoset:FastInfoset:jar:1.2.16
[DEBUG] Included: xml-resolver:xml-resolver:jar:1.2
[DEBUG] Included: org.javassist:javassist:jar:3.18.2-GA
[DEBUG] Configuring mojo org.apache.cxf:cxf-xjc-plugin:3.3.0:xsdtojava from plugin realm ClassRealm[plugin>org.apache.cxf:cxf-xjc-plugin:3.3.0, parent: sun.misc.Launcher$AppClassLoader@4e25154f]
[DEBUG] Configuring mojo 'org.apache.cxf:cxf-xjc-plugin:3.3.0:xsdtojava' with basic configurator -->
[DEBUG] (f) fork = false
[DEBUG] (f) javaExecutable = C:\Program Files\Java\jdk1.8.0_221\jre/bin/java
[DEBUG] (f) markerDirectory = C:\Users\mbmas_000\workspace\Properties\target\cxf-xsd-plugin-markers
[DEBUG] (f) pluginArtifacts = [org.apache.cxf:cxf-xjc-plugin:maven-plugin:3.3.0:, org.sonatype.plexus:plexus-build-api:jar:0.0.7:compile, org.codehaus.plexus:plexus-utils:jar:2.0.5:compile, org.codehaus.plexus:plexus-archiver:jar:1.2:compile, org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1:compile, junit:junit:jar:4.12:compile, org.hamcrest:hamcrest-core:jar:1.3:compile, classworlds:classworlds:jar:1.1-alpha-2:compile, org.codehaus.plexus:plexus-io:jar:1.0.1:compile, org.apache.maven.shared:maven-artifact-resolver:jar:1.0:compile, jakarta.xml.bind:jakarta.xml.bind-api:jar:2.3.2:compile, jakarta.activation:jakarta.activation-api:jar:1.2.1:compile, org.glassfish.jaxb:jaxb-xjc:jar:2.3.2:compile, org.glassfish.jaxb:xsom:jar:2.3.2:compile, org.glassfish.jaxb:codemodel:jar:2.3.2:compile, com.sun.xml.bind.external:rngom:jar:2.3.2:compile, com.sun.xml.dtd-parser:dtd-parser:jar:1.4.1:compile, com.sun.istack:istack-commons-tools:jar:3.0.8:compile, org.apache.ant:ant:jar:1.10.5:compile, org.apache.ant:ant-launcher:jar:1.10.5:compile, com.sun.istack:istack-commons-runtime:jar:3.0.8:compile, com.sun.xml.bind.external:relaxng-datatype:jar:2.3.2:compile, org.glassfish.jaxb:jaxb-runtime:jar:2.3.2:compile, org.glassfish.jaxb:txw2:jar:2.3.2:compile, org.jvnet.staxex:stax-ex:jar:1.8.1:compile, com.sun.xml.fastinfoset:FastInfoset:jar:1.2.16:compile, xml-resolver:xml-resolver:jar:1.2:compile, org.javassist:javassist:jar:3.18.2-GA:compile]
[DEBUG] (f) remoteRepos = [redhat-ga-repository (http://maven.repository.redhat.com/ga/, default, releases), central (https://repo.maven.apache.org/maven2, default, releases)]
[DEBUG] (f) repoSession = org.eclipse.aether.DefaultRepositorySystemSession@726386ed
[DEBUG] (f) sourceRoot = C:\Users\mbmas_000\workspace\Properties\target/generated/src/main/java
[DEBUG] (s) xsd = C:\Users\mbmas_000\workspace\Properties/src/main/java/com/mbm/properties/schema/Properties.xsd
[DEBUG] (s) packagename = com.mbm.properties.jaxb
[DEBUG] (f) xsdOptions = [org.apache.cxf.maven_plugin.XsdOption@69adf72c]
[DEBUG] (f) project = MavenProject: com.mbm:properties:0.0.1-SNAPSHOT @ C:\Users\mbmas_000\workspace\Properties\pom.xml
[DEBUG] -- end configuration --
[DEBUG] Args: [-p, com.mbm.properties.jaxb, -verbose, -encoding, null, -d, C:\Users\mbmas_000\workspace\Properties\target/generated/src/main/java, file:/C:/Users/mbmas_000/workspace/Properties/src/main/java/com/mbm/properties/schema/Properties.xsd]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.262 s
[INFO] Finished at: 2020-05-05T16:54:24-07:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.cxf:cxf-xjc-plugin:3.3.0:xsdtojava (xjc) on project properties: null: MojoExecutionException: NullPointerException -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.cxf:cxf-xjc-plugin:3.3.0:xsdtojava (xjc) on project properties: null
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:215)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:957)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:289)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:193)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)
Caused by: org.apache.maven.plugin.MojoExecutionException
at org.apache.cxf.maven_plugin.AbstractXSDToJavaMojo.execute(AbstractXSDToJavaMojo.java:289)
at org.apache.cxf.maven_plugin.XSDToJavaMojo.execute(XSDToJavaMojo.java:41)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210)
... 20 more
Caused by: java.lang.NullPointerException
at com.sun.tools.xjc.Options.requireArgument(Options.java:763)
at com.sun.tools.xjc.Options.parseArgument(Options.java:680)
at com.sun.tools.xjc.Options.parseArguments(Options.java:827)
at org.apache.cxf.maven_plugin.XSDToJavaRunner.run(XSDToJavaRunner.java:173)
at org.apache.cxf.maven_plugin.AbstractXSDToJavaMojo.run(AbstractXSDToJavaMojo.java:368)
at org.apache.cxf.maven_plugin.AbstractXSDToJavaMojo.execute(AbstractXSDToJavaMojo.java:276)
... 23 more
[ERROR]
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
导致此错误的原因是什么?我试图研究这个,但关于这个插件的信息并不多。
此问题是由于插件3.3.0版本的bug导致的。参见 https://github.com/ewerk/gradle-plugins/issues/89。
错误已修复,因此在 POM.XML 文件中需要做的就是将版本号从 3.3.0 更改为 3.3.1:
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-xjc-plugin</artifactId>
<version>3.3.1</version>