Eclipse import

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Eclipse import

Elliotte Rusty Harold
There seems to be something I'm missing about importing projects into
Eclipse. 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.

Is there something I'm missing here?

--
Elliotte Rusty Harold
[hidden email]

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Eclipse import

Mickael Istria-2
Hi,

Since things work with plain Maven, such questions would better be directed
to the [hidden email] mailing-list.

On Thu, Dec 19, 2019 at 11:35 PM Elliotte Rusty Harold <[hidden email]>
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