You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Barrie Treloar <ba...@gmail.com> on 2015/08/25 09:03:10 UTC

Interpolation with no pom leaves ${project.basedir} unresolved

In the mojo there is a Property with a default value of
"${project.build.directory}/checkout"

When maven is run in a directory with a pom, this will get interpolated as
"/full/path/to_directory_with_pom_file/target"

When maven is run in a directory without a pom, this will get interpolated
to
"${project.basedir}/target"

Why isn't ${project.basedir} expanded to the current working directory?

Re: Interpolation with no pom leaves ${project.basedir} unresolved

Posted by Barrie Treloar <ba...@gmail.com>.
On 26 August 2015 at 03:11, Hervé BOUTEMY <he...@free.fr> wrote:

> see interpolation documentation in [1]
>
> and ModelInterpolator javadoc [2]
> "projectDir - The project directory, may be null if the model does not
> belong
> to a local project but to some artifact's metadata."


Thanks. I didn't know about them.

I sorted the problem out a different way - I was trying to have two default
values depending on context which parameter injection doesn't help with. So
instead the default values are set in code and the parameter is left as
null. Much easier to determine if a value was provided or not will null.

Re: Interpolation with no pom leaves ${project.basedir} unresolved

Posted by Hervé BOUTEMY <he...@free.fr>.
see interpolation documentation in [1]

and ModelInterpolator javadoc [2]
"projectDir - The project directory, may be null if the model does not belong 
to a local project but to some artifact's metadata."

Regards,

Hervé

[1] http://maven.apache.org/components/ref/3-LATEST/maven-model-builder/

[2] http://maven.apache.org/components/ref/3-LATEST/maven-model-builder/apidocs/org/apache/maven/model/interpolation/ModelInterpolator.html

Le mardi 25 août 2015 16:33:10 Barrie Treloar a écrit :
> In the mojo there is a Property with a default value of
> "${project.build.directory}/checkout"
> 
> When maven is run in a directory with a pom, this will get interpolated as
> "/full/path/to_directory_with_pom_file/target"
> 
> When maven is run in a directory without a pom, this will get interpolated
> to
> "${project.basedir}/target"
> 
> Why isn't ${project.basedir} expanded to the current working directory?


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org