System properties in Maven

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

System properties in Maven

Eric Lewis
Hi

I asked a similar question some time ago (see
http://www.nabble.com/System-Properties-ignored-in-Maven-job--td20537036.html )

My issue back then was solved in a different way, but the main problem is now bugging me again, now in a different way.

We define a set of system properties which must exist for every VM that we start
-Dfile.encoding=UTF-8 -Duser.language=de -Duser.country=CH -Duser.timezone=Europe/Zurich

Now I've put that into the mvn script, and working from the shell, 'mvn help:system' gives me the correct information:

[INFO] [help:system]
...
===============================================================================
System Properties
===============================================================================
...
user.country=CH
user.timezone=Europe/Zurich
file.encoding=UTF-8
user.language=de
...
===============================================================================
Environment Variables
===============================================================================
...
MAVEN_OPTS=-Dfile.encoding=UTF-8 -Duser.language=de -Duser.country=CH -Duser.timezone=Europe/Zurich



However, the same thing starting a Maven job in Hudson ignores the MAVEN_OPTS in the mvn script, because they seem to be replaced:

[INFO] [help:system]
...
===============================================================================
System Properties
===============================================================================
...
user.language=en
user.timezone=Europe/Zurich
user.country=US
file.encoding=ANSI_X3.4-1968
...
===============================================================================
Environment Variables
===============================================================================
(no MAVEN_OPTS)


This probably works as designed, however it's still a nuisance to me if I have to configure the same system properties in every job over and over again.
Is there a solution to this with the current version?

Should I file an enhancement request that the job's MAVEN_OPTS should be added to the existing MAVEN_OPTS instead of replacing them?
To be compatible with the existing behavior, there could be a checkbox (checked by default) 'Replace existing MAVEN_OPTS'

What do you think?

Best regards,
Eric
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: System properties in Maven

Lee Meador-3
Or, Hudson could have a global "MAVEN_OPTS" setting that you configure along with a checkbox, "Use global MAVEN_OPTS?"

Or, for your case, maybe it would be better to have a global set of defines (like in -D on the command line) and a checkbox to use or not use them along with the defines for the job..

-- Lee

On Thu, Jul 2, 2009 at 3:21 AM, Lewis, Eric <[hidden email]> wrote:
Hi

I asked a similar question some time ago (see
http://www.nabble.com/System-Properties-ignored-in-Maven-job--td20537036.html )

My issue back then was solved in a different way, but the main problem is now bugging me again, now in a different way.

We define a set of system properties which must exist for every VM that we start
-Dfile.encoding=UTF-8 -Duser.language=de -Duser.country=CH -Duser.timezone=Europe/Zurich

Now I've put that into the mvn script, and working from the shell, 'mvn help:system' gives me the correct information:

[INFO] [help:system]
...
===============================================================================
System Properties
===============================================================================
...
user.country=CH
user.timezone=Europe/Zurich
file.encoding=UTF-8
user.language=de
...
===============================================================================
Environment Variables
===============================================================================
...
MAVEN_OPTS=-Dfile.encoding=UTF-8 -Duser.language=de -Duser.country=CH -Duser.timezone=Europe/Zurich



However, the same thing starting a Maven job in Hudson ignores the MAVEN_OPTS in the mvn script, because they seem to be replaced:

[INFO] [help:system]
...
===============================================================================
System Properties
===============================================================================
...
user.language=en
user.timezone=Europe/Zurich
user.country=US
file.encoding=ANSI_X3.4-1968
...
===============================================================================
Environment Variables
===============================================================================
(no MAVEN_OPTS)


This probably works as designed, however it's still a nuisance to me if I have to configure the same system properties in every job over and over again.
Is there a solution to this with the current version?

Should I file an enhancement request that the job's MAVEN_OPTS should be added to the existing MAVEN_OPTS instead of replacing them?
To be compatible with the existing behavior, there could be a checkbox (checked by default) 'Replace existing MAVEN_OPTS'

What do you think?

Best regards,
Eric
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]





--
-- Lee Meador
Sent from gmail. My real email address is lee AT leemeador.com
Reply | Threaded
Open this post in threaded view
|

Re: System properties in Maven

Kohsuke Kawaguchi
Administrator
In reply to this post by Eric Lewis
Lewis, Eric wrote:

> Hi
>
> I asked a similar question some time ago (see
> http://www.nabble.com/System-Properties-ignored-in-Maven-job--td20537036.html )
>
> My issue back then was solved in a different way, but the main problem is now bugging me again, now in a different way.
>
> We define a set of system properties which must exist for every VM that we start
> -Dfile.encoding=UTF-8 -Duser.language=de -Duser.country=CH -Duser.timezone=Europe/Zurich
>
> Now I've put that into the mvn script, and working from the shell, 'mvn help:system' gives me the correct information:
>
> [INFO] [help:system]
> ..
> ===============================================================================
> System Properties
> ===============================================================================
> ..
> user.country=CH
> user.timezone=Europe/Zurich
> file.encoding=UTF-8
> user.language=de
> ..
> ===============================================================================
> Environment Variables
> ===============================================================================
> ..
> MAVEN_OPTS=-Dfile.encoding=UTF-8 -Duser.language=de -Duser.country=CH -Duser.timezone=Europe/Zurich
>
>
>
> However, the same thing starting a Maven job in Hudson ignores the MAVEN_OPTS in the mvn script, because they seem to be replaced:
This is because Hudson launches Maven directly without going through a
shell script.

I think the right place to do this kind of thing is in your
~/.m2/settings.xml, which Hudson honors too.

> [INFO] [help:system]
> ..
> ===============================================================================
> System Properties
> ===============================================================================
> ..
> user.language=en
> user.timezone=Europe/Zurich
> user.country=US
> file.encoding=ANSI_X3.4-1968
> ..
> ===============================================================================
> Environment Variables
> ===============================================================================
> (no MAVEN_OPTS)
>
>
> This probably works as designed, however it's still a nuisance to me if I have to configure the same system properties in every job over and over again.
> Is there a solution to this with the current version?
>
> Should I file an enhancement request that the job's MAVEN_OPTS should be added to the existing MAVEN_OPTS instead of replacing them?
> To be compatible with the existing behavior, there could be a checkbox (checked by default) 'Replace existing MAVEN_OPTS'
>
> What do you think?
>
> Best regards,
> Eric
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>

--
Kohsuke Kawaguchi
Sun Microsystems                   http://weblogs.java.net/blog/kohsuke/

smime.p7s (4K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

AW: System properties in Maven

Eric Lewis
Hi Kohsuke

Well, from what I can see on the Maven mailing list, it's not possible to set System Properties in settings.xml - only Maven properties.

http://jira.codehaus.org/browse/MNG-2532

Best regards,
Eric

Lewis, Eric wrote:

> Hi
>
> I asked a similar question some time ago (see
> http://www.nabble.com/System-Properties-ignored-in-Maven-job--td20537036.html )
>
> My issue back then was solved in a different way, but the main problem is now bugging me again, now in a different way.
>
> We define a set of system properties which must exist for every VM that we start
> -Dfile.encoding=UTF-8 -Duser.language=de -Duser.country=CH -Duser.timezone=Europe/Zurich
>
> Now I've put that into the mvn script, and working from the shell, 'mvn help:system' gives me the correct information:
>
> [INFO] [help:system]
> ..
> ===============================================================================
> System Properties
> ===============================================================================
> ..
> user.country=CH
> user.timezone=Europe/Zurich
> file.encoding=UTF-8
> user.language=de
> ..
> ===============================================================================
> Environment Variables
> ===============================================================================
> ..
> MAVEN_OPTS=-Dfile.encoding=UTF-8 -Duser.language=de -Duser.country=CH -Duser.timezone=Europe/Zurich
>
>
>
> However, the same thing starting a Maven job in Hudson ignores the MAVEN_OPTS in the mvn script, because they seem to be replaced:

This is because Hudson launches Maven directly without going through a
shell script.

I think the right place to do this kind of thing is in your
~/.m2/settings.xml, which Hudson honors too.

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]