tags:

views:

35

answers:

1

I have a parent pom whose packaging type is jar.

Then I have a child pom whose packaging is war. I want to include the packaged parent jar in WEB-INF/lib of the packaged child.

How do I achieve this?

+1  A: 

I'm not sure to understand (a parent pom with a jar packaging, is this working?) but the "normal way" would be to add a dependency on the JAR artifact in your WAR project. But I think that you know that and that there is a problem (which is the part that is unclear).

Maybe you could use the dependency plugin instead. Use dependency:copy to get the dependency and copy it to ${project.build.directory}/${finalName}/WEB-INF/lib during prepare-package.

Pascal Thivent
It is working - both the parent .jar is prepared, and the client war is prepared. I'll try the suggested `dependency:copy`
Bozho
@Bozho If it's working, what is the question then :S I must be missing something.
Pascal Thivent
"it is working" was an answer to your question about parent pom with jar packaging :) I'm asking for a way to include the parent artifact as a dependency of the child.
Bozho
the actual scenario is that I have this partial JSR-299 implementation (my graduation project), and I want to create a sub-project (called examples) which demonstrates how my implementation works in a web context.
Bozho
@Bozho Did you manage to get what you want with `dependency:copy`? PS: I'm very surprised it's working (especially reactor builds). BTW, what is the "it's"? Inheritance or aggregation?
Pascal Thivent
Inheritance. Didn't try the dependency:copy yet, a bit busy with other things :)
Bozho
the `dependency:copy` didn't work because the jar isn't installed in the local repository (nor anywhere else). I thought it should be possible to obtain it by virtue of being the parent artifact.
Bozho
@Bozho dependencies are resolved through the local repository, there is no way to change that.
Pascal Thivent
ok, I'll install it in the local repository then
Bozho