You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Yuhan Zhang <yu...@gmail.com> on 2014/06/28 02:07:00 UTC

how to specify different file name for pom.xml of a module?

Hi all,

I'd like to keep multiple pom files in the same project with different
dependencies, so that I could build it with "mvn -f pom_2.xml". however,
since my project have sub modules, I'd like it to build using the pom_2.xml
file in module folder, too. but the build  "mvn -f pom_2.xml" always goes
to pom.xml in the module folder.

Here's how my project is structured:

└── my-project

        ├── pom.xml

        ├── pom_2.xml

    └── my-module

        ├── pom.xml

        ├── pom_2.xml


Is there a way to specify in pom_2.xml on the name of the pom file to use
for module so that the module can also be built with pom_2.xml? or is this
impossible?


Thank you.

Yuhan

Re: how to specify different file name for pom.xml of a module?

Posted by Anders Hammar <an...@hammar.net>.
Not a good idea. Neither is profiles. There are several threads around this
in the archive.

You should explain your use case so that we can help you with the right
solution. Why do you want different dependencies?

/Anders (mobile)
Den 28 jun 2014 05:56 skrev <yu...@gmail.com>:

> To answer my own question: just make the name of the module to be the path
> to the Pom file, for example: <module>my-module/pom_2.xml</module>
>
> > On Jun 27, 2014, at 5:07 PM, Yuhan Zhang <yu...@gmail.com> wrote:
> >
> > Hi all,
> >
> > I'd like to keep multiple pom files in the same project with different
> dependencies, so that I could build it with "mvn -f pom_2.xml". however,
> since my project have sub modules, I'd like it to build using the pom_2.xml
> file in module folder, too. but the build  "mvn -f pom_2.xml" always goes
> to pom.xml in the module folder.
> >
> > Here's how my project is structured:
> >
> > └── my-project
> >
> >         ├── pom.xml
> >
> >         ├── pom_2.xml
> >
> >     └── my-module
> >
> >         ├── pom.xml
> >
> >         ├── pom_2.xml
> >
> >
> >
> > Is there a way to specify in pom_2.xml on the name of the pom file to
> use for module so that the module can also be built with pom_2.xml? or is
> this impossible?
> >
> >
> > Thank you.
> >
> > Yuhan
>

Re: how to specify different file name for pom.xml of a module?

Posted by yu...@gmail.com.
To answer my own question: just make the name of the module to be the path to the Pom file, for example: <module>my-module/pom_2.xml</module>

> On Jun 27, 2014, at 5:07 PM, Yuhan Zhang <yu...@gmail.com> wrote:
> 
> Hi all,
> 
> I'd like to keep multiple pom files in the same project with different dependencies, so that I could build it with "mvn -f pom_2.xml". however, since my project have sub modules, I'd like it to build using the pom_2.xml file in module folder, too. but the build  "mvn -f pom_2.xml" always goes to pom.xml in the module folder. 
> 
> Here's how my project is structured:
> 
> └── my-project
> 
>         ├── pom.xml
> 
>         ├── pom_2.xml
> 
>     └── my-module
> 
>         ├── pom.xml
> 
>         ├── pom_2.xml
> 
> 
> 
> Is there a way to specify in pom_2.xml on the name of the pom file to use for module so that the module can also be built with pom_2.xml? or is this impossible?
> 
> 
> Thank you.
> 
> Yuhan

Re: how to specify different file name for pom.xml of a module?

Posted by Dan Tran <da...@gmail.com>.
Not possible,   you may want to try Maven Profile (
http://maven.apache.org/guides/introduction/introduction-to-profiles.html)

-D


On Fri, Jun 27, 2014 at 5:07 PM, Yuhan Zhang <yu...@gmail.com> wrote:

> Hi all,
>
> I'd like to keep multiple pom files in the same project with different
> dependencies, so that I could build it with "mvn -f pom_2.xml". however,
> since my project have sub modules, I'd like it to build using the pom_2.xml
> file in module folder, too. but the build  "mvn -f pom_2.xml" always goes
> to pom.xml in the module folder.
>
> Here's how my project is structured:
>
> └── my-project
>
>         ├── pom.xml
>
>         ├── pom_2.xml
>
>     └── my-module
>
>         ├── pom.xml
>
>         ├── pom_2.xml
>
>
> Is there a way to specify in pom_2.xml on the name of the pom file to use
> for module so that the module can also be built with pom_2.xml? or is this
> impossible?
>
>
> Thank you.
>
> Yuhan
>