简体   繁体   English

JAXB2 Maven插件未读取配置

[英]JAXB2 Maven Plugin not reading Configuration

I am trying to generate some JAXB classes via my schema. 我试图通过我的模式生成一些JAXB类。 I have my jaxb2 maven plugin configured the following way. 我以以下方式配置了jaxb2 maven插件。

 <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>jaxb2-maven-plugin</artifactId>
    <version>1.3.1</version>
    <executions>
      <execution>
        <id>xjc</id>
        <goals>
          <goal>xjc</goal>
        </goals>
        <configuration>
           <packageName>aces.soa.schema</packageName>
           <generateDirectory>${project.build.directory}/generated-sources</generateDirectory>
           <schemaDirectory>${basedir}/src/main/resources/schema/ea</schemaDirectory>
        </configuration>
      </execution>
     </executions>
  </plugin>
</plugins>

When running the mvn jaxb2:xjc it complains that it cannot find the Schema, which is in the src/main/resources/schema/ea directory. 运行mvn jaxb2:xjc时,它抱怨找不到src / main / resources / schema / ea目录中的Schema。 When executing mvn -X jaxb2:xjc I see that the variables are not getting set at all. 当执行mvn -X jaxb2:xjc时,我发现变量根本没有设置。 Is there something else I need to do to configure the plugin propoerly? 我还需要做些其他事情来正确配置插件吗?

There's an issue with running this plugin with configuration elements in the execution elements, when the plugin is being called using: 当使用以下命令调用插件时,在执行元素中使用配置元素来运行此插件存在问题:

mvn jaxb2:xjc mvn jaxb2:xjc

A workaround for me was using: 我的解决方法是使用:

mvn generate-sources mvn generate-sources

Actually no. 其实不行 Having configuration outside executions configures the plugin globally. 在执行之外进行配置可全局配置插件。 Here is the doc: http://mojo.codehaus.org/jaxb2-maven-plugin/usage.html 这是文档: http : //mojo.codehaus.org/jaxb2-maven-plugin/usage.html

So, you should be able to configure each execution but it does not work some reason :( The question is still valid 因此,您应该能够配置每个执行,但是由于某些原因它不起作用:(该问题仍然有效

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM