Github user revans2 commented on a diff in the pull request:
https://github.com/apache/storm/pull/736#discussion_r40823287
--- Diff: DEVELOPER.md ---
@@ -222,6 +222,11 @@ To pull in a merge request you should generally follow
the command line instruct
# Build the code and run the tests
+Storm has some oddities with packaging and plugin dependencies. We build
our own plugins and shade storm-core,
+but have sub-modules that depend on storm-core. Because of this the build
needs to be split into two parts.
--- End diff --
Essentially what happens is that if you build a multi-module project where
one module depends on another module that is a part of the same build, maven
tries to be smart and will use the pom.xml and .jar or .class directory from
the module that is a dependency.
So if we have a project set up like the following where we have b depends
on a, and a is shaded. b will see different versions of the code and pom.xml
from a depending on what maven command is run.
- base/
- pom.xml
- a/
- pom.xml
- dependency-reduce-pom.xml
- target/
- classes/
- a.jar (shaded)
- a.orig.jar (no-shaded)
- b/
- pom.xml (depends on a)
If I run `mvn clean compile` the classpath for compiling b will include
`base/a/target/classes` which is not shaded, and if b is written to use a
shaded class it will fail to compile. b will also see the full set of
non-shaded dependencies from a, so if b is creating an uber jar, it will assume
that all of those dependencies will be provided by a, when in reality they will
not be.
If I run `mvn clean package` or `mvn clean install` b will see the shaded
a.jar on its classpath, but it will still see the full non-shaded set of a's
dependencies.
The only way I found to make b use the dependency-reduced-pom.xml from a,
is to first build/install a without b, and then build/install b without a.
That way a will install the shaded jar and dependency-reduced-pom.xml into the
local repository. Then b will get its dependencies from the local repo instead
of trying to rebuild a.
I'll try to add this to the documentation.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---