You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Mehul Sanghvi <me...@gmail.com> on 2015/09/13 20:59:35 UTC

maven.config file and variable substitution

Maven 3.3.1 introduces a ${maven.projectBaseDir}/.mvn/maven.config file
where I can specify common command line options.  How do I use variables in
that ?  Specifically if I'm trying to set the settings file to be something
like ${maven.projectBaseDir}/settings.xml, how would I set that in
maven.config ?

Currently I pass a -s${Bamboo.WorkingDir}/settings.xml option to the as
part of the automated builds.  When I run the builds manually on my laptop
I have to pass something like
-s${HOME}/path/to/project/root/dir/settings.xml.  And if I'm trying run it
manually on the build system, I had to pass something like
-s/path/to/Bamboo/build/working/dir/settings.xml.

Using maven.config would help tremendously, but it does not seem to
understand ${maven.projectBaseDir}.

I have a maven.config that contains the following:

       -B -V -s ${maven.projectBaseDir}/settings.xml

I get the following error when I try to build:

bash%  cd ${HOME}/source-repos/ProjectA
bash%  mvn clean install
[ERROR] The specified user settings file does not exist:
/home/mehul/source-repos/ProjectA/${maven.projectBaseDir}/settings.xml


Shouldn't Maven substitute the value of the ${maven.projectBaseDir}
variable ?


cheers,

     mehul

-- 
Mehul N. Sanghvi
email: mehul.sanghvi@gmail.com

Re: maven.config file and variable substitution

Posted by Bernd Eckenfels <ec...@zusammenkunft.net>.
Hello,

While having the basedir variable in the .config file might be good I think thats a pretty confusing usecase. I wonder if Maven by default should merge in .mvn/settings.xml? (Observing SKIPRC)

Gruß
Bernd

> Am 15.09.2015 um 14:26 schrieb Jason van Zyl <ja...@takari.io>:
> 
> There is currently no variable interpolation accepted as this is all handled in the shell scripts. What you’re asking for is reasonable so I ask you create an issue in JIRA with your use case. I think it’s a good one.
> 
>> On Sep 13, 2015, at 2:59 PM, Mehul Sanghvi <me...@gmail.com> wrote:
>> 
>> Maven 3.3.1 introduces a ${maven.projectBaseDir}/.mvn/maven.config file
>> where I can specify common command line options.  How do I use variables in
>> that ?  Specifically if I'm trying to set the settings file to be something
>> like ${maven.projectBaseDir}/settings.xml, how would I set that in
>> maven.config ?
>> 
>> Currently I pass a -s${Bamboo.WorkingDir}/settings.xml option to the as
>> part of the automated builds.  When I run the builds manually on my laptop
>> I have to pass something like
>> -s${HOME}/path/to/project/root/dir/settings.xml.  And if I'm trying run it
>> manually on the build system, I had to pass something like
>> -s/path/to/Bamboo/build/working/dir/settings.xml.
>> 
>> Using maven.config would help tremendously, but it does not seem to
>> understand ${maven.projectBaseDir}.
>> 
>> I have a maven.config that contains the following:
>> 
>>      -B -V -s ${maven.projectBaseDir}/settings.xml
>> 
>> I get the following error when I try to build:
>> 
>> bash%  cd ${HOME}/source-repos/ProjectA
>> bash%  mvn clean install
>> [ERROR] The specified user settings file does not exist:
>> /home/mehul/source-repos/ProjectA/${maven.projectBaseDir}/settings.xml
>> 
>> 
>> Shouldn't Maven substitute the value of the ${maven.projectBaseDir}
>> variable ?
>> 
>> 
>> cheers,
>> 
>>    mehul
>> 
>> -- 
>> Mehul N. Sanghvi
>> email: mehul.sanghvi@gmail.com
> 
> Thanks,
> 
> Jason
> 
> ----------------------------------------------------------
> Jason van Zyl
> Founder, Takari and Apache Maven
> http://twitter.com/jvanzyl
> http://twitter.com/takari_io
> ---------------------------------------------------------
> 
> A language that doesn’t affect the way you think about programming is not worth knowing. 
> 
> -- Alan Perlis
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 

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


Re: maven.config file and variable substitution

Posted by Jason van Zyl <ja...@takari.io>.
There is currently no variable interpolation accepted as this is all handled in the shell scripts. What you’re asking for is reasonable so I ask you create an issue in JIRA with your use case. I think it’s a good one.

> On Sep 13, 2015, at 2:59 PM, Mehul Sanghvi <me...@gmail.com> wrote:
> 
> Maven 3.3.1 introduces a ${maven.projectBaseDir}/.mvn/maven.config file
> where I can specify common command line options.  How do I use variables in
> that ?  Specifically if I'm trying to set the settings file to be something
> like ${maven.projectBaseDir}/settings.xml, how would I set that in
> maven.config ?
> 
> Currently I pass a -s${Bamboo.WorkingDir}/settings.xml option to the as
> part of the automated builds.  When I run the builds manually on my laptop
> I have to pass something like
> -s${HOME}/path/to/project/root/dir/settings.xml.  And if I'm trying run it
> manually on the build system, I had to pass something like
> -s/path/to/Bamboo/build/working/dir/settings.xml.
> 
> Using maven.config would help tremendously, but it does not seem to
> understand ${maven.projectBaseDir}.
> 
> I have a maven.config that contains the following:
> 
>       -B -V -s ${maven.projectBaseDir}/settings.xml
> 
> I get the following error when I try to build:
> 
> bash%  cd ${HOME}/source-repos/ProjectA
> bash%  mvn clean install
> [ERROR] The specified user settings file does not exist:
> /home/mehul/source-repos/ProjectA/${maven.projectBaseDir}/settings.xml
> 
> 
> Shouldn't Maven substitute the value of the ${maven.projectBaseDir}
> variable ?
> 
> 
> cheers,
> 
>     mehul
> 
> -- 
> Mehul N. Sanghvi
> email: mehul.sanghvi@gmail.com

Thanks,

Jason

----------------------------------------------------------
Jason van Zyl
Founder, Takari and Apache Maven
http://twitter.com/jvanzyl
http://twitter.com/takari_io
---------------------------------------------------------

A language that doesn’t affect the way you think about programming is not worth knowing. 
 
 -- Alan Perlis













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