Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [m2e-users] Multiple POMs in one project - how?

Am 18.01.2013 21:17, schrieb Johannes Wachter:
Hi Jo,

I don't think that it's necessarily a specific m2e thing you need to
do to achieve that but rather the standard maven way.

Not really. I see no difficulties defining multiple poms working on the same source tree, but I was under the impression that m2e is working under the assumption that there's 1 pom per project.

If that's wrong, I'm fine.
Unless I'm not because something else comes to bite me, I'm just beginning to use Maven and m2e in anger.

I assume since it is one checkout from SVN that all your sources,
resources, binaries are in different folders.

Essentially, yes. I might need to move stuff around, but that's what maven plugins are for.

The following possibilities would now be available:

1.) Generate the POM for each artifact and create an additional
parent project that contains those projects as modules.

Hm... well, yes, the poms might share some configuration.
There are dependencies, of course.

> Either
directly in the checkout's root or another folder.

I'm going to place the SVN checkout in a subfolder so that it isn't polluted with unversioned files.
Actually that's already in place and working.

> This could lead to
the following structure:

/svn/project1
> /svn/project2
> /svn/project3
> /svn/pom.xml or /svn/root/pom.xml

Then you can import the different projects into Eclipse using m2e as
different projects.

The svn root isn't in any Eclipse project.
While that's certainly an option, not all coworkers are comfortable enough with the command line, so I'd prefer to have everything managed from inside Eclipse.

So the structure would have to look something like this:
myproject (contains the Eclipse project)
  .project
  svn-origin (contains the svn checkout)
    .svn
    src
    libs
    docs
    part2
    part3
  poms -- here, I'm getting speculative
    artifact1 -- Just for the pom, nothing else to see
      pom.xml
    artifact2
      pom.xml
    artifact3
      pom.xml
    artifact4
      pom.xml
    artifact5
      pom.xml
Even if I could make that work, I'd have multiple poms fighting over what classpath should be in Eclipse.

2.) create one project for your checkout and organize it internally
using the multiple source/resource folders using build helper.

Yep, that's exactly what I'm doing.

> Then
you could create the different artifacts e.g. using the assembly
plugin and attach them to your project.

This has the problem that it's not the Maven approach exactly

Yes. I'd be unable to have a dependency that uses just some of the artifacts. Not needed right now, so I could live with that, but it would have to be solved sooner or later.

> and
that the assembly plugin doesn't work well directly inside Eclipse.

Oh, what's the issue?
(I have had some issues with unpacknatives, those might have similar reasons.)

3.) Create one pom for the project itself and use other projects that
depend on it and extract stuff to build different other artifacts
based on the one project

Hm... something like this?

base
  svn-origin (svn checkouts go HERE)
  pom.xml, doing this:
    (simply packs the checkout into a zip file)
    (might even run the checkout directly)
artifact1 (built from source)
  pom.xml, doing this:
    (depends on svn-origin)
    (unpacks svn-origin.zip)
    (moves unpacked files into sources&resources subtrees)
    (compilation & install are just normal)
artifact2 (just unpacks a jar from the zip file)
  pom.xml, doing this:
    (depends on svn-origin)
    (unpacks svn-origin.zip)
    (moves the jar and source jar into the target directory)
    (install etc. are just normal)

This should work, unless those problems with the assembly plugin you mentioned.

Thanks for the feedback :-)

Regards,
Jo


Back to the top