我找到了xmlbeans 5 maven插件配置的描述。 它告诉我们将模式生成对log4j-core的依赖添加到配置中。
不过,好像不行。我仍然收到错误消息
SchemaCompiler Metadata LOAD:org/apache/xmlbeans/metadata GEN:eu/ngong/eaGuid
ERROR StatusLogger Log4j2 could not find a logging implementation. Please add log4j-core to the classpath. Using SimpleLogger to log to the console...
显然,SchemaCompiler在生成时需要log4j-core。是否有另一种方法可以在生成时将log4j-core放入类路径?
相关问题帮助了我。
我必须直接在插件子句中添加 pom.xml 中的依赖项:
<plugin>
<groupId>org.apache.xmlbeans</groupId>
<artifactId>xmlbeans</artifactId>
<version>5.1.1</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
<configuration>
<repackage>eu.ngong.tstLog</repackage>
<name>tstLog</name>
<noAnn>true</noAnn>
<partialMethods>ALL,-GET_ARRAY,-XGET_LIST,-XGET_ARRAY</partialMethods>
<xmlConfigs>${basedir}/src/main/schema/tstLog.xsdconfig</xmlConfigs>
</configuration>
<dependencies>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.20.0</version>
</dependency>
</dependencies>
</plugin>