0

My project uses a Maven build system, and the Maven build includes a command line call to thrift to compile some files.

In bash, mvn generate-sources successfully completes.

But when I use m2e's Run as... -> generate-sources, the Eclipse console log shows an error about a binary not in PATH. How can I correct m2e's/Eclipse's notion of user PATH?

Using latest Eclipse, on latest Mac OS X.

  • Not a solution, but "Why" -> Maven expects to be entirely self contained, and whatever plugin that is making the call to thrift is responsible for finding the executable or including it. While unavoidable sometimes, relying on a program simply being in the correct place on the PATH is bad practice in the maven world. – Darth Android Sep 17 '13 at 14:49
  • @DarthAndroid 1) How else should integrate Thrift compilation into my Maven build process? 2) As I said, mvn generate-sources works in bash. It's Eclipse/m2e that completely fails to load to the user PATH environment variable. – apennebaker Sep 17 '13 at 15:32
0

Here is the rationale:

Why Generated Source Folders are not Added to the Classpath

Maven plugins used to generate source code from resources or other sources can register additional source folders to Maven project during the build. Usually such plugins are bound to process-resources (or process-test-resources) build phase (for example jaxb, modello or xdoclet plugins). This means that to get those source folders for generated sources, we have to run corresponding Maven build phase.

Not all projects using generated sources, so for performance reasons, M2Eclipse does not run any Maven goals by default on project import. This can be changed in the Maven settings in “Window / Preferences / Maven / Goals to run on project import” (e.g. you can specify “process-resources” build phase or specific plugins in that field).

Alternatively you can run “Maven / Update project configuration” action from the project popup menu, which is configured to run “process-resources” by default and it can be also changed on the same preference page.

References

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.