4

I have an application made up of a number of maven projects. I work on it in Eclipse. Some of the projects use Maven plugins to generate stub classes for web services etc.

When i import the projects into a new workspace I have to issue a maven generate sources command followed by attach source folders to build path on each project. The application i work on has more than 5-6 projects which require these steps.

Is there a plugin I can install in Eclipse to pick up the generated sources, or even one that generates the sources and updates the build path to save the manual steps?

E-Riz
  • 31,431
  • 9
  • 97
  • 134
cdugga
  • 3,849
  • 17
  • 81
  • 127

2 Answers2

0

I'm pretty sure the m2e plugin takes care of this automatically. m2e is included in the primary Java and Java EE packages of recent Eclipse versions, so you probably already have it. If you right-click on your project, and there is a Maven submenu, then the project is already managed by m2e. Otherwise, right-click and choose Configure > Convert to Maven project.

E-Riz
  • 31,431
  • 9
  • 97
  • 134
  • no, once the project is converted to a Maven project it is then necessary to generate the sources, this doesn't happen automaticaly – cdugga Sep 25 '14 at 06:24
  • 1
    Even if you do a Clean on the project(s)? I would have thought that code generation would be mapped as part of the Eclipse plugin lifecycle mappings. Maybe it has to be manually confgured; the secret sauce might be found in https://wiki.eclipse.org/M2E_plugin_execution_not_covered#lifecycle_mapping_metadata_provided_by_maven_plugin and https://wiki.eclipse.org/M2E_interesting_lifecycle_phases – E-Riz Sep 25 '14 at 12:54
0

Well, it depends on exact maven plugin you are using.

generate sources
Before I considered that m2e connector would be needed for any non common plugin, like generator. But I came recently on some plugins (1), that do it without special m2e connector.

attach source folders to build path
For this part check build-helper-maven-plugin and answer to M2E and having maven generated source folders as eclipse source folders

Community
  • 1
  • 1
Paul Verest
  • 60,022
  • 51
  • 208
  • 332