Code is in jar project. Jar produces x.jar,
No code in Parent
No code in war. War depends on jar project output x.jar. It includes web
resources but no code. Produces x.war.
Ron
On 22/04/2014 1:15 PM, Narayanan K wrote:
Thanks all for replying.
So having a parent pom and inheriting common dependencies to the 2
child poms is the best solution.
My new maven project structure will be :
.
| -- pom.xml (parent pom)
| -- pom-war.xml (inherits from parent, generates a war)
| -- pom-jar.xml (inherits from parent, generates a jar)
There are no modules in the project. All poms are going to be in the
root path of the project.
1. Any examples on how to write the parent pom referencing the same
codebase for the child poms.
Will there be a <module> tag for parent pom. I understand that the
packaging for parent pom will be "pom".
2. The child poms will have <relativePath> in <parent> tag as
./pom.xml. Please correct me if this is wrong.
Thanks
Narayanan
Narayanan
On Tue, Apr 22, 2014 at 12:38 AM, Stephen Connolly
<[email protected]> wrote:
On 22 April 2014 01:18, Narayanan K <[email protected]> wrote:
Hi
We have a default pom file with packaging "war" for our codebase.
From the same code base we also want to generate a normal jar and a
fat jar with dependencies.
Currently solution that has been implemented is another pom-jar.xml
file that has the packaging as jar and maven-assembly-plugin to
generate the jar with dependencies. We use mvn install -f pom-jar.xml.
But we are in a situation where if any new dependency is added to
pom.xml, we need to add to pom-jar.xml as well as it is the same
codebase.
To avoid this we thought of couple of solutions -
1. Add maven-jar-plugin and maven-assembly-plugin to the default pom
with packaging war - so it generates a war file, a normal jar file and
fat jar out of the same pom. So we can do away with the pom-jar.xml.
Not sure if this is a good solution. We tried this, but this is
working well only in maven 3.0.4. The assembly plugin is not working
well with Maven 2 (which is in our build environment) while generating
the fat jar.
2. Have a parent pom and put all the dependencies and plugins in that
and have 2 child poms in the same codebase with different names
inherit from parent pom, one that has packaging of war that generates
war file and the other child pom has packaging jar with maven assembly
plugin to generate both normal and fat jar. And all new dependencies
need to be added only to parent pom.
This solution will make us have 3 pom files in codebase, doesnt look
very elegant,
actually depends on your point of view. To me this is the more elegant
solution as you clearly see the relationship between inputs (pom.xml) and
outputs (artifacts, e.g. jars wars, etc)
but will solve our dependency management issues between
the 2 packaging.
Are these good solutions? Is there any other good solution available
for this scenario ?
Regards
Narayanan
---------------------------------------------------------------------
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]
--
Ron Wheeler
President
Artifact Software Inc
email: [email protected]
skype: ronaldmwheeler
phone: 866-970-2435, ext 102
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]