Home » Eclipse Projects » Oomph » M2E Setup Task: ignore the root pom.
|
Re: M2E Setup Task: ignore the root pom. [message #1717878 is a reply to message #1717831] |
Thu, 17 December 2015 13:37 |
Ed Merks Messages: 33258 Registered: July 2009 |
Senior Member |
|
|
Jeremie,
It will depend on what's in your source locator. Right now I assume it
points at the root of the clone. You can have multiple locators that
point farther down in the tree, but if you have a relatively flat
structure, you'd might need quite a lot of source locators. A source
locator can also have excluded paths, but that's only good for pruning
branches and here you want to exclude the root, but not the stuff below it.
A little-used feature of Eclipse is filters to exclude subtrees of
projects, e.g., we use this to filter out the target folder where the
Maven build produces its result. But that's stored in the .project file
and I guess the point of using the maven import task is to not have
those .project files in your git clone. Otherwise you could use that to
show this parent project, but without all the other projects nested as
children.
How would you deal with this if you did this import setup manually?
On 17/12/2015 7:35 AM, Jeremie Bresson wrote:
> I have a repository containing pom files that is organized like this:
> repo
> | pom.xml
> |
> +--- coolstuff.module1
> | | pom.xml
> | |
> | \---src/main/java
> | \---...
> |
> +--- coolstuff.module2
> | | pom.xml
> | |
> | \---src/main/java
> | \---...
> |
> \--- coolstuff.parent
> pom.xml
>
> The parent pom is located in the coolstuff.parent project and module1 and module2 are referring to it.
>
>
> <parent>
> <groupId>coolstuff</groupId>
> <artifactId>coolstuff.parent</artifactId>
> <version>1.0.0-SNAPSHOT</version>
> <relativePath>../coolstuff.parent/</relativePath>
> </parent>
>
>
> At the root of the repository, we have a convenience root pom, just pointing to our parent. This is useful for our CI Server (convention) but it brings nothing for the developer inside Eclipse.
>
> <groupId>coolstuff</groupId>
> <artifactId>coolstuff.root</artifactId>
> <version>1.0.0-SNAPSHOT</version>
> <packaging>pom</packaging>
> <modules>
> <module>coolstuff.parent</module>
> </modules>
>
>
> This corresponds more or less to the http://git.eclipse.org/c/tycho/org.eclipse.tycho-demo.git/tree/itp04-rcp (the pom at the root is actually used as parent pom but this doesn't matter for my question).
>
> When I run the setup, all m2e projects are materialized (projects are called with the artifactId value):
>
>
> I do not need to get a project for the pom.xml at the root (artifactId:parent in the "itp04-rcp" example).
> How can I tell the "Maven Import" task that it should not import the root pom?
> I thought there was an exclude option.
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
| |
Re: M2E Setup Task: ignore the root pom. [message #1718335 is a reply to message #1717878] |
Tue, 22 December 2015 15:13 |
Jeremie Bresson Messages: 1252 Registered: October 2011 |
Senior Member |
|
|
Thank you for your answers. Here some additional inputs:
---
Resource filters is something that would do what I need.
Here is the corresponding entry in the .project file:
<filteredResources>
<filter>
<id>1450465694716</id>
<name></name>
<type>10</type>
<matcher>
<id>org.eclipse.ui.ide.multiFilter</id>
<arguments>1.0-name-matches-false-false-*</arguments>
</matcher>
</filter>
</filteredResources>
As you have guessed, the Tycho Example repository doesn't contain the .project files.
In our case we have .project file in each project (because we are an Eclipse-IDE-only project, this is not a problem for us to commit the project metadata files. On this topic, see this presentation (video) given by Aurelien Pupier at EclipseCon Europe 2015).
BUT we do not consider the root of the repository as an eclipse project, the root pom.xml is only there as convenience. Filtering resources in .project will not work (unless this is something we can fix after the project import with Oomph).
---
In Oomph I have selected a "Maven Import" task, because I had the feeling that this is what corresponds to what I am doing.
I did not verify it, but I think that what important is that when a Maven project is imported, the IDE also runs a "Maven > Update project..." on it
I also have the feeling, that using a "Maven Import" task also tells Oomph to install m2e in the IDE.
Do you think that I should use a "Projects import" task?
---
To setup the project manually, I would select "Import Maven Projects..." and then I would deselect the root pom; but I am not sure that this is the recommended solution.
-
Attachment: Filters.png
(Size: 86.56KB, Downloaded 1906 times) -
Attachment: Import.png
(Size: 93.47KB, Downloaded 1966 times)
|
|
|
Re: M2E Setup Task: ignore the root pom. [message #1718368 is a reply to message #1718335] |
Wed, 23 December 2015 05:39 |
Ed Merks Messages: 33258 Registered: July 2009 |
Senior Member |
|
|
Jeremie,
Comments below.
On 22/12/2015 4:13 PM, Jeremie Bresson wrote:
> Thank you for your answers. Here some additional inputs:
>
> ---
>
> Resource filters is something that would do what I need.
>
>
> Here is the corresponding entry in the .project file:
> <filteredResources>
> <filter>
> <id>1450465694716</id>
> <name></name>
> <type>10</type>
> <matcher>
> <id>org.eclipse.ui.ide.multiFilter</id>
> <arguments>1.0-name-matches-false-false-*</arguments>
> </matcher>
> </filter>
> </filteredResources>
>
> As you have guessed, the Tycho Example repository doesn't contain the .project files.
Yes, though I don't understand the Maven import process well, and
always wonder how it can make sure the final .project has all the things
I want in it, i.e., natures and builders, where builder details can
contain quite some configuration. And of course in this case, if one
wants filters, which for Oomph we really want because otherwise the
build target folders would make the workspace huge (affecting things
like refresh and search), and we don't want to see those in the
workspace at all. But it seems there's no way to specify for the Maven
importer to add those when it generated the .project file (or perhaps
there is but we don't know how)...
>
> In our case we have .project file in each project (because we are an Eclipse-IDE-only project, this is not a problem for us to commit the project metadata files. On this topic, see https://www.eclipsecon.org/europe2015/session/fight-over-committing-ide-meta-files-misconceptions-misunderstandings-and-solutions (https://www.youtube.com/watch?v=J5RzSbpNLM4) given by Aurelien Pupier at EclipseCon Europe 2015).
This not committing of the .project files really implies you can only
use Maven to import it...
>
> BUT we do not consider the root of the repository as an eclipse project, the root pom.xml is only there as convenience.
It's not so convenient if it's not part of the workspace. How do you
edit it? I guess not so often in any case.
> Filtering resources in .project will not work (unless this is something we can fix after the project import with Oomph).
A Resource Modify task after the project is imported into the workspace...
>
> ---
>
> In Oomph I have selected a "Maven Import" task, because I had the feeling that this is what corresponds to what I am doing.
>
> I did not verify it, but I think that what important is that when a Maven project is imported, the IDE also runs a "Maven > Update project..." on it
I see.
>
> I also have the feeling, that using a "Maven Import" task also tells Oomph to install m2e in the IDE.
Yes, task implementations have install dependencies.
>
> Do you think that I should use a "Projects import" task?
No, it does seem good to use something that corresponds what you would
use manually.
>
> ---
>
> To setup the project manually, I would select "Import Maven Projects..." and then I would deselect the root pom; but I am not sure that this is the recommended solution.
I see. Source Locators can also contain predicates so you could
specify a predicate that matches everything except this root project.
E.g., perhaps a Not predicate of a File predicate for pom.xml that also
specifies a content pattern that matches only this root pom.xml's
content (which no doubt has a unique artifactId).
>
>
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
| |
Goto Forum:
Current Time: Mon Dec 09 04:45:39 GMT 2024
Powered by FUDForum. Page generated in 0.04334 seconds
|