maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sander Verhagen <san...@sanderverhagen.net>
Subject RE: Use 2 pom.xml files with different names
Date Mon, 10 Aug 2015 16:09:30 GMT
Hi,





I think you're being treated unfairly ;-)



Yes, it's not the Maven way, but you have acknowledged that. But sometimes projects are the
way they are. I do my best to deliver nice Maven projects, but I have one project also where
the sources are so intertwined that I cannot possibly split them up. This is a documentation
project, and its "sources", from Maven's perspective, are generated for me (not just once),
so refactoring these sources is out of my hands. I wish it were different, but for now this
is what it is, and I've decided that for me this is still a valid use case for Maven. So,
give the guy a break ;-)



By the way, I think the discussion mixes up artifacts and folders. Yes, the POM uniquely describes
an artifact, no argument there. It does not constitute exclusive ownership of a folder –
in my humble opinion.



That all being said: it's working for me. We deploy and release these modules, and these are
the POM files:

·         pom.xml // parent the following modules

·         pom-onpremises.xml // parent.relativePath=./pom.xml

·         pom-hosted.xml



I don’t think I did much out of the ordinary to make this setup work. I feel it’s pretty
much the same as what you’re doing. So, at this point we start dissecting POM files?



Sander.


Sander Verhagen
[  sander@sanderverhagen.net<mailto:sander@sanderverhagen.net>  ]

NOTICE: my e-mail address has changed. Please remove Verhagen@Sander.com<mailto:Verhagen@Sander.com>
now and start using Sander@SanderVerhagen.net<mailto:Sander@SanderVerhagen.net> from
now on. Please update your address book. Thank  you!



> -----Original Message-----

> From: Alex Ditu [mailto:ditu.alexandru@gmail.com]

> Sent: Monday, August 10, 2015 8:17

> To: Maven Users List

> Subject: 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" <bimargulies@gmail.com<mailto:bimargulies@gmail.com>>

> wrote:

>

> > On Mon, Aug 10, 2015 at 11:04 AM, Alex Ditu

> <ditu.alexandru@gmail.com<mailto:ditu.alexandru@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" <baerrach@gmail.com<mailto:baerrach@gmail.com>>
wrote:

> > >

> > >> On 10 August 2015 at 23:22, Alex Ditu <ditu.alexandru@gmail.com<mailto:ditu.alexandru@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-unsubscribe@maven.apache.org<mailto:users-unsubscribe@maven.apache.org>

> > For additional commands, e-mail: users-help@maven.apache.org<mailto:users-help@maven.apache.org>

> >

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