OK, I
1. deleted my local repo for my project
2. did a "mvn clean" - no problems there
3. did a "mvn package"
I then looked inside the resulting uber-jar and I can see my project
modules there. So it looks like shade does pick up dependencies from the
reactor properly.
I think I was thrown off by various articles I found via google search
that seemed to indicate you needed to manually install the dependencies
first before running shade. I am wrestling with some dependency version
hell issues that also led me to believe the reactor was not being used,
so now I know that is a different problem. I hate it when things fail at
run-time after a seemingly successful build.
Thanks, Stephen , for forcing me to test this explicitly.
Cheers, Eric
On 2015-04-08 1:49 PM, Karl Heinz Marbaise wrote:
Hi,
On 4/8/15 10:37 PM, Stephen Connolly wrote:
Well just to give you a data point. I am a firm believer in never
running
`install` unless I have to. I also use the shade plugin a lot and I have
never had the issue you describe. IOW it works for me from a clean local
repo with just `mvn package`... I suspect you are doing something silly.
this is one of the most important tests for a multi module build if
you have correctly configured it.
If a mvn clean package from the root with a complete empty local
repository does not work...it means you build is wrong...
Here is a simple example
https://github.com/khmarbaise/javaee/
using shade as well...
Kind regards
karl Heinz Marbaise
Also what version of Maven are you using, IIRC some versions of Maven
3.0
(I think 3.0-3.0.3) had a bug with reactor resolution
Yes...
At least 3.0.5 should be used...may be newer ....3.0.3 has exactly
bugs related to reactor / local repository resolution....
Kind regards
Karl Heinz Marbaise
On 8 April 2015 at 20:55, Eric Kolotyluk <eric.koloty...@gmail.com>
wrote:
OK, I will have to test this further, as that has not been my
experience
over the years.
Basically my module pom looks like
<parent>
<groupId>com.3tierlogic</groupId>
<artifactId>platform3</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<groupId>com.3tierlogic.platform3</groupId>
<artifactId>p3-s-behaviors</artifactId>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>com.3tierlogic.platform3</groupId>
<artifactId>p3-util</artifactId>
</dependency>
<dependency>
<groupId>com.3tierlogic.platform3</groupId>
<artifactId>p3-core</artifactId>
</dependency>
</dependencies>
And my parent pom looks like
<groupId>com.3tierlogic</groupId>
<artifactId>platform3</artifactId>
<packaging>pom</packaging>
<version>1.0.0-SNAPSHOT</version>
<modules>
<module>p3-core</module>
<module>p3-s-accounts</module>
<module>p3-s-behaviors</module>
<module>p3-s-harmonizer</module>
<module>p3-s-ingestor</module>
<module>p3-s-messaging</module>
<module>p3-s-rewards</module>
<module>p3-s-scraper</module>
<module>p3-util</module>
</modules>
Does this look OK, or am I doing something wrong?
Cheers, Eric
On 2015-04-08 12:18 PM, Anton Tanasenko wrote:
I meant "(containing other modules)" of course.
2015-04-08 22:17 GMT+03:00 Anton Tanasenko <atg.sleepl...@gmail.com>:
Shade plugin should pick up reactor dependencies just fine, as
long as
the
shading module (3 in your case) references the root project
(containing
other dependencies) correctly in the parent section.
2015-04-08 21:14 GMT+03:00 Eric Kolotyluk <eric.koloty...@gmail.com>:
Adrien, while this would be what we might expect, it fails
because the
maven-shade-plugin pulls included artifacts from the local repo.
Consequently, during the package phase, while packages have been
built
for
all the modules in the right order, they have not been deposited
in the
local repo because the install phase comes after the the package
phase.
If
the shade plugin were to take the artifacts from the target
directories
in
modules 1 & 2, then all would be fine, but that is not what shade
does.
Cheers, Eric
On 2015-04-08 10:50 AM, Adrien Rivard wrote:
Hi,
Running package in project A should run package in module1, then
package
in
module 2, then package in module 3 (which will be build with
freshly
build
module 1 and 2).
If this is not working then something is wrong within your build
(either
dependencies, or modules declaration?).
There is generaly no need to run install in a correct maven build.
I am not sure if this is the case, but if you declared the
shaded part
in
the project A pom, this is the wrong place, it should be either in
module 3
or module 4.
On Wed, Apr 8, 2015 at 7:36 PM, Eric Kolotyluk <
eric.koloty...@gmail.com
wrote:
The problem I have now is that I have to manually do the
following:
project A/module 1> mvn install
project A/module 2> mvn install
project A> mvn package
Because the maven-shade-plugin for module 3 needs the artifacts
for
modules 1 & 2 to be installed in the local repo first. This
totally
sucks
because it is error prone, and Maven is supposed to be about
automation.
Similarly, if I do something like
project A/module 3> mvn package
I want modules 2 & 3 to be installed first, if necessary, so
that the
shade plugin will pick up the latest versions of these artifacts.
The other approach I am considering is to run the
maven-shade-plugin
in
the deploy phase, to ensure that all dependencies have been
installed
first, but I really don't want to have to do a deploy this often,
especially when I am testing. I wish there were a phase between
install
and
deploy that I could used to create my shaded assemblies. Is
there some
way
to ensure the shade plugin runs last in the install phase, after
everything
else has been installed?
Cheers, Eric
On 2015-04-08 9:47 AM, Curtis Rueden wrote:
Hi Eric,
project A> mvn package
such that modules 1 & 2 will automatically be installed
before the
shade plugin runs for module 3?
My understanding is that you would need to run "mvn
install" (not
"mvn
package") from the project A base directory, if you want 1 and
2 to
be
installed. But it should happen in the order you desire, no?
-Curtis
On Wed, Apr 8, 2015 at 11:23 AM, Anders Hammar
<and...@hammar.net>
wrote:
Not sure I follow. Isn't Project A a multi-module project?
Then if
you do
"mvn package", module 1 and 2 should build before 3 if you have
declared
the dependencies correctly.
/Anders
On Wed, Apr 8, 2015 at 6:17 PM, Eric Kolotyluk <
eric.koloty...@gmail.com
wrote:
I have
Project A
- module 1
- module 2
- module 3 (depends on 1 & 1)
-- creates shaded artifact
Is there a way that I can configure my poms to do
project A> mvn package
such that modules 1 & 2 will automatically be installed
before the
shade
plugin runs for module 3?
Cheers, Eric
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org