public void testGlobalMavenOpts() throws Exception { configureDefaultMaven(); MavenModuleSet m = createMavenProject(); m.setScm(new ExtractResourceSCM(getClass().getResource("maven-opts-echo.zip"))); m.setGoals("validate"); m.DESCRIPTOR.setGlobalMavenOpts("-Dhudson.mavenOpt.test=bar"); buildAndAssertSuccess(m); assertLogContains("[hudson.mavenOpt.test=bar]", m.getLastBuild()); }
public void testEnvAndGlobalMavenOptsOverriddenByProject() throws Exception { configureDefaultMaven(); MavenModuleSet m = createMavenProject(); m.setScm(new ExtractResourceSCM(getClass().getResource("maven-opts-echo.zip"))); m.setGoals("validate"); m.DESCRIPTOR.setGlobalMavenOpts("-Dhudson.mavenOpt.test=bar"); m.setAssignedLabel( createSlave(new EnvVars("MAVEN_OPTS", "-Dhudson.mavenOpt.test=foo")).getSelfLabel()); m.setMavenOpts("-Dhudson.mavenOpt.test=baz"); buildAndAssertSuccess(m); assertLogContains("[hudson.mavenOpt.test=baz]", m.getLastBuild()); }