提交 390fdf4a 编写于 作者: K kohsuke

implemented automatic Maven installation

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@18266 71c3de6d-444a-0410-be80-ed276b4c234a
上级 c1c79ab6
......@@ -44,6 +44,9 @@ import hudson.remoting.VirtualChannel;
import hudson.slaves.NodeSpecific;
import hudson.tools.ToolDescriptor;
import hudson.tools.ToolInstallation;
import hudson.tools.DownloadFromUrlInstaller;
import hudson.tools.ToolInstaller;
import hudson.tools.ToolProperty;
import hudson.util.ArgumentListBuilder;
import hudson.util.NullStream;
import hudson.util.StreamTaskListener;
......@@ -56,13 +59,11 @@ import org.kohsuke.stapler.QueryParameter;
import java.io.File;
import java.io.IOException;
import java.io.FilenameFilter;
import java.util.Map;
import java.util.Properties;
import java.util.StringTokenizer;
import java.util.regex.Pattern;
import java.util.regex.MatchResult;
import java.util.regex.Matcher;
import java.util.List;
import java.util.Collections;
/**
* Build by using Maven.
......@@ -213,7 +214,7 @@ public class Maven extends Builder {
mi = mi.forEnvironment(env);
String exec = mi.getExecutable(launcher);
if(exec==null) {
listener.fatalError(Messages.Maven_NoExecutable(mi.getMavenHome()));
listener.fatalError(Messages.Maven_NoExecutable(mi.getHome()));
return false;
}
args.add(exec);
......@@ -232,8 +233,8 @@ public class Maven extends Builder {
// The other solution would be to set M2_HOME if we are calling Maven2
// and MAVEN_HOME for Maven1 (only of use for strange people that
// are calling Maven2 from Maven1)
env.put("M2_HOME",mi.getMavenHome());
env.put("MAVEN_HOME",mi.getMavenHome());
env.put("M2_HOME",mi.getHome());
env.put("MAVEN_HOME",mi.getHome());
}
// just as a precaution
// see http://maven.apache.org/continuum/faqs.html#how-does-continuum-detect-a-successful-build
......@@ -302,58 +303,39 @@ public class Maven extends Builder {
public void setInstallations(MavenInstallation... installations) {
this.installations = installations;
}
@Override
public boolean configure(StaplerRequest req, JSONObject json) throws FormException {
this.installations = req.bindJSONToList(MavenInstallation.class, json.get("maven")).toArray(new MavenInstallation[0]);
save();
return true;
}
public Builder newInstance(StaplerRequest req, JSONObject formData) throws FormException {
return req.bindJSON(Maven.class,formData);
}
//
// web methods
//
/**
* Checks if the MAVEN_HOME is valid.
*/
public FormValidation doCheckMavenHome(@QueryParameter File value) {
// this can be used to check the existence of a file on the server, so needs to be protected
if(!Hudson.getInstance().hasPermission(Hudson.ADMINISTER))
return FormValidation.ok();
if(value.getPath().equals(""))
return FormValidation.error(Messages.Maven_MavenHomeRequired());
if(!value.isDirectory())
return FormValidation.error(Messages.Maven_NotADirectory(value));
File maven1File = new File(value,MAVEN_1_INSTALLATION_COMMON_FILE);
File maven2File = new File(value,MAVEN_2_INSTALLATION_COMMON_FILE);
if(!maven1File.exists() && !maven2File.exists())
return FormValidation.error(Messages.Maven_NotMavenDirectory(value));
return FormValidation.ok();
}
}
/**
* Represents a Maven installation in a system.
*/
public static final class MavenInstallation extends ToolInstallation implements EnvironmentSpecific<MavenInstallation>, NodeSpecific<MavenInstallation> {
@Deprecated // kept for backward compatiblity - use getHome()
private String mavenHome;
@DataBoundConstructor
/**
* @deprecated as of 1.308.
* Use {@link #MavenInstallation(String, String, List)}
*/
public MavenInstallation(String name, String home) {
super(name, home);
}
@DataBoundConstructor
public MavenInstallation(String name, String home, List<? extends ToolProperty<?>> properties) {
super(name, home, properties);
}
/**
* install directory.
*
* @deprecated as of 1.308. Use {@link #getHome()}.
*/
public String getMavenHome() {
return getHome();
......@@ -408,7 +390,7 @@ public class Maven extends Builder {
if(File.separatorChar=='\\')
execName += ".bat";
String m2Home = Util.replaceMacro(getMavenHome(),EnvVars.masterEnvVars);
String m2Home = Util.replaceMacro(getHome(),EnvVars.masterEnvVars);
return new File(m2Home, "bin/" + execName);
}
......@@ -429,21 +411,25 @@ public class Maven extends Builder {
private static final long serialVersionUID = 1L;
public MavenInstallation forEnvironment(EnvVars environment) {
return new MavenInstallation(getName(), environment.expand(getHome()));
return new MavenInstallation(getName(), environment.expand(getHome()), getProperties().toList());
}
public MavenInstallation forNode(Node node, TaskListener log) throws IOException, InterruptedException {
return new MavenInstallation(getName(), translateFor(node, log));
return new MavenInstallation(getName(), translateFor(node, log), getProperties().toList());
}
@Extension
public static class DescriptorImpl extends ToolDescriptor<MavenInstallation> {
@Override
public String getDisplayName() {
return "Maven";
}
@Override
public List<? extends ToolInstaller> getDefaultInstallers() {
return Collections.singletonList(new MavenInstaller(null));
}
@Override
public MavenInstallation[] getInstallations() {
return Hudson.getInstance().getDescriptorByType(Maven.DescriptorImpl.class).getInstallations();
......@@ -453,6 +439,56 @@ public class Maven extends Builder {
public void setInstallations(MavenInstallation... installations) {
Hudson.getInstance().getDescriptorByType(Maven.DescriptorImpl.class).setInstallations(installations);
}
@Override
public boolean configure(StaplerRequest req, JSONObject json) throws FormException {
setInstallations(req.bindJSONToList(MavenInstallation.class, json.get("maven")).toArray(new MavenInstallation[0]));
return true;
}
/**
* Checks if the MAVEN_HOME is valid.
*/
public FormValidation doCheckMavenHome(@QueryParameter File value) {
// this can be used to check the existence of a file on the server, so needs to be protected
if(!Hudson.getInstance().hasPermission(Hudson.ADMINISTER))
return FormValidation.ok();
if(value.getPath().equals(""))
return FormValidation.error(Messages.Maven_MavenHomeRequired());
if(!value.isDirectory())
return FormValidation.error(Messages.Maven_NotADirectory(value));
File maven1File = new File(value,MAVEN_1_INSTALLATION_COMMON_FILE);
File maven2File = new File(value,MAVEN_2_INSTALLATION_COMMON_FILE);
if(!maven1File.exists() && !maven2File.exists())
return FormValidation.error(Messages.Maven_NotMavenDirectory(value));
return FormValidation.ok();
}
}
}
/**
* Automatic Maven installer from apache.org.
*/
public static class MavenInstaller extends DownloadFromUrlInstaller {
@DataBoundConstructor
public MavenInstaller(String id) {
super(id);
}
@Extension
public static final class DescriptorImpl extends DownloadFromUrlInstaller.DescriptorImpl<MavenInstaller> {
public String getDisplayName() {
return Messages.InstallFromApache();
}
@Override
public boolean isApplicable(Class<? extends ToolInstallation> toolType) {
return toolType==MavenInstallation.class;
}
}
}
......
......@@ -17,6 +17,9 @@ import java.net.URL;
* Partial convenience implementation of {@link ToolInstaller} that just downloads
* an archive from the URL and extracts it.
*
* <p>
* Each instance of this is configured to download from a specific URL identified by an ID.
*
* @author Kohsuke Kawaguchi
* @since 1.308
*/
......@@ -154,6 +157,9 @@ public abstract class DownloadFromUrlInstaller extends ToolInstaller {
public Installable[] list = new Installable[0];
}
/**
* Downloadable and installable tool.
*/
public static class Installable {
/**
* Used internally to uniquely identify the name.
......
......@@ -26,21 +26,21 @@ THE SOFTWARE.
<f:section title="${%Maven}">
<f:entry title="${%Maven installation}"
description="${%List of Maven installations on this system. Both maven 1 and 2 are supported.}">
<f:repeatable var="maven" items="${descriptor.installations}">
<f:repeatable name="maven" var="instance" items="${descriptor.installations}" add="${%Add Maven}">
<table width="100%">
<f:entry title="${%name}">
<input class="setting-input" name="maven.name"
type="text" value="${maven.name}"/>
<f:entry title="${%name}" field="name">
<f:textbox />
</f:entry>
<f:entry title="MAVEN_HOME">
<input class="setting-input validated" name="maven.home"
type="text" value="${maven.mavenHome}"
checkUrl="'builder/Maven/checkMavenHome?value='+escape(this.value)"/>
<f:entry title="MAVEN_HOME" field="home">
<f:textbox />
</f:entry>
<f:descriptorList descriptors="${descriptor.propertyDescriptors}" field="properties" />
<f:entry title="">
<div align="right">
<f:repeatableDeleteButton />
<f:repeatableDeleteButton value="${%Delete Maven}"/>
</div>
</f:entry>
</table>
......
......@@ -235,13 +235,13 @@ final class MavenProcessFactory implements ProcessCache.Factory {
listener.error("Maven version is not configured for this project. Can't determine which Maven to run");
throw new RunnerAbortedException();
}
if(mvn.getMavenHome()==null) {
if(mvn.getHome()==null) {
listener.error("Maven '%s' doesn't have its home set",mvn.getName());
throw new RunnerAbortedException();
}
// find classworlds.jar
String classWorldsJar = launcher.getChannel().call(new GetClassWorldsJar(mvn.getMavenHome(),listener));
String classWorldsJar = launcher.getChannel().call(new GetClassWorldsJar(mvn.getHome(),listener));
boolean isMaster = getCurrentNode()== Hudson.getInstance();
FilePath slaveRoot=null;
......@@ -270,7 +270,7 @@ final class MavenProcessFactory implements ProcessCache.Factory {
args.add(Main.class.getName());
// M2_HOME
args.add(mvn.getMavenHome());
args.add(mvn.getHome());
// remoting.jar
String remotingJar = launcher.getChannel().call(new GetRemotingJar());
......
......@@ -30,6 +30,7 @@ import hudson.WebAppMain;
import hudson.EnvVars;
import hudson.ExtensionList;
import hudson.DescriptorExtensionList;
import hudson.tools.ToolProperty;
import hudson.remoting.Which;
import hudson.Launcher.LocalLauncher;
import hudson.matrix.MatrixProject;
......@@ -84,6 +85,7 @@ import java.util.Enumeration;
import java.util.List;
import java.util.Locale;
import java.util.Arrays;
import java.util.Collections;
import java.util.jar.Manifest;
import java.util.logging.Filter;
import java.util.logging.Level;
......@@ -132,6 +134,7 @@ import com.gargoylesoftware.htmlunit.html.HtmlButton;
import com.gargoylesoftware.htmlunit.html.HtmlForm;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
import com.gargoylesoftware.htmlunit.html.HtmlElement;
import com.gargoylesoftware.htmlunit.html.HtmlInput;
import com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine;
import com.gargoylesoftware.htmlunit.javascript.host.Stylesheet;
import com.gargoylesoftware.htmlunit.javascript.host.XMLHttpRequest;
......@@ -323,7 +326,7 @@ public abstract class HudsonTestCase extends TestCase {
// first if we are running inside Maven, pick that Maven.
String home = System.getProperty("maven.home");
if(home!=null) {
MavenInstallation mavenInstallation = new MavenInstallation("default",home);
MavenInstallation mavenInstallation = new MavenInstallation("default",home, NO_PROPERTIES);
hudson.getDescriptorByType(Maven.DescriptorImpl.class).setInstallations(mavenInstallation);
return mavenInstallation;
}
......@@ -346,7 +349,7 @@ public abstract class HudsonTestCase extends TestCase {
GNUCLibrary.LIBC.chmod(new File(mvnHome,"maven-2.0.7/bin/mvn").getPath(),0755);
MavenInstallation mavenInstallation = new MavenInstallation("default",
new File(mvnHome,"maven-2.0.7").getAbsolutePath());
new File(mvnHome,"maven-2.0.7").getAbsolutePath(), NO_PROPERTIES);
hudson.getDescriptorByType(Maven.DescriptorImpl.class).setInstallations(mavenInstallation);
return mavenInstallation;
}
......@@ -357,7 +360,7 @@ public abstract class HudsonTestCase extends TestCase {
protected Ant.AntInstallation configureDefaultAnt() throws Exception {
Ant.AntInstallation antInstallation;
if (System.getenv("ANT_HOME") != null) {
antInstallation = new AntInstallation("default", System.getenv("ANT_HOME"));
antInstallation = new AntInstallation("default", System.getenv("ANT_HOME"), NO_PROPERTIES);
} else {
LOGGER.warning("Extracting a copy of Ant bundled in the test harness. " +
"To avoid a performance hit, set the environment variable ANT_HOME to point to an Ant installation.");
......@@ -374,7 +377,7 @@ public abstract class HudsonTestCase extends TestCase {
if(!Hudson.isWindows())
GNUCLibrary.LIBC.chmod(new File(antHome,"apache-ant-1.7.1/bin/ant").getPath(),0755);
antInstallation = new AntInstallation("default", new File(antHome,"apache-ant-1.7.1").getAbsolutePath());
antInstallation = new AntInstallation("default", new File(antHome,"apache-ant-1.7.1").getAbsolutePath(),NO_PROPERTIES);
}
hudson.getDescriptorByType(Ant.DescriptorImpl.class).setInstallations(antInstallation);
return antInstallation;
......@@ -563,6 +566,18 @@ public abstract class HudsonTestCase extends TestCase {
throw new AssertionError("No such submit button with the name "+name);
}
protected HtmlInput findPreviousInputElement(HtmlElement current, String name) {
return (HtmlInput)current.selectSingleNode("(preceding::input[@name='_."+name+"'])[last()]");
}
protected HtmlButton getButtonByCaption(HtmlForm f, String s) {
for (HtmlElement b : f.getHtmlElementsByTagName("button")) {
if(b.getTextContent().trim().equals(s))
return (HtmlButton)b;
}
return null;
}
/**
* Creates a {@link TaskListener} connected to stdout.
*/
......@@ -969,4 +984,6 @@ public abstract class HudsonTestCase extends TestCase {
}
private static final Logger LOGGER = Logger.getLogger(HudsonTestCase.class.getName());
protected static final List<ToolProperty<?>> NO_PROPERTIES = Collections.<ToolProperty<?>>emptyList();
}
......@@ -72,8 +72,8 @@ public class AntTest extends HudsonTestCase {
HtmlForm f = p.getFormByName("config");
HtmlButton b = getButtonByCaption(f, "Add Ant");
b.click();
((HtmlInput)b.selectSingleNode("(preceding::input[@name='_.name'])[last()]")).setValueAttribute("myAnt");
((HtmlInput)b.selectSingleNode("(preceding::input[@name='_.home'])[last()]")).setValueAttribute("/tmp/foo");
findPreviousInputElement(b,"name").setValueAttribute("myAnt");
findPreviousInputElement(b,"home").setValueAttribute("/tmp/foo");
submit(f);
verify();
......@@ -87,7 +87,7 @@ public class AntTest extends HudsonTestCase {
private void verify() throws Exception {
AntInstallation[] l = get(DescriptorImpl.class).getInstallations();
assertEquals(1,l.length);
assertEqualBeans(l[0],new AntInstallation("myAnt","/tmp/foo"),"name,home");
assertEqualBeans(l[0],new AntInstallation("myAnt","/tmp/foo",NO_PROPERTIES),"name,home");
// by default we should get the auto installer
DescribableList<ToolProperty<?>,ToolPropertyDescriptor> props = l[0].getProperties();
......@@ -96,12 +96,4 @@ public class AntTest extends HudsonTestCase {
assertEquals(1,isp.installers.size());
assertNotNull(isp.installers.get(AntInstaller.class));
}
private HtmlButton getButtonByCaption(HtmlForm f, String s) {
for (HtmlElement b : f.getHtmlElementsByTagName("button")) {
if(b.getTextContent().trim().equals(s))
return (HtmlButton)b;
}
return null;
}
}
package hudson.tasks;
import hudson.EnvVars;
import hudson.tools.ToolProperty;
import hudson.maven.MavenModuleSet;
import hudson.maven.MavenModuleSetBuild;
import hudson.model.FreeStyleBuild;
......@@ -13,6 +14,7 @@ import hudson.tasks.Ant.AntInstallation;
import hudson.tasks.Maven.MavenInstallation;
import java.io.File;
import java.util.Collections;
import org.apache.tools.ant.taskdefs.condition.Os;
import org.jvnet.hudson.test.ExtractResourceSCM;
......@@ -35,13 +37,13 @@ public class EnvVarsInConfigTasksTest extends HudsonTestCase {
configureDefaultMaven();
MavenInstallation defaultMaven = hudson.getDescriptorByType(Maven.DescriptorImpl.class).getInstallations()[0];
MavenInstallation varMaven = new MavenInstallation("varMaven",
withVariable(defaultMaven.getMavenHome()));
withVariable(defaultMaven.getHome()), NO_PROPERTIES);
hudson.getDescriptorByType(Maven.DescriptorImpl.class).setInstallations(varMaven);
// Ant with a variable in its path
AntInstallation ant = configureDefaultAnt();
AntInstallation antInstallation = new AntInstallation("varAnt",
withVariable(ant.getHome()));
withVariable(ant.getHome()),NO_PROPERTIES);
hudson.getDescriptorByType(Ant.DescriptorImpl.class).setInstallations(antInstallation);
// create slaves
......
......@@ -30,25 +30,20 @@ import hudson.model.JDK;
import hudson.model.ParametersDefinitionProperty;
import hudson.model.Result;
import hudson.model.StringParameterDefinition;
import hudson.model.AbstractProject;
import hudson.model.Job;
import hudson.model.AbstractBuild;
import hudson.model.Run;
import hudson.model.Cause;
import hudson.model.Action;
import hudson.model.ParametersAction;
import hudson.model.StringParameterValue;
import hudson.model.Cause.LegacyCodeCause;
import hudson.model.listeners.RunListener;
import hudson.slaves.EnvironmentVariablesNodeProperty;
import hudson.slaves.EnvironmentVariablesNodeProperty.Entry;
import hudson.tasks.Maven.MavenInstallation;
import hudson.remoting.AsyncFutureImpl;
import hudson.tasks.Maven.MavenInstaller;
import hudson.tasks.Maven.MavenInstallation.DescriptorImpl;
import hudson.tools.ToolProperty;
import hudson.tools.ToolPropertyDescriptor;
import hudson.tools.InstallSourceProperty;
import hudson.util.DescribableList;
import java.util.Collections;
import java.util.concurrent.Future;
import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit;
import junit.framework.Assert;
......@@ -56,6 +51,8 @@ import org.jvnet.hudson.test.HudsonTestCase;
import com.gargoylesoftware.htmlunit.html.HtmlForm;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
import com.gargoylesoftware.htmlunit.html.HtmlButton;
import com.gargoylesoftware.htmlunit.html.HtmlInput;
/**
* @author Kohsuke Kawaguchi
......@@ -87,11 +84,10 @@ public class MavenTest extends HudsonTestCase {
public void testWithNodeProperty() throws Exception {
MavenInstallation maven = configureDefaultMaven();
String mavenHome = maven.getMavenHome();
String mavenHome = maven.getHome();
String mavenHomeVar = "${VAR_MAVEN}" + mavenHome.substring(3);
String mavenVar = mavenHome.substring(0, 3);
MavenInstallation varMaven = new MavenInstallation("varMaven",
mavenHomeVar);
MavenInstallation varMaven = new MavenInstallation("varMaven", mavenHomeVar, NO_PROPERTIES);
hudson.getDescriptorByType(Maven.DescriptorImpl.class).setInstallations(maven, varMaven);
JDK jdk = hudson.getJDK("default");
......@@ -117,15 +113,14 @@ public class MavenTest extends HudsonTestCase {
public void testWithParameter() throws Exception {
MavenInstallation maven = configureDefaultMaven();
String mavenHome = maven.getMavenHome();
String mavenHome = maven.getHome();
String mavenHomeVar = "${VAR_MAVEN}" + mavenHome.substring(3);
String mavenVar = mavenHome.substring(0, 3);
MavenInstallation varMaven = new MavenInstallation("varMaven",
mavenHomeVar);
MavenInstallation varMaven = new MavenInstallation("varMaven",mavenHomeVar,NO_PROPERTIES);
hudson.getDescriptorByType(Maven.DescriptorImpl.class).setInstallations(maven, varMaven);
JDK jdk = hudson.getJDK("default");
String javaHome = jdk.getJavaHome();
String javaHome = jdk.getHome();
String javaHomeVar = "${VAR_JAVA}" + javaHome.substring(3);
String javaVar = javaHome.substring(0, 3);
JDK varJDK = new JDK("varJDK", javaHomeVar);
......@@ -147,4 +142,36 @@ public class MavenTest extends HudsonTestCase {
}
/**
* Simulates the addition of the new Maven via UI and makes sure it works.
*/
public void testGlobalConfigAjax() throws Exception {
HtmlPage p = new WebClient().goTo("configure");
HtmlForm f = p.getFormByName("config");
HtmlButton b = getButtonByCaption(f, "Add Maven");
b.click();
findPreviousInputElement(b,"name").setValueAttribute("myMaven");
findPreviousInputElement(b,"home").setValueAttribute("/tmp/foo");
submit(f);
verify();
// another submission and verfify it survives a roundtrip
p = new WebClient().goTo("configure");
f = p.getFormByName("config");
submit(f);
verify();
}
private void verify() throws Exception {
MavenInstallation[] l = get(DescriptorImpl.class).getInstallations();
assertEquals(1,l.length);
assertEqualBeans(l[0],new MavenInstallation("myMaven","/tmp/foo",NO_PROPERTIES),"name,home");
// by default we should get the auto installer
DescribableList<ToolProperty<?>,ToolPropertyDescriptor> props = l[0].getProperties();
assertEquals(1,props.size());
InstallSourceProperty isp = props.get(InstallSourceProperty.class);
assertEquals(1,isp.installers.size());
assertNotNull(isp.installers.get(MavenInstaller.class));
}
}
......@@ -34,7 +34,6 @@ import hudson.tasks.Ant.AntInstallation;
import hudson.tasks.Maven.MavenInstallation;
import hudson.EnvVars;
import hudson.maven.MavenModuleSet;
import hudson.maven.MavenModuleSetBuild;
import java.io.IOException;
......@@ -60,9 +59,9 @@ public class ToolLocationNodePropertyTest extends HudsonTestCase {
public void testFormRoundTrip() throws Exception {
MavenInstallation.DescriptorImpl mavenDescriptor = hudson.getDescriptorByType(MavenInstallation.DescriptorImpl.class);
mavenDescriptor.setInstallations(new MavenInstallation("maven", "XXX"));
mavenDescriptor.setInstallations(new MavenInstallation("maven", "XXX", NO_PROPERTIES));
AntInstallation.DescriptorImpl antDescriptor = hudson.getDescriptorByType(AntInstallation.DescriptorImpl.class);
antDescriptor.setInstallations(new AntInstallation("ant", "XXX"));
antDescriptor.setInstallations(new AntInstallation("ant", "XXX", NO_PROPERTIES));
JDK.DescriptorImpl jdkDescriptor = hudson.getDescriptorByType(JDK.DescriptorImpl.class);
jdkDescriptor.setInstallations(new JDK("jdk", "XXX"));
......@@ -101,7 +100,7 @@ public class ToolLocationNodePropertyTest extends HudsonTestCase {
public void testMaven() throws Exception {
MavenInstallation maven = configureDefaultMaven();
String mavenPath = maven.getHome();
Hudson.getInstance().getDescriptorByType(Maven.DescriptorImpl.class).setInstallations(new MavenInstallation("maven", "THIS IS WRONG"));
Hudson.getInstance().getDescriptorByType(Maven.DescriptorImpl.class).setInstallations(new MavenInstallation("maven", "THIS IS WRONG", NO_PROPERTIES));
project.getBuildersList().add(new Maven("--version", "maven"));
configureDumpEnvBuilder();
......@@ -148,7 +147,7 @@ public class ToolLocationNodePropertyTest extends HudsonTestCase {
public void testNativeMaven() throws Exception {
MavenInstallation maven = configureDefaultMaven();
String mavenPath = maven.getHome();
Hudson.getInstance().getDescriptorByType(Maven.DescriptorImpl.class).setInstallations(new MavenInstallation("maven", "THIS IS WRONG"));
Hudson.getInstance().getDescriptorByType(Maven.DescriptorImpl.class).setInstallations(new MavenInstallation("maven", "THIS IS WRONG", NO_PROPERTIES));
MavenModuleSet project = createMavenProject();
project.setScm(new ExtractResourceSCM(getClass().getResource(
......@@ -186,6 +185,4 @@ public class ToolLocationNodePropertyTest extends HudsonTestCase {
project = createFreeStyleProject();
project.setAssignedLabel(slave.getSelfLabel());
}
}
\ No newline at end of file
......@@ -24,7 +24,6 @@ public class ToolLocationTest extends HudsonTestCase {
Maven.MavenInstallation[] maven = Hudson.getInstance().getDescriptorByType(Maven.DescriptorImpl.class).getInstallations();
assertEquals(maven.length, 1);
assertEquals(maven[0].getHome(), "bar");
assertEquals(maven[0].getMavenHome(), "bar");
assertEquals(maven[0].getName(), "Maven 1");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册