4

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?

Lii
  • 11,553
  • 8
  • 64
  • 88
Franz Kafka
  • 10,623
  • 20
  • 93
  • 149

2 Answers2

5

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.

Lii
  • 11,553
  • 8
  • 64
  • 88
Michał Kalinowski
  • 16,925
  • 5
  • 35
  • 48
  • Thanks, I did what you said but the extra source directry doesn't appear in Eclipse? Do I somehow still have to activate that feature? – Franz Kafka Apr 15 '12 at 08:43
  • Actually that should be enough. Such behaviour should be a part of connector's implementation. It seems they didn't implement it. :( – Michał Kalinowski Apr 15 '12 at 16:13
0

maven add-sources should do the trick for netbeans or eclipse

M2E and having maven generated source folders as eclipse source folders

Community
  • 1
  • 1
Kalpesh Soni
  • 6,879
  • 2
  • 56
  • 59