本文整理了Java中hudson.model.Hudson.getRootPath()
方法的一些代码示例,展示了Hudson.getRootPath()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Hudson.getRootPath()
方法的具体详情如下:
包路径:hudson.model.Hudson
类名称:Hudson
方法名:getRootPath
暂无
代码示例来源:origin: org.hudsonci.plugins/run-condition
@Override
public FilePath getBaseDirectory(final AbstractBuild<?, ?> build) {
return Hudson.getInstance().getRootPath();
}
代码示例来源:origin: org.jvnet.hudson.main/maven3-plugin
/**
* Handles installation onto the master node.
*/
public void consume(final EventObject event) throws Exception {
if (event instanceof ReadyEvent) {
ReadyEvent target = (ReadyEvent)event;
FilePath root = target.getHudson().getRootPath();
if (install(root, null)) {
log.info("Maven slave bundle installed");
}
}
}
代码示例来源:origin: hudson/hudson-2.x
/**
* Binds /userContent/... to $HUDSON_HOME/userContent.
*/
public DirectoryBrowserSupport doUserContent() {
return new DirectoryBrowserSupport(this, getRootPath().child("userContent"), "User content", "folder.gif", true);
}
代码示例来源:origin: org.jenkins-ci.plugins/publish-over
public static FormValidation validateFileOnMaster(final String value) {
// this check prevents a NPE when called from global configuration - if not global, use validatePath directly
if (JenkinsCapabilities.missing(JenkinsCapabilities.VALIDATE_FILE_ON_MASTER_FROM_GLOBAL_CFG))
return FormValidation.ok();
try {
return Hudson.getInstance().getRootPath().validateRelativePath(value, true, true);
} catch (IOException ioe) {
return FormValidation.error(ioe, "");
}
}
代码示例来源:origin: org.jvnet.hudson.main/hudson-core
/**
* Binds /userContent/... to $HUDSON_HOME/userContent.
*/
public DirectoryBrowserSupport doUserContent() {
return new DirectoryBrowserSupport(this, getRootPath().child("userContent"), "User content", "folder.gif", true);
}
代码示例来源:origin: org.eclipse.hudson/hudson-core
/**
* Binds /userContent/... to $HUDSON_HOME/userContent.
*/
public DirectoryBrowserSupport doUserContent() {
return new DirectoryBrowserSupport(this, getRootPath().child("userContent"), "User content", "folder.png", true);
}
代码示例来源:origin: org.eclipse.hudson.main/hudson-core
/**
* Binds /userContent/... to $HUDSON_HOME/userContent.
*/
public DirectoryBrowserSupport doUserContent() {
return new DirectoryBrowserSupport(this, getRootPath().child("userContent"), "User content", "folder.png", true);
}
代码示例来源:origin: org.hudsonci.plugins/run-condition
@Override
public FilePath getBaseDirectory(final AbstractBuild<?, ?> build) {
return new FilePath(Hudson.getInstance().getRootPath(), build.getArtifactsDir().getAbsolutePath());
}
代码示例来源:origin: org.jenkins-ci.lib/xtrigger-lib
@Override
public void onAddedTo(final AbstractBuild build) {
final XTriggerCauseAction causeAction = build.getAction(XTriggerCauseAction.class);
if (causeAction != null) {
try {
Hudson.getInstance().getRootPath().act(new Callable<Void, XTriggerException>() {
@Override
public Void call() throws XTriggerException {
causeAction.setBuild(build);
File triggerLogFile = causeAction.getLogFile();
String logContent = causeAction.getLogMessage();
try {
FileUtils.writeStringToFile(triggerLogFile, logContent);
} catch (IOException ioe) {
throw new XTriggerException(ioe);
}
return null;
}
});
} catch (IOException ioe) {
LOGGER.log(Level.SEVERE, "Problem to attach cause object to build object.", ioe);
} catch (InterruptedException ie) {
LOGGER.log(Level.SEVERE, "Problem to attach cause object to build object.", ie);
} catch (XTriggerException xe) {
LOGGER.log(Level.SEVERE, "Problem to attach cause object to build object.", xe);
}
}
}
代码示例来源:origin: org.jvnet.hudson.main/hudson-test-harness
/**
* Extracts Ant and configures it.
*/
protected Ant.AntInstallation configureDefaultAnt() throws Exception {
Ant.AntInstallation antInstallation;
if (System.getenv("ANT_HOME") != null) {
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.");
FilePath ant = hudson.getRootPath().createTempFile("ant", "zip");
ant.copyFrom(HudsonTestCase.class.getClassLoader().getResource("apache-ant-1.8.1-bin.zip"));
File antHome = createTmpDir();
ant.unzip(new FilePath(antHome));
// TODO: switch to tar that preserves file permissions more easily
if(!Functions.isWindows())
GNUCLibrary.LIBC.chmod(new File(antHome,"apache-ant-1.8.1/bin/ant").getPath(),0755);
antInstallation = new AntInstallation("default", new File(antHome,"apache-ant-1.8.1").getAbsolutePath(),NO_PROPERTIES);
}
hudson.getDescriptorByType(Ant.DescriptorImpl.class).setInstallations(antInstallation);
return antInstallation;
}
代码示例来源:origin: org.jvnet.hudson.main/hudson-test-framework
/**
* Extracts Ant and configures it.
*/
protected Ant.AntInstallation configureDefaultAnt() throws Exception {
Ant.AntInstallation antInstallation;
if (System.getenv("ANT_HOME") != null) {
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.");
FilePath ant = hudson.getRootPath().createTempFile("ant", "zip");
ant.copyFrom(HudsonTestCase.class.getClassLoader().getResource("apache-ant-1.8.1-bin.zip"));
File antHome = createTmpDir();
ant.unzip(new FilePath(antHome));
// TODO: switch to tar that preserves file permissions more easily
if(!Functions.isWindows())
GNUCLibrary.LIBC.chmod(new File(antHome,"apache-ant-1.8.1/bin/ant").getPath(),0755);
antInstallation = new AntInstallation("default", new File(antHome,"apache-ant-1.8.1").getAbsolutePath(),NO_PROPERTIES);
}
hudson.getDescriptorByType(Ant.DescriptorImpl.class).setInstallations(antInstallation);
return antInstallation;
}
代码示例来源:origin: org.eclipse.hudson/hudson-test-framework
/**
* Extracts Ant and configures it.
*/
protected Ant.AntInstallation configureDefaultAnt() throws Exception {
Ant.AntInstallation antInstallation;
if (System.getenv("ANT_HOME") != null) {
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.");
FilePath ant = hudson.getRootPath().createTempFile("ant", "zip");
ant.copyFrom(HudsonTestCase.class.getClassLoader().getResource("apache-ant-1.8.1-bin.zip"));
File antHome = createTmpDir();
ant.unzip(new FilePath(antHome));
// TODO: switch to tar that preserves file permissions more easily
if (!Functions.isWindows()) {
Util.chmod(new File(antHome, "apache-ant-1.8.1/bin/ant"), 0755);
}
antInstallation = new AntInstallation("default", new File(antHome, "apache-ant-1.8.1").getAbsolutePath(), NO_PROPERTIES);
}
hudson.getDescriptorByType(Ant.DescriptorImpl.class).setInstallations(antInstallation);
return antInstallation;
}
代码示例来源:origin: org.jvnet.hudson.main/hudson-test-harness
FilePath mvn = hudson.getRootPath().createTempFile("maven", "zip");
mvn.copyFrom(HudsonTestCase.class.getClassLoader().getResource(mavenVersion + "-bin.zip"));
File mvnHome = new File(buildDirectory);//createTmpDir();
代码示例来源:origin: org.jvnet.hudson.main/hudson-test-framework
FilePath mvn = hudson.getRootPath().createTempFile("maven", "zip");
mvn.copyFrom(HudsonTestCase.class.getClassLoader().getResource(mavenVersion + "-bin.zip"));
File mvnHome = new File(buildDirectory);//createTmpDir();
代码示例来源:origin: org.eclipse.hudson/hudson-test-framework
FilePath mvn = hudson.getRootPath().createTempFile("maven", "zip");
mvn.copyFrom(HudsonTestCase.class.getClassLoader().getResource(mavenVersion + "-bin.zip"));
File mvnHome = new File(buildDirectory);//createTmpDir();
代码示例来源:origin: org.jenkins-ci.plugins/publish-over
@Override
public boolean perform(final AbstractBuild<?, ?> build, final Launcher launcher, final BuildListener listener)
throws InterruptedException, IOException {
final PrintStream console = listener.getLogger();
if (!isBuildGoodEnoughToRun(build, console)) return true;
final BPBuildEnv currentBuildEnv = new BPBuildEnv(getEnvironmentVariables(build, listener), build.getWorkspace(),
build.getTimestamp());
BPBuildEnv targetBuildEnv = null;
if (PROMOTION_CLASS_NAME.equals(build.getClass().getCanonicalName())) {
AbstractBuild<?, ?> promoted;
try {
final Method getTarget = build.getClass().getMethod("getTarget", (Class<?>[]) null);
promoted = (AbstractBuild) getTarget.invoke(build, (Object[]) null);
} catch (Exception e) {
throw new RuntimeException(Messages.exception_failedToGetPromotedBuild(), e);
}
targetBuildEnv = new BPBuildEnv(getEnvironmentVariables(promoted, listener),
new FilePath(promoted.getArtifactsDir()), promoted.getTimestamp());
}
final BPBuildInfo buildInfo = new BPBuildInfo(listener, consolePrefix, Hudson.getInstance().getRootPath(),
currentBuildEnv, targetBuildEnv);
fixup(build, buildInfo);
final Result result = delegate.perform(buildInfo);
if (build.getResult() == null)
build.setResult(result);
else
build.setResult(result.combine(build.getResult()));
return result.isBetterOrEqualTo(Result.UNSTABLE);
}
代码示例来源:origin: org.jenkins-ci.plugins/copy-to-slave
rootFilePathOnMaster = Hudson.getInstance().getRootPath();
rootFilePathOnMaster = Hudson.getInstance().getRootPath().child("userContent");
内容来源于网络,如有侵权,请联系作者删除!