Franz Kafka
Franz Kafka

Reputation: 10831

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?

Upvotes: 4

Views: 9824

Answers (2)

Michał Kalinowski
Michał Kalinowski

Reputation: 17933

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.

Upvotes: 5

Kalpesh Soni
Kalpesh Soni

Reputation: 7257

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

M2E and having maven generated source folders as eclipse source folders

Upvotes: 0

Related Questions