You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Dan Tran <da...@gmail.com> on 2015/09/09 00:44:05 UTC
Replacing a bunch of -Dkey=value pairs using external file
Hi
I have a scenario where I use a maven reactor multi-modules build to
orchestrate a vmware OVA build from scratch ( start with ISO, create
initial VM, apply additional provisioning, export to OVA, deploy, and test)
The poms have properties which can be overridden via -Dx=y to build on
non-default environment, but there are too many to account for
So far I found
http://www.mojohaus.org/properties-maven-plugin/set-system-properties-mojo.html
but the initial experiment is not good.
Perhaps, this feature must come from maven core? if so, is it a lot of
effort to add this feature? and how?
is there a similar need like this from Maven community?
Advice is greatly appreciated
-Dan
Re: Replacing a bunch of -Dkey=value pairs using external file
Posted by Barrie Treloar <ba...@gmail.com>.
On 9 September 2015 at 10:08, jieryn <ji...@gmail.com> wrote:
> bash$ cat sys1.env
> -DZZ01=maven
> -DZZ02=rocks
>
> bash$ mvn $(<sys1.env) help:system | grep ZZ
> ZZ02=rocks
> ZZ01=maven
> sun.java.command=org.codehaus.plexus.classworlds.launcher.Launcher
> -DZZ01=maven -DZZ02=rocks help:system
> MAVEN_CMD_LINE_ARGS= -DZZ01=maven -DZZ02=rocks help:system
>
>
Well done.
I was trying to use
env 'rat.skip=true' mvn -pl maven-scm-plugin validate
to do the same, but that was setting environment variables not command line
args.
MAVEN_OPTS also wasn't useful as that was for the java command not for the
mvn command.
I wasn't happy with offering this solution up because it became more
cumbersome to type, but storing these other configs in files and wrapping
them with basic scripts is doable
Re: Replacing a bunch of -Dkey=value pairs using external file
Posted by Dan Tran <da...@gmail.com>.
that gives me a idea to write a mvn command decorator :-)
Thanks
-D
On Tue, Sep 8, 2015 at 5:38 PM, jieryn <ji...@gmail.com> wrote:
> bash$ cat sys1.env
> -DZZ01=maven
> -DZZ02=rocks
>
> bash$ mvn $(<sys1.env) help:system | grep ZZ
> ZZ02=rocks
> ZZ01=maven
> sun.java.command=org.codehaus.plexus.classworlds.launcher.Launcher
> -DZZ01=maven -DZZ02=rocks help:system
> MAVEN_CMD_LINE_ARGS= -DZZ01=maven -DZZ02=rocks help:system
>
>
> On Tue, Sep 8, 2015 at 8:13 PM, Dan Tran <da...@gmail.com> wrote:
> > As mentioned, the poms already jam with all the default properties work
> out
> > of box for a particular environment. I just need a friendly way to
> > override them. Using settings.xml is the only choice at this moment
> >
> > Thanks
> >
> > -Dan
> >
> > On Tue, Sep 8, 2015 at 5:07 PM, Barrie Treloar <ba...@gmail.com>
> wrote:
> >
> >> On 9 September 2015 at 09:30, Dan Tran <da...@gmail.com> wrote:
> >>
> >> > Hi Barrie,
> >> >
> >> > That would work. On caveat, I have to instruct my user to edit their
> own
> >> > settings.xml. Would be nice if I can just pass in -fp xxx from
> command
> >> > line
> >>
> >>
> >> Are they truly always on?
> >>
> >> Then you can jam them in your pom.xml
> >>
> >> http://maven.apache.org/pom.html#Properties
> >>
> >> <properties>
> >> <rat.skip>true</rat.skip>
> >> </properties>
> >>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
Re: Replacing a bunch of -Dkey=value pairs using external file
Posted by jieryn <ji...@gmail.com>.
bash$ cat sys1.env
-DZZ01=maven
-DZZ02=rocks
bash$ mvn $(<sys1.env) help:system | grep ZZ
ZZ02=rocks
ZZ01=maven
sun.java.command=org.codehaus.plexus.classworlds.launcher.Launcher
-DZZ01=maven -DZZ02=rocks help:system
MAVEN_CMD_LINE_ARGS= -DZZ01=maven -DZZ02=rocks help:system
On Tue, Sep 8, 2015 at 8:13 PM, Dan Tran <da...@gmail.com> wrote:
> As mentioned, the poms already jam with all the default properties work out
> of box for a particular environment. I just need a friendly way to
> override them. Using settings.xml is the only choice at this moment
>
> Thanks
>
> -Dan
>
> On Tue, Sep 8, 2015 at 5:07 PM, Barrie Treloar <ba...@gmail.com> wrote:
>
>> On 9 September 2015 at 09:30, Dan Tran <da...@gmail.com> wrote:
>>
>> > Hi Barrie,
>> >
>> > That would work. On caveat, I have to instruct my user to edit their own
>> > settings.xml. Would be nice if I can just pass in -fp xxx from command
>> > line
>>
>>
>> Are they truly always on?
>>
>> Then you can jam them in your pom.xml
>>
>> http://maven.apache.org/pom.html#Properties
>>
>> <properties>
>> <rat.skip>true</rat.skip>
>> </properties>
>>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Replacing a bunch of -Dkey=value pairs using external file
Posted by Dan Tran <da...@gmail.com>.
As mentioned, the poms already jam with all the default properties work out
of box for a particular environment. I just need a friendly way to
override them. Using settings.xml is the only choice at this moment
Thanks
-Dan
On Tue, Sep 8, 2015 at 5:07 PM, Barrie Treloar <ba...@gmail.com> wrote:
> On 9 September 2015 at 09:30, Dan Tran <da...@gmail.com> wrote:
>
> > Hi Barrie,
> >
> > That would work. On caveat, I have to instruct my user to edit their own
> > settings.xml. Would be nice if I can just pass in -fp xxx from command
> > line
>
>
> Are they truly always on?
>
> Then you can jam them in your pom.xml
>
> http://maven.apache.org/pom.html#Properties
>
> <properties>
> <rat.skip>true</rat.skip>
> </properties>
>
Re: Replacing a bunch of -Dkey=value pairs using external file
Posted by Barrie Treloar <ba...@gmail.com>.
On 9 September 2015 at 09:30, Dan Tran <da...@gmail.com> wrote:
> Hi Barrie,
>
> That would work. On caveat, I have to instruct my user to edit their own
> settings.xml. Would be nice if I can just pass in -fp xxx from command
> line
Are they truly always on?
Then you can jam them in your pom.xml
http://maven.apache.org/pom.html#Properties
<properties>
<rat.skip>true</rat.skip>
</properties>
Re: Replacing a bunch of -Dkey=value pairs using external file
Posted by Dan Tran <da...@gmail.com>.
Hi Barrie,
That would work. On caveat, I have to instruct my user to edit their own
settings.xml. Would be nice if I can just pass in -fp xxx from command line
Thanks
-Dan
On Tue, Sep 8, 2015 at 4:46 PM, Barrie Treloar <ba...@gmail.com> wrote:
> On 9 September 2015 at 08:14, Dan Tran <da...@gmail.com> wrote:
>
> > Hi
> >
> > I have a scenario where I use a maven reactor multi-modules build to
> > orchestrate a vmware OVA build from scratch ( start with ISO, create
> > initial VM, apply additional provisioning, export to OVA, deploy, and
> test)
> >
> > The poms have properties which can be overridden via -Dx=y to build on
> > non-default environment, but there are too many to account for
> >
> > So far I found
> >
> >
> http://www.mojohaus.org/properties-maven-plugin/set-system-properties-mojo.html
> > but the initial experiment is not good.
> >
> > Perhaps, this feature must come from maven core? if so, is it a lot of
> > effort to add this feature? and how?
> >
> > is there a similar need like this from Maven community?
> >
> > Advice is greatly appreciated
> >
>
> Put the properties into a profile in ~/.m2/settings.xml and then activate
> it via -P
> e.g.
> <profile>
> <id>ci</id>
> <properties>
> <rat.skip>true</rat.skip>
> </properties>
> </profile>
>
> mvn -Pci
>
> With the profile activate rat will now be skipped.
>
Re: Replacing a bunch of -Dkey=value pairs using external file
Posted by Barrie Treloar <ba...@gmail.com>.
On 9 September 2015 at 08:14, Dan Tran <da...@gmail.com> wrote:
> Hi
>
> I have a scenario where I use a maven reactor multi-modules build to
> orchestrate a vmware OVA build from scratch ( start with ISO, create
> initial VM, apply additional provisioning, export to OVA, deploy, and test)
>
> The poms have properties which can be overridden via -Dx=y to build on
> non-default environment, but there are too many to account for
>
> So far I found
>
> http://www.mojohaus.org/properties-maven-plugin/set-system-properties-mojo.html
> but the initial experiment is not good.
>
> Perhaps, this feature must come from maven core? if so, is it a lot of
> effort to add this feature? and how?
>
> is there a similar need like this from Maven community?
>
> Advice is greatly appreciated
>
Put the properties into a profile in ~/.m2/settings.xml and then activate
it via -P
e.g.
<profile>
<id>ci</id>
<properties>
<rat.skip>true</rat.skip>
</properties>
</profile>
mvn -Pci
With the profile activate rat will now be skipped.