Peter Delaney
Peter Delaney

Reputation: 5398

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?

Upvotes: 2

Views: 7818

Answers (2)

TjeerdJan
TjeerdJan

Reputation: 1924

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

Upvotes: 4

PaulG
PaulG

Reputation: 152

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

Upvotes: 2

Related Questions