本文整理了Java中hudson.util.IOUtils.isAbsolute()
方法的一些代码示例,展示了IOUtils.isAbsolute()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。IOUtils.isAbsolute()
方法的具体详情如下:
包路径:hudson.util.IOUtils
类名称:IOUtils
方法名:isAbsolute
[英]See hudson.FilePath#isAbsolute(String).
[中]见哈德逊。文件路径#IsaSolute(字符串)。
代码示例来源:origin: jenkinsci/jenkins
/**
* Resolves the given path with respect to given base. If the path represents an absolute path, a file representing
* it is returned, otherwise a file representing a path relative to base is returned.
* <p>
* It would be nice if File#File(File, String) were doing this.
* @param base File that represents the parent, may be null if path is absolute
* @param path Path of the file, may not be null
* @return new File(name) if name represents an absolute path, new File(base, name) otherwise
* @see hudson.FilePath#absolutize()
*/
public static File absolutize(File base, String path) {
if (isAbsolute(path))
return new File(path);
return new File(base, path);
}
代码示例来源:origin: jenkinsci/jenkins
@Override
public FilePath supplySettings(AbstractBuild<?, ?> build, TaskListener listener) {
if (StringUtils.isEmpty(path)) {
return null;
}
try {
EnvVars env = build.getEnvironment(listener);
String targetPath = Util.replaceMacro(this.path, build.getBuildVariableResolver());
targetPath = env.expand(targetPath);
if (IOUtils.isAbsolute(targetPath)) {
return new FilePath(new File(targetPath));
} else {
FilePath mrSettings = build.getModuleRoot().child(targetPath);
FilePath wsSettings = build.getWorkspace().child(targetPath);
try {
if (!wsSettings.exists() && mrSettings.exists()) {
wsSettings = mrSettings;
}
} catch (Exception e) {
throw new IllegalStateException("failed to find settings.xml at: " + wsSettings.getRemote());
}
return wsSettings;
}
} catch (Exception e) {
throw new IllegalStateException("failed to prepare global settings.xml");
}
}
代码示例来源:origin: jenkinsci/jenkins
@Override
public FilePath supplySettings(AbstractBuild<?, ?> build, TaskListener listener) {
if (StringUtils.isEmpty(path)) {
return null;
}
try {
EnvVars env = build.getEnvironment(listener);
String targetPath = Util.replaceMacro(this.path, build.getBuildVariableResolver());
targetPath = env.expand(targetPath);
if (IOUtils.isAbsolute(targetPath)) {
return new FilePath(new File(targetPath));
} else {
FilePath mrSettings = build.getModuleRoot().child(targetPath);
FilePath wsSettings = build.getWorkspace().child(targetPath);
try {
if (!wsSettings.exists() && mrSettings.exists()) {
wsSettings = mrSettings;
}
} catch (Exception e) {
throw new IllegalStateException("failed to find settings.xml at: " + wsSettings.getRemote());
}
return wsSettings;
}
} catch (Exception e) {
throw new IllegalStateException("failed to prepare settings.xml");
}
}
代码示例来源:origin: org.eclipse.hudson.main/hudson-core
/**
* Resolves the given path with respect to given base. If the path represents an absolute path, a file representing
* it is returned, otherwise a file representing a path relative to base is returned.
* <p>
* It would be nice if File#File(File, String) were doing this.
* @param base File that represents the parent, may be null if path is absolute
* @param path Path of the file, may not be null
* @return new File(name) if name represents an absolute path, new File(base, name) otherwise
* @see hudson.FilePath#absolutize()
*/
public static File absolutize(File base, String path) {
if (isAbsolute(path))
return new File(path);
return new File(base, path);
}
代码示例来源:origin: org.jvnet.hudson.main/hudson-core
/**
* Resolves the given path with respect to given base. If the path represents an absolute path, a file representing
* it is returned, otherwise a file representing a path relative to base is returned.
* <p>
* It would be nice if File#File(File, String) were doing this.
* @param base File that represents the parent, may be null if path is absolute
* @param path Path of the file, may not be null
* @return new File(name) if name represents an absolute path, new File(base, name) otherwise
* @see hudson.FilePath#absolutize()
*/
public static File absolutize(File base, String path) {
if (isAbsolute(path))
return new File(path);
return new File(base, path);
}
代码示例来源:origin: hudson/hudson-2.x
/**
* Resolves the given path with respect to given base. If the path represents an absolute path, a file representing
* it is returned, otherwise a file representing a path relative to base is returned.
* <p>
* It would be nice if File#File(File, String) were doing this.
* @param base File that represents the parent, may be null if path is absolute
* @param path Path of the file, may not be null
* @return new File(name) if name represents an absolute path, new File(base, name) otherwise
* @see hudson.FilePath#absolutize()
*/
public static File absolutize(File base, String path) {
if (isAbsolute(path))
return new File(path);
return new File(base, path);
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
/**
* Resolves the given path with respect to given base. If the path represents an absolute path, a file representing
* it is returned, otherwise a file representing a path relative to base is returned.
* <p>
* It would be nice if File#File(File, String) were doing this.
* @param base File that represents the parent, may be null if path is absolute
* @param path Path of the file, may not be null
* @return new File(name) if name represents an absolute path, new File(base, name) otherwise
* @see hudson.FilePath#absolutize()
*/
public static File absolutize(File base, String path) {
if (isAbsolute(path))
return new File(path);
return new File(base, path);
}
代码示例来源:origin: org.eclipse.hudson/hudson-core
/**
* Resolves the given path with respect to given base. If the path
* represents an absolute path, a file representing it is returned,
* otherwise a file representing a path relative to base is returned. <p> It
* would be nice if File#File(File, String) were doing this.
*
* @param base File that represents the parent, may be null if path is
* absolute
* @param path Path of the file, may not be null
* @return new File(name) if name represents an absolute path, new
* File(base, name) otherwise
* @see hudson.FilePath#absolutize()
*/
public static File absolutize(File base, String path) {
if (isAbsolute(path)) {
return new File(path);
}
return new File(base, path);
}
代码示例来源:origin: org.jvnet.hudson.main/maven-plugin
if (IOUtils.isAbsolute(rootPOM)) {
pom = new File(rootPOM);
} else {
} else if (IOUtils.isAbsolute(alternateSettings)) {
settingsLoc = new File(alternateSettings);
} else {
代码示例来源:origin: jenkinsci/maven-plugin
if (IOUtils.isAbsolute(rootPOM)) {
pom = new File(rootPOM);
} else {
} else if (IOUtils.isAbsolute(alternateSettings)) {
settingsLoc = new File(alternateSettings);
} else {
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
@Override
public FilePath supplySettings(AbstractBuild<?, ?> build, TaskListener listener) {
if (StringUtils.isEmpty(path)) {
return null;
}
try {
EnvVars env = build.getEnvironment(listener);
String targetPath = Util.replaceMacro(this.path, build.getBuildVariableResolver());
targetPath = env.expand(targetPath);
if (IOUtils.isAbsolute(targetPath)) {
return new FilePath(new File(targetPath));
} else {
FilePath mrSettings = build.getModuleRoot().child(targetPath);
FilePath wsSettings = build.getWorkspace().child(targetPath);
try {
if (!wsSettings.exists() && mrSettings.exists()) {
wsSettings = mrSettings;
}
} catch (Exception e) {
throw new IllegalStateException("failed to find settings.xml at: " + wsSettings.getRemote());
}
return wsSettings;
}
} catch (Exception e) {
throw new IllegalStateException("failed to prepare settings.xml");
}
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
@Override
public FilePath supplySettings(AbstractBuild<?, ?> build, TaskListener listener) {
if (StringUtils.isEmpty(path)) {
return null;
}
try {
EnvVars env = build.getEnvironment(listener);
String targetPath = Util.replaceMacro(this.path, build.getBuildVariableResolver());
targetPath = env.expand(targetPath);
if (IOUtils.isAbsolute(targetPath)) {
return new FilePath(new File(targetPath));
} else {
FilePath mrSettings = build.getModuleRoot().child(targetPath);
FilePath wsSettings = build.getWorkspace().child(targetPath);
try {
if (!wsSettings.exists() && mrSettings.exists()) {
wsSettings = mrSettings;
}
} catch (Exception e) {
throw new IllegalStateException("failed to find settings.xml at: " + wsSettings.getRemote());
}
return wsSettings;
}
} catch (Exception e) {
throw new IllegalStateException("failed to prepare global settings.xml");
}
}
代码示例来源:origin: org.jvnet.hudson.main/maven-plugin
if (IOUtils.isAbsolute(project.getAlternateSettings())) {
margs.add("-s").add(project.getAlternateSettings());
} else {
内容来源于网络,如有侵权,请联系作者删除!