You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by mars1412 <ma...@gmail.com> on 2009/11/26 10:25:08 UTC

RE: how to set environment variables

seems there's really no easy way to set env vars directly

in general I think that this is ok and you should not set env vars directly,
but I have a good exception to this rule: it is described in the paragraph
"Using Saxon (but not as default)" of 
http://martin-trummer.blogspot.com/2009/11/wysiwyg-gotchas.html Blog:
WYSIWYG gotchas 


the solution I came up with is to write my own little mojo that I can pass
the env-vars I want to set.
I bind the plugin execution to the early validate phase and pass the
properties like this:

&lt;configuration&gt;
	&lt;environmentVariables&gt;
	 	&lt;property&gt;
	 		&lt;name&gt;javax.xml.transform.TransformerFactory&lt;/name&gt;
	 	
&lt;value&gt;com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl&lt;/value&gt;
	 	&lt;/property&gt;
	 &lt;/environmentVariables&gt;
&lt;/configuration&gt;



in the mojo I simply call System.setProperty() for all given environment
vars - this works for my usecase.


However, beware that you should only use this if absolutely necessary
-- 
View this message in context: http://old.nabble.com/how-to-set-environment-variables-tp25960613p26525313.html
Sent from the Maven - Users mailing list archive at Nabble.com.