Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does one get JAXB-generated sources onto the Eclipse build path under m2e/Indigo?

Under Helios/m2eclipse, when I generated jaxb sources they would be put on the Eclipse source path when I did an "Update Project Configuration".

This doesn't happen with Indigo/m2e (initial release of 22 June 2011). What do I need to do to fix this?

I'm using the standard maven-jaxb2-plugin, version 0.75.

like image 371
Ed Staub Avatar asked Jun 24 '11 13:06

Ed Staub


4 Answers

In Eclipse go to "Install New Software" add the software site: http://bitstrings.github.com/m2e-connectors-p2/releases/

Select the "m2e connector for jaxb2"

Once you get that plugin installed the jaxb2 plugin should integrate correctly with the new version of m2e.

This info is from: https://bugs.eclipse.org/bugs/show_bug.cgi?id=350299

like image 75
Eric Avatar answered Oct 19 '22 04:10

Eric


Well, you need to right click on the "target/generated-sources/xjc and select something like "Build Path -> Use as source folder"

like image 32
Rafał Avatar answered Oct 19 '22 04:10

Rafał


As an alternate workaround if you can't get the m2e connector working, you can add the generated sources to the build path with build-helper-maven-plugin:

<build>
  ...
  <plugins>
    ...
    <plugin>
      <groupId>org.codehaus.mojo</groupId>
      <artifactId>build-helper-maven-plugin</artifactId>
      <version>1.7</version>
      <executions>
        <execution>
          <id>add-source</id>
          <phase>generate-sources</phase>
          <goals>
            <goal>add-source</goal>
          </goals>
          <configuration>
            <sources>
              <source>target/generated-sources/xmlbeans</source>
            </sources>
          </configuration>
        </execution>
      </executions>
    </plugin>
    ...     
  </plugins>
  ... 
</build>
like image 40
Shane Avatar answered Oct 19 '22 04:10

Shane


While waiting for a fix for this problem, I'm using the following temporary workaround:

We have the jaxb-plugin and generated classes in a separate maven module. In eclipse I can then "disable Maven nature" on that module only. Then I can use Indigo with m2eclipse on the rest of our large maven project and it will depend on the jar for the jaxb module (must be built from the command line). This works well for me since our project was allready organized this way.

like image 1
froden Avatar answered Oct 19 '22 06:10

froden