Hi David,

David P. Caldwell wrote:

> The use case is that I have a project (actually, many projects, so I
> want to be able to do this in bulk) that are source-controlled and I'd
> like to be able to create a modified version of the POM in a temporary
> directory and then execute that modified POM, but against the original
> base directory without altering the source-controlled POM in my
> source-controlled working directory.
> 
> Obviously I could do this by copying the entire source tree and then
> running my modified POM, but I'd like to do this without having to
> copy every file every time, as these projects are often large and I
> want to be able to execute this tool routinely.
> 
> My initial attempt was to set -Dbasedir on the command line, but this
> does not appear to have the effect for which I was hoping.
> 
> I can think of several imperfect workarounds, including copying the
> entire source directory (expensive), generating a temporary file in
> the base directory (make sure not to commit it!), overwriting the POM
> (then need to repeatedly refresh from source control to restore the
> original), and reading and remembering the POM, overwriting it with
> the updated version, running Maven, and then overwriting the updates
> with the original (hope the process doesn't crash in a way that
> prevents me from restoring the original). I'd probably lean toward the
> last but it's more cumbersome and error-prone than I'd like. Is what
> I'd like possible?

You cannot modify the basedir, i.e your generated POM has to be at same 
location with a different name. You might select a name pattern that is 
ignored by your SCM e.g. pom.tmp. As Jeff said, call Maven like

mvn -f pom.tmp

However, keep in mind that this does not work in multi-project modules, 
since the modules will always refer the original parent, unless you 
overwrite the relativePath element (IIRC you can also define a POM file 
directly).

- Jörg


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

Reply via email to