Put Maven pom.xml outside of project tree - How to ?

It there a way to put pom.xml outside of project tree ?

 

As I understant I need override project.basedir, but how?

 

Is there a way to inject basedir from outside ?

Comments

Never tried something like that..
Did you try using system property?
I mean running with -Dbasedir=XXX

Why do you want to do that, btw?

System property does not help

I have some projects tree (not mavenized)

I want build projects using maven without changing projects tree.

You don't have to change the project tree - put the pom under project root and define all basic properties to suit your project tree:

${project.basedir}/target
${project.build.directory}/classes
${project.build.directory}/test-classes
${project.basedir}/src/main/java
...

I know but I need to keep pom files outside.