views:

1437

answers:

3

I have determined that two jaxb plugin for maven2 exist, with some different configurations. The one is from Sun: http://jaxb.dev.java.net/jaxb-maven2-plugin/ the other from Mojo: http://mojo.codehaus.org/jaxb2-maven-plugin/

Has anybody experience with these two plugins, and give a recommendation?

Thanks Matt. On my little research project, i found that there's quit another plugin comming from the sunners:

<groupId>com.sun.tools.xjc.maven2</groupId>  
<artifactId>maven-jaxb-plugin</artifactId>  

and that one:

<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>

and still the one from Codehouse.

A: 

I would guess that one is for the original JAXB specification and the codehaus one is for the JAXB 2.1 specification (and if the dev.java.net would load some time this century, I'd be able to say for sure).

matt b
Yeah, and if it would be possible to dowload the **org.jvnet.jaxb2.maven2 plugin** i would compare them. Since the repo of java doesn't provide the plugin it's out of the game, although the configuration-syntax seemed a little more convenient.
cuh
+5  A: 

Let's summarize. We have:

  1. the maven-jaxb2-plugin (https://maven-jaxb2-plugin.dev.java.net/)
  2. the maven-jaxb-plugin (https://jaxb.dev.java.net/jaxb-maven2-plugin/)
  3. the jaxb2-maven-plugin (http://mojo.codehaus.org/jaxb2-maven-plugin/)

Based on the comments of this thread, I've always used the maven-jaxb2-plugin (i.e. plugin #1):

Concerning the org.jvnet.jaxb2.maven2:maven-jaxb2-plugin versus com.sun.tools.xjc.maven2:maven-jaxb-plugin, from my point of view it's definitely the first one (https://maven-jaxb2-plugin.dev.java.net/).

This plugin has much more features than com.sun.tools.xjc.maven2:maven-jaxb-plugin, the development is active. Finally, I'm one of the authors :) and I'd say we keep in touch with JAXB developers and users and react to the latests features/requests.

And indeed, the plugin #2 isn't very active (dead?). And because I've always been happy with #1, I've never used plugin #3 so can't really say anything about it. Just in case, here is a working configuration for plugin #1:

<project>
  ...
  <repositories>
    <repository>
      <id>maven2-repository.dev.java.repositorynet</id>
      <name>Java.net Maven 2 Repository</name>
      <url>http://download.java.net/maven/2&lt;/url&gt;
    </repository>
    <repository>
      <id>maven-repositoriesository.dev.java.net</id>
      <name>Java.net Maven 1 Repository (legacy)</name>
      <url>http://download.java.net/maven/1&lt;/url&gt;
      <layout>legacy</layout>
    </repository>
  </repositories>
  <pluginRepositories>
    <pluginRepository>
      <id>maven2-repository.dev.java.net</id>
      <name>Java.net Mavenen 2 Repository</name>
      <url>http://download.java.net/maven/2&lt;/url&gt;
    </pluginRepository>
    <pluginRepository>
      <id>maven-repository.dev.java.repositorynet</id>
      <name>Java.net Maven 1 Repository (legacy)</name>
      <url>http://download.java.net/maven/1&lt;/url&gt;
      <layout>legacy</layout>
    </pluginRepository>
  </pluginRepositories>
  ...
  <build>
    <plugins>
      <plugin>
        <inherited>true</inherited>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <source>1.5</source>
          <target>1.5</target>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.jvnet.jaxb2.maven2</groupId>
        <artifactId>maven-jaxb2-plugin</artifactId>
        <executions>
          <execution>
            <goals>
              <goal>generate</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>
Pascal Thivent
Thx for the config. In the end i use the codehouse plugin, which gives me the same capabilities for my needs. Only the syntax differs as far as i have seen.
cuh
What about http://ws.apache.org/jaxme/mp/ which is mentioned directly on Maven's site?
rcl
@rcl: Can't say much about it but since it hasn't been updated for more than 4 years, I'm not sure I would use it. I'm just happy with the [maven-jaxb2-plugin](https://maven-jaxb2-plugin.dev.java.net/).
Pascal Thivent
+3  A: 

I am the author of maven-jaxb2-plugin.

The maven-jaxb2-plugin currently uses JAXB 2.1. In the next versions we'll also provide JAXB 2.0 and JAXB 2.2 versions.

As for "which plugin is better" discussion, check the features, decide yourself. Let me know if you miss some functionality.

lexicore