More below...
On 2011-05-03 9:14 AM, Wayne Fay wrote:
Anyway, shade is doing mostly what I want, except I cannot seem to configure
it to include classes from a sibling module in Maven.
If you have it set up as a dependency, it should "just work."
Except that then Maven complains it cannot find the repository that it
is in.
My structure is something like
parent/pom.xml
service-module/pom.xml
common-module/pom.xml
client-module/pom.xml
It is not clear to me if your parent directory is a sibling of
service-module and the others and thus all the pom.xml files are on
the same "level." If so, this is not how I would generally expect it
to be set up. Instead, you would have a parent directory and then
inside of that you would have the various modules.
So, I had to flatten my Eclipse projects because I am using IBM Rational
Team Concert for SCM and it does not yet support nested projects the way
Maven likes them. Consequently I followed the Maven documentation to
"flatten" my projects on the file system. For the most part Maven seems
happy with that - but maybe not in this case
To be clear - parent/pom.xml is a POM project, and
service-module/pom.xml, common-module/pom.xml and client-module/pom.xml
are all modules of parent/pom.xml as well as being JAR projects. The
directories parent, service-module, common-module and client-module are
all siblings because they were flattened.
I want the service-module.jar to contain the classes from common-module, but
can't figure out how. I tried putting the coordinates of common-module into
my service-module/pom.xml, but Maven complains because it cannot find
common-module in any repository.
First, you are probably not running from the parent. This should work
if you are running from the parent and have your multimodule project
set up properly.
When I tried running from the parent Maven threw a NullPointerException.
I found an article somewhere where other people had this same problem.
There was some advice there, but I have not got back to researching it
further. Maybe I just need to configure the parent POM properly?
Second, you can get around this by running "mvn install" in
common-module, and then try building the shaded jar in service-module
again. It will use the jar contents that are in your local repo cache,
not from the sibling directory.
OK, that makes sense - I will try that after my system backup finishes.
Hopefully you are using snapshot versions while sorting out these
issues. Versions are important and it is typical for someone new to
Maven to not fully appreciate that once versioned (with anything
except a Snapshot version), an artifact must never change. Versioned
artifacts are immutable in Maven.
Yes, I still have not moved off of my first snapshot - I'm really a
Maven newbie :-)
"Versioned artifacts are immutable in Maven." That sounds serious? Can I
take that to mean that you typically version a project after it has been
released because you are never going to change it again? If you changed
it then it would be another version wouldn't it?
As it is, I don't even know how to change the version yet.
Wayne
Thanks for all the advice.
Cheers, Eric
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]