简体   繁体   中英

JAXB2 Maven Plugin not reading Configuration

I am trying to generate some JAXB classes via my schema. I have my jaxb2 maven plugin configured the following way.

 <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. When executing mvn -X jaxb2:xjc I see that the variables are not getting set at all. 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

A workaround for me was using:

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

So, you should be able to configure each execution but it does not work some reason :( The question is still valid

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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