/** * 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); }
@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"); } }
@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"); } }
/** * 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); }
/** * 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); }
/** * 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); }
/** * 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); }
/** * 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); }
if (IOUtils.isAbsolute(rootPOM)) { pom = new File(rootPOM); } else { } else if (IOUtils.isAbsolute(alternateSettings)) { settingsLoc = new File(alternateSettings); } else {
if (IOUtils.isAbsolute(rootPOM)) { pom = new File(rootPOM); } else { } else if (IOUtils.isAbsolute(alternateSettings)) { settingsLoc = new File(alternateSettings); } else {
@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"); } }
@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"); } }
if (IOUtils.isAbsolute(project.getAlternateSettings())) { margs.add("-s").add(project.getAlternateSettings()); } else {