Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [m2e-dev] Eclipse import

Hi,

Since things work with plain Maven, such questions would better be directed to the m2e-dev@xxxxxxxxxxx mailing-list.

On Thu, Dec 19, 2019 at 11:35 PM Elliotte Rusty Harold <elharo@xxxxxxxxxxx> wrote:
There seems to be something I'm missing about importing projects into
Eclipse.

How do you perform this import?
 
I can build them at the command line, but they're full of
errors like
BookModel cannot be resolved to a type    BookContext.java
/doxia-book-renderer/src/main/java/org/apache/maven/doxia/book/context
   line 113    Java Problem
when I import them into Eclipse. m2e seems really confused about
missing lifecycle configurations.

Those classes like BookModel are generated-source from modello plugin. By default and unless you install a m2e/modello connector or mark the lifecycle step as "execute", the step will be ignored, and m2e won't generate the sources in your IDE.
From here, there are several possible approaches:
* Install a m2e/modello connector like https://github.com/tesla/m2eclipse-modello , you can hopefully achieve that with Window > Help > Preferences > Maven > Discovery > Open Catalog... (not sure it's there though). Note that even without those steps a quick-fix should be available in the pom for the modello plugin suggesting to install appropriate connector
* Tentatively, you can configure the m2e lifecycle mapping for modello as "execute" so it will run the source generation on build https://www.eclipse.org/m2e/documentation/m2e-execution-not-covered.html#execute-plugin-goal
* or you can simply just build manually first, then import with m2e. m2e should mark the generated-sources folder as a regular source folder and you should be able to work on the main code referencing classes from this generated-sources folder.

In any case, in Eclipse IDE in general, if it says it can't find a class, you can just instruct Eclipse IDE to use a specific folder of your project as a source path: right click on it > Build Path...> Use as source folder.
Maybe just doing that is enough for your use-case.

HTH

Back to the top