Do you have the same groupId, artifactId, and version specified in both POM 
files?

> -----Original Message-----
> From: Alex Ditu [mailto:ditu.alexan...@gmail.com]
> Sent: Monday, August 10, 2015 10:17 AM
> To: Maven Users List
> Subject: [EXTERNAL] Re: Use 2 pom.xml files with different names
> 
> So the answer is: one cannot use a pom file with a different name than
> 'pom.xml'.
> 
> In such case, why the -f option exists?
> On Aug 10, 2015 6:13 PM, "Benson Margulies" <bimargul...@gmail.com>
> wrote:
> 
> > On Mon, Aug 10, 2015 at 11:04 AM, Alex Ditu <ditu.alexan...@gmail.com>
> > wrote:
> > > I know how to solve my problem (by changing the project configuration).
> > >
> > > My question is: why mvn -f otherPomName.xml deploy doesen't work?
> > > And I said above how it fails.
> >
> > It does not _fail_. It does precisely what it is designed to do.
> >
> > mvn -f says, 'read the model of this project from an alternative
> > location, and then do what you do.'
> >
> > Once Maven has read the XML, it has no idea where the file came from,
> > and it's not supposed to have any idea where the file came from.
> > Maven's job is to do the build as specified by the POM abstract data
> > model. That makes no provisions for your scheme.
> >
> >
> >
> > > On Aug 10, 2015 5:59 PM, "Barrie Treloar" <baerr...@gmail.com> wrote:
> > >
> > >> On 10 August 2015 at 23:22, Alex Ditu <ditu.alexan...@gmail.com>
> 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 projects.
> > >>
> > >> 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 http://maven.apache.org/articles.html
> > >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
> > For additional commands, e-mail: users-h...@maven.apache.org
> >
> >

----------------------------------------------------------------------
This e-mail, including any attached files, may contain confidential and 
privileged information for the sole use of the intended recipient.  Any review, 
use, distribution, or disclosure by others is strictly prohibited.  If you are 
not the intended recipient (or authorized to receive information for the 
intended recipient), please contact the sender by reply e-mail and delete all 
copies of this message.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org

Reply via email to