本文整理了Java中hudson.remoting.Which.jarFile()
方法的一些代码示例,展示了Which.jarFile()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Which.jarFile()
方法的具体详情如下:
包路径:hudson.remoting.Which
类名称:Which
方法名:jarFile
[英]Locates the jar file that contains the given class.
Note that jar files are not always loaded from File, so for diagnostics purposes #jarURL(Class) is preferrable.
[中]定位包含给定类的jar文件。
请注意,jar文件并不总是从文件加载,因此出于诊断目的,最好使用#jarURL(类)。
代码示例来源:origin: jenkinsci/jenkins
/**
* Adds a jar file that contains the given class.
* @since 1.361
*/
public ClasspathBuilder addJarOf(Class c) throws IOException {
return add(Which.jarFile(c));
}
代码示例来源:origin: jenkinsci/jenkins
/**
* With fix to JENKINS-11251 (remoting 2.15), this is no longer necessary.
* But I'm keeping it for a while so that users who manually deploy agent.jar has time to deploy new version
* before this goes away.
*/
private void syncIO() throws InterruptedException {
try {
if (channel!=null)
channel.syncLocalIO();
} catch (AbstractMethodError e) {
// legacy agent.jar. Handle this gracefully
try {
LOGGER.log(Level.WARNING,"Looks like an old agent.jar. Please update "+ Which.jarFile(Channel.class)+" to the new version",e);
} catch (IOException ignored) {
// really ignore this time
}
}
}
代码示例来源:origin: jenkinsci/jenkins
File cliJar = Which.jarFile(CLI.class);
if (cliJar.isFile()) {
name = "jenkins-cli.jar";
File remotingJar = Which.jarFile(hudson.remoting.Launcher.class);
if (remotingJar.isFile()) {
name = "lib/" + remotingJar.getName();
代码示例来源:origin: jenkinsci/configuration-as-code-plugin
/**
* Retrieve which plugin do provide this extension point, used in documentation.jelly
*
* @return String representation of the extension source, usually artifactId.
*/
@CheckForNull
public String getExtensionSource(Configurator c) throws IOException {
final Class e = c.getImplementedAPI();
final String jar = Which.jarFile(e).getName();
if (jar.startsWith("jenkins-core-")) { // core jar has version in name
return "jenkins-core";
}
return jar.substring(0, jar.lastIndexOf('.'));
}
代码示例来源:origin: jenkinsci/jenkins
VirtualChannel start(TaskListener listener, String rootPassword) throws IOException, InterruptedException {
final int uid = LIBC.geteuid();
if(uid==0) // already running as root
return newLocalChannel();
String javaExe = System.getProperty("java.home") + "/bin/java";
File slaveJar = Which.jarFile(Launcher.class);
ArgumentListBuilder args = new ArgumentListBuilder().add(javaExe);
if(slaveJar.isFile())
args.add("-jar").add(slaveJar);
else // in production code this never happens, but during debugging this is convenient
args.add("-cp").add(slaveJar).add(hudson.remoting.Launcher.class.getName());
if(rootPassword==null) {
// try sudo, in the hope that the user has the permission to do so without password
return new LocalLauncher(listener).launchChannel(
args.prepend(sudoExe()).toCommandArray(),
listener.getLogger(), null, Collections.<String, String>emptyMap());
} else {
// try sudo with the given password. Also run in pfexec so that we can elevate the privileges
Process proc = sudoWithPass(args);
return Channels.forProcess(args.toStringWithQuote(), Computer.threadPoolForRemoting, proc,
listener.getLogger() );
}
}
}
代码示例来源:origin: jenkinsci/selenium-plugin
/**
* Locate the htmlunit driver jar from the classpath. Only works on the master.
*/
public static File findHtmlUnitDriverJar() throws IOException {
return Which.jarFile(HtmlUnitDriver.class);
}
代码示例来源:origin: jenkinsci/selenium-plugin
/**
* Locate the stand-alone server jar from the classpath. Only works on the master.
*/
public static File findStandAloneServerJar() throws IOException {
return Which.jarFile(GridLauncherV3.class);
}
代码示例来源:origin: org.jvnet.hudson.main/hudson-plugin-utils
public FilePath call() throws Exception {
Class type = Class.forName(className);
return new FilePath(Which.jarFile(type));
}
}
代码示例来源:origin: org.eclipse.hudson.main/hudson-plugin-utils
public FilePath call() throws Exception {
Class type = Class.forName(className);
return new FilePath(Which.jarFile(type));
}
}
代码示例来源:origin: org.eclipse.hudson/hudson-plugin-utils
public FilePath call() throws Exception {
Class type = Class.forName(className);
return new FilePath(Which.jarFile(type));
}
}
代码示例来源:origin: org.jvnet.hudson.main/hudson-core
/**
* Adds a jar file that contains the given class.
* @since 1.361
*/
public ClasspathBuilder addJarOf(Class c) throws IOException {
return add(Which.jarFile(c));
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
/**
* Adds a jar file that contains the given class.
* @since 1.361
*/
public ClasspathBuilder addJarOf(Class c) throws IOException {
return add(Which.jarFile(c));
}
代码示例来源:origin: org.eclipse.hudson/hudson-core
/**
* Adds a jar file that contains the given class.
*
* @since 1.361
*/
public ClasspathBuilder addJarOf(Class c) throws IOException {
return add(Which.jarFile(c));
}
代码示例来源:origin: hudson/hudson-2.x
/**
* Adds a jar file that contains the given class.
* @since 1.361
*/
public ClasspathBuilder addJarOf(Class c) throws IOException {
return add(Which.jarFile(c));
}
代码示例来源:origin: org.eclipse.hudson.main/hudson-core
/**
* Adds a jar file that contains the given class.
* @since 1.361
*/
public ClasspathBuilder addJarOf(Class c) throws IOException {
return add(Which.jarFile(c));
}
代码示例来源:origin: org.eclipse.hudson.main/hudson-remoting
public boolean preloadJar(ClassLoader local, Class... classesInJar) throws IOException, InterruptedException {
URL[] jars = new URL[classesInJar.length];
for (int i = 0; i < classesInJar.length; i++) {
jars[i] = Which.jarFile(classesInJar[i]).toURI().toURL();
}
return call(new PreloadJarTask(jars, local));
}
代码示例来源:origin: jenkinsci/remoting
public boolean preloadJar(ClassLoader local, Class... classesInJar) throws IOException, InterruptedException {
URL[] jars = new URL[classesInJar.length];
for (int i = 0; i < classesInJar.length; i++)
jars[i] = Which.jarFile(classesInJar[i]).toURI().toURL();
return call(new PreloadJarTask(jars, local));
}
代码示例来源:origin: hudson/hudson-2.x
public boolean preloadJar(ClassLoader local, Class... classesInJar) throws IOException, InterruptedException {
URL[] jars = new URL[classesInJar.length];
for (int i = 0; i < classesInJar.length; i++) {
jars[i] = Which.jarFile(classesInJar[i]).toURI().toURL();
}
return call(new PreloadJarTask(jars, local));
}
代码示例来源:origin: org.eclipse.hudson/hudson-remoting
public boolean preloadJar(ClassLoader local, Class... classesInJar) throws IOException, InterruptedException {
URL[] jars = new URL[classesInJar.length];
for (int i = 0; i < classesInJar.length; i++) {
jars[i] = Which.jarFile(classesInJar[i]).toURI().toURL();
}
return call(new PreloadJarTask(jars, local));
}
代码示例来源:origin: jenkinsci/remoting
public String call() throws IOException {
StackMapAttribute sma = new StackMapAttribute();
return Which.jarFile(sma.getClass()).getPath();
}
}
内容来源于网络,如有侵权,请联系作者删除!