提交 f48249d9 编写于 作者: J Jerome Lacoste

Ignore global environment variables in maven builds instead of throwing exceptions.

上级 e48d3a0e
......@@ -68,6 +68,9 @@ Upcoming changes</a>
<li class=rfe>
go back to view page when job is deleted.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-10510">issue 10510</a>)
<li class=rfe>
A Global Environment variable with an empty key would fail maven builds since 1.424. Ignore these variables instead of failing the build.
(<a href="https://groups.google.com/forum/#!searchin/jenkinsci-users/timp/jenkinsci-users/YThhsdGBVwM/7_7GMYIYiRIJ">report</a>)
</ul>
</div><!--=TRUNK-END=-->
......
......@@ -74,17 +74,18 @@ public abstract class AbstractMavenBuilder implements DelegatingCallable<Result,
}
/**
* Add all the {@link #systemProps hudson defined system properties} into the {@link System#getProperties() system properties}
* @throws IllegalArgumentException if a {@link #systemProps hudson system property} has an empty key or null value
* Add all the {@link #systemProps jenkins environment variables} into the {@link System#getProperties() system properties}
* Ignores {@link #systemProps jenkins environment variables} with empty keys.
* @throws IllegalArgumentException if a {@link #systemProps jenkins environment variable} has null value
* as it blows up Maven.
* @see https://groups.google.com/forum/#!topic/jenkinsci-dev/hoxoNi7sNtk/discussion
* @see http://jenkins.361315.n4.nabble.com/Upgrade-to-1-424-broke-our-Maven-builds-due-to-empty-system-property-key-td3726460.html
*/
protected void registerSystemProperties() {
for (Map.Entry<String,String> e : systemProps.entrySet()) {
if ("".equals(e.getKey()))
throw new IllegalArgumentException("System property has an empty key");
continue;
if (e.getValue()==null)
throw new IllegalArgumentException("System property "+e.getKey()+" has a null value");
throw new IllegalArgumentException("Global Environment Variable "+e.getKey()+" has a null value");
System.getProperties().put(e.getKey(), e.getValue());
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册