本文整理了Java中hudson.model.Item.getRootDir()
方法的一些代码示例,展示了Item.getRootDir()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Item.getRootDir()
方法的具体详情如下:
包路径:hudson.model.Item
类名称:Item
方法名:getRootDir
暂无
代码示例来源:origin: jenkinsci/jenkins
/**
* Returns the file that records the last/current polling activity.
*/
public File getLogFile() {
return new File(job.getRootDir(),"scm-polling.log");
}
代码示例来源:origin: jenkinsci/jenkins
/**
* The file we save our configuration.
*/
public static XmlFile getConfigFile(Item item) {
return getConfigFile(item.getRootDir());
}
代码示例来源:origin: jenkinsci/jenkins
private File expandVariablesForDirectory(String base, Item item) {
return new File(expandVariablesForDirectory(base, item.getFullName(), item.getRootDir().getPath()));
}
代码示例来源:origin: jenkinsci/jenkins
@Override
public void onLocationChanged(Item item, String oldFullName, String newFullName) {
final Jenkins jenkins = Jenkins.getInstance();
if (!jenkins.isDefaultBuildDir() && item instanceof Job) {
File newBuildDir = ((Job)item).getBuildDir();
try {
if (!Util.isDescendant(item.getRootDir(), newBuildDir)) {
//OK builds are stored somewhere outside of the item's root, so none of the other move operations has probably moved it.
//So let's try even though we lack some information
String oldBuildsDir = Jenkins.expandVariablesForDirectory(jenkins.getRawBuildsDir(), oldFullName, "<NOPE>");
if (oldBuildsDir.contains("<NOPE>")) {
LOGGER.severe(String.format("Builds directory for job %1$s appears to be outside of item root," +
" but somehow still containing the item root path, which is unknown. Cannot move builds from %2$s to %1$s.", newFullName, oldFullName));
} else {
File oldDir = new File(oldBuildsDir);
if (oldDir.isDirectory()) {
try {
FileUtils.moveDirectory(oldDir, newBuildDir);
} catch (IOException e) {
LOGGER.log(Level.SEVERE, String.format("Failed to move %s to %s", oldBuildsDir, newBuildDir.getAbsolutePath()), e);
}
}
}
}
} catch (IOException e) {
LOGGER.log(Level.WARNING, "Failed to inspect " + item.getRootDir() + ". Builds might not be moved.", e);
}
}
}
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
/**
* Returns the file that records the last/current polling activity.
*/
public File getLogFile() {
return new File(job.getRootDir(),"scm-polling.log");
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
/**
* The file we save our configuration.
*/
public static XmlFile getConfigFile(Item item) {
return getConfigFile(item.getRootDir());
}
代码示例来源:origin: org.eclipse.hudson/hudson-core
/**
* The file we save our configuration.
*/
public static XmlFile getConfigFile(Item item) {
return getConfigFile(item.getRootDir());
}
/**
代码示例来源:origin: hudson/hudson-2.x
/**
* The file we save our configuration.
*/
public static XmlFile getConfigFile(Item item) {
return getConfigFile(item.getRootDir());
}
代码示例来源:origin: org.jvnet.hudson.main/hudson-core
/**
* The file we save our configuration.
*/
public static XmlFile getConfigFile(Item item) {
return getConfigFile(item.getRootDir());
}
代码示例来源:origin: org.eclipse.hudson.main/hudson-core
/**
* The file we save our configuration.
*/
public static XmlFile getConfigFile(Item item) {
return getConfigFile(item.getRootDir());
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
private File expandVariablesForDirectory(String base, Item item) {
return new File(expandVariablesForDirectory(base, item.getFullName(), item.getRootDir().getPath()));
}
代码示例来源:origin: jenkinsci/promoted-builds-plugin
@Override
public void notifyItemUpdated(Item item, DslEnvironment dslEnvironment) {
LOGGER.log(Level.INFO, String.format("Updating promotions for %s", item.getName()));
@SuppressWarnings("unchecked")
Set<String> newPromotions = (Set<String>) dslEnvironment.get("processNames");
File dir = new File(item.getRootDir(), "promotions/");
boolean update = false;
// Delete removed promotions
if (newPromotions != null) {
File[] files = dir.listFiles();
if (files != null) {
for (File promotion : files) {
if (!newPromotions.contains(promotion.getName())) {
boolean deleted = promotion.delete();
if(deleted){
LOGGER.log(Level.INFO, String.format("Deleted promotion with name %s for %s", promotion.getName(), item.getName()));
update = true;
}
}
}
}
}
// Delegate to create-method
this.notifyItemCreated(item, dslEnvironment, update);
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
@Override
public void onLocationChanged(Item item, String oldFullName, String newFullName) {
final Jenkins jenkins = Jenkins.getInstance();
if (!jenkins.isDefaultBuildDir() && item instanceof Job) {
File newBuildDir = ((Job)item).getBuildDir();
try {
if (!Util.isDescendant(item.getRootDir(), newBuildDir)) {
//OK builds are stored somewhere outside of the item's root, so none of the other move operations has probably moved it.
//So let's try even though we lack some information
String oldBuildsDir = Jenkins.expandVariablesForDirectory(jenkins.getRawBuildsDir(), oldFullName, "<NOPE>");
if (oldBuildsDir.contains("<NOPE>")) {
LOGGER.severe(String.format("Builds directory for job %1$s appears to be outside of item root," +
" but somehow still containing the item root path, which is unknown. Cannot move builds from %2$s to %1$s.", newFullName, oldFullName));
} else {
File oldDir = new File(oldBuildsDir);
if (oldDir.isDirectory()) {
try {
FileUtils.moveDirectory(oldDir, newBuildDir);
} catch (IOException e) {
LOGGER.log(Level.SEVERE, String.format("Failed to move %s to %s", oldBuildsDir, newBuildDir.getAbsolutePath()), e);
}
}
}
}
} catch (IOException e) {
LOGGER.log(Level.WARNING, "Failed to inspect " + item.getRootDir() + ". Builds might not be moved.", e);
}
}
}
}
代码示例来源:origin: jenkinsci/promoted-builds-plugin
XSTREAM.registerConverter(new ManualConditionConverter(XSTREAM.getMapper(), XSTREAM.getReflectionProvider()));
String xml = XSTREAM.toXML(promotionProcess);
File dir = new File(item.getRootDir(), "promotions/" + name);
File configXml = Items.getConfigFile(dir).getFile();
boolean created = configXml.getParentFile().mkdirs();
代码示例来源:origin: jenkinsci/scm-sync-configuration-plugin
oldDir = new File (item.getRootDir().getParentFile(), oldSimpleName);
} else if (oldParent instanceof DirectlyModifiableTopLevelItemGroup && item instanceof TopLevelItem) {
oldDir = ((DirectlyModifiableTopLevelItemGroup) oldParent).getRootDirFor((TopLevelItem) item);
oldStrategy = plugin.getStrategyForDeletedSaveable(item, JenkinsFilesHelper.buildPathRelativeToHudsonRoot(oldDir), true);
File newDir = item.getRootDir();
ScmSyncStrategy newStrategy = plugin.getStrategyForSaveable(item, newDir);
ScmTransaction transaction = plugin.getTransaction();
代码示例来源:origin: jenkinsci/scm-sync-configuration-plugin
@Override
public void onDeleted(Item item) {
super.onDeleted(item);
ScmSyncConfigurationPlugin plugin = ScmSyncConfigurationPlugin.getInstance();
if(plugin != null){
String path = JenkinsFilesHelper.buildPathRelativeToHudsonRoot(item.getRootDir());
ScmSyncStrategy strategy = plugin.getStrategyForDeletedSaveable(item, path, true);
if (strategy != null) {
WeightedMessage message = strategy.getCommitMessageFactory().getMessageWhenItemDeleted(item);
ScmTransaction transaction = plugin.getTransaction();
transaction.defineCommitMessage(message);
transaction.registerPathForDeletion(path);
}
}
}
内容来源于网络,如有侵权,请联系作者删除!