[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [m2e-users] Multi pom file project
|
Hi,
On 5/18/16 9:15 PM, Eric B wrote:
That's kind of what I am trying to do right now as well. The only catch
to that is that the full "library.jar" file contains extra classes that
i don't want in it.
So at the moment, my plan is to :
a) Build library.jar with a classifier DO_NOT_CONSUME which contains all
the classes.
b) Use the dependency:unpack in the sub modules to selectively unpack
the resources I want to have in each module and reassemble them accordingly.
It's a very ugly/clunky solution, and wish I had a better option.
If you have any brilliant ideas how to improve, I'd love to hear them.
make a separate module which contains only those extra classes. Than you
have a separte module which you can simply use a dependency...
If you have resources which are needed in different modules you should
take a look at the maven-remote-resources-plugin[1] which can help in
such situations and will prevent using such dirty unpack hacks...
But what kind of resources do you need to share between several modules
? Apart from that it sounds strange that you unpack the resources
reassembly them ...?
You need to do separation of concerns also in build area...and following
this concept helps very often making a build cleaner...
Kind regards
Karl Heinz Marbaise
[1]:
http://maven.apache.org/plugins/maven-remote-resources-plugin/examples/sharing-resources.html
Thanks,
Eric
On Wed, May 18, 2016 at 3:09 PM, Matthew Piggott <mpiggott@xxxxxxxxxxxx
<mailto:mpiggott@xxxxxxxxxxxx>> wrote:
Have your common code ("library.jar") in one module. Then have the
other modules (secured, unsecured, etc) declare it as a dependency,
you can use the maven shade plugin
<https://maven.apache.org/plugins/maven-shade-plugin/> to bundle the
dependencies into the jar.
On 18 May 2016 at 14:48, Eric B <ebenzacar@xxxxxxxxx
<mailto:ebenzacar@xxxxxxxxx>> wrote:
Hi Matthew,
Can you please expand on your concept? It is tickling something
in the back of my mind but I just can't seem to grasp it
precisely...
Thanks,
Eric
On Wed, May 18, 2016 at 1:17 PM, Matthew Piggott
<mpiggott@xxxxxxxxxxxx <mailto:mpiggott@xxxxxxxxxxxx>> wrote:
Have one module with the common code then create other
modules which shade in the common code dep.
On 18 May 2016 at 12:48, Anton Tanasenko
<atg.sleepless@xxxxxxxxx <mailto:atg.sleepless@xxxxxxxxx>>
wrote:
Hi Eric,
Every eclipse project must reside in its own dir, it
doesn't allow mixing multiple projects in the same
directory.
Eclipse also doesn't allow storing any of its resources
outside of their respective project's dir.
So you should definitely convert your project into a
proper multimodule build. There is no way your setup
will work correctly in eclipse otherwise.
2016-05-18 19:09 GMT+03:00 Eric B <ebenzacar@xxxxxxxxx
<mailto:ebenzacar@xxxxxxxxx>>:
Sure - but the problem is that they all use the same
sources. And refactoring the code base into 4
separate modules is not really an option.
Right now I'm playing around with poms in subfolders
that use :
<sourceDirectory>${basedir}/..</sourceDirectory>
but that means I have to override all the defaults
in the maven pom, which is a royal nuissance. And
I'm not even convinced that all plugins will work
properly.
Thanks,
Eric
On Wed, May 18, 2016 at 11:51 AM, Jeff Jensen
<jjensen@xxxxxxxxxx <mailto:jjensen@xxxxxxxxxx>> wrote:
Best is to move them to 4 separate
modules/directory structures. Then it will work
without issues.
On Wed, May 18, 2016 at 10:36 AM, Eric B
<ebenzacar@xxxxxxxxx
<mailto:ebenzacar@xxxxxxxxx>> wrote:
Hi,
I am migrating a legacy app to maven and am
having miserable time with one module in
particular. The way the Ant script worked
is that it built 3 or 4 artifacts from the
same code base.
- secure-EJB.jar (some subset of classes)
- secure-EJB-client.jar (client EJB)
- unsecure-EJB.jar (another subset of classes)
- library.jar (regular java library with
the bulk of classes, apart from the EJB
beans/facades)
At first I tried to get Maven to build
everything via a single pom, but that was
just a recipe for disaster (and broke just
about every maven convention I know), so I
abandoned the concept altogether.
Instead, I ended up with 4 poms - each
building to a separate target/ folder:
- pom.xml (parent pom, defines all the
dependencies required for the build, and
includes the 3 next poms as modules)
- pom-ejb-secure.xml (inherits pom.xml)
- pom-ejb-unsecure.xml (inherits pom.xml)
- pom-jar.xml (inherits pom.xml)
pom.xml (snippet):
<modelVersion>4.0.0</modelVersion>
<artifactId>ejb-pom</artifactId>
<groupId>org.myc</groupId>
<packaging>pom</packaging>
<modules>
<module>pom-securedEjb.xml</module>
<module>pom-unsecuredEjb.xml</module>
<module>pom-jar.xml</module>
</modules>
<properties>
<skipTests>true</skipTests>
</properties>
...
...
From a command line build (ex: mvn clean
deploy), everything works properly, and as
expected. All artifacts are independently
built and deployed, at the cost of
recompiling the classes for each pom.
However, I have no idea how to
load/configure this in Eclipse/m2e such that
it sees the different artifacts produced,
and more importantly is able to resolve
against them when referenced in other open
projects (Enable Workspace Resolution).
When I import the maven project, it just
"loads" the parent pom.xml and does not
recognize that there are modules that need
to be loaded/resolved as well.
Is there anything I can do about this?
Thanks,
Eric