Search code examples
eclipsemavenjaxbcode-generationbuildpath

Maven add source directory in Eclipse


I get my code generated from the maven-jaxb2-plugin maven plugin. It puts the code into target/generated-sources. Now I have to manually left click onto the project -> properties-> Java Build Path-> Add Folder.... That's kind of annoying for someone downloading it from SVN.

Is there some way to get that dome automatically through my pom?


Solution

  • This kind of stuff is the responsibility of IDE's Maven plugin and fortunately M2E supports it since recently (finally!) through the concept of M2E connectors, that is M2E extensions that understand a nature and lifecycle binding of certain plugins. And because it's since recently, not much Maven plugins have their connectors for M2E.

    However, you're lucky, because Jaxb2 plugins are actually already supported. I assume you're already using M2E. Then go to Preferences -> Maven -> Discovery, then Open Catalog, then find Jaxb2 connector.