maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Barrie Treloar <>
Subject Re: Use 2 pom.xml files with different names
Date Mon, 10 Aug 2015 14:27:36 GMT
On 10 August 2015 at 23:22, Alex Ditu <> wrote:

> Ok, look what I am trying to achieve: I have a project with 2
> profileDeployments (it produces 2 types of artifacts: a jar and a war)
> but from the same sources. So, I did the following thing: I have
> written 2 pom.xml files with 2 different names (for example: pom.xml
> and pom2.xml). When I want to build the .jar artifact I would use the
> command 'mvn deploy' when I want the .war artifact I would use: 'mvn
> -f pom2.xml' ---> after this, I encounter the problem I mentioned
> earlier.
> Note that the artifactIds are different.

You solution is simple: do not have one project, split it into multiple

A war file should not have any java code in it. So there is no need for you
do be having two poms. You war project depends on the jar project and you
are done.

There are plenty of examples on how to do this in the freely available
maven books at

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message