Skip to content
This repository has been archived by the owner on Sep 8, 2022. It is now read-only.

Commit

Permalink
Merge pull request #5 from jenkinsci/jenkins-32765
Browse files Browse the repository at this point in the history
[JENKINS-32765] Expose the exploded plugin archive directory as a command line option
  • Loading branch information
stephenc committed Feb 15, 2016
2 parents ec617a6 + 7fb8540 commit ecf966c
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion src/main/java/Main.java
Expand Up @@ -164,6 +164,15 @@ private static void _main(String[] args) throws Exception {
break;
}
}
for (int i = 0; i < args.length; i++) {
if (args[i].startsWith("--pluginroot=")) {
System.setProperty("hudson.PluginManager.workDir",
new File(args[i].substring("--pluginroot=".length())).getAbsolutePath());
// if specified multiple times, the first one wins
break;
}
}


// this is so that JFreeChart can work nicely even if we are launched as a daemon
System.setProperty("java.awt.headless","true");
Expand Down Expand Up @@ -209,6 +218,9 @@ private static void _main(String[] args) throws Exception {
"Usage: java -jar jenkins.war [--option=value] [--option=value]\n" +
"\n" +
"Options:\n" +
" --webroot = folder where the WAR file is expanded into. Default is ${JENKINS_HOME}/war\n" +
" --pluginroot = folder where the plugin archives are expanded into. Default is ${JENKINS_HOME}/plugins\n" +
" (NOTE: this option does not change the directory where the plugin archives are stored)\n" +
" --extractedFilesFolder = folder where extracted files are to be located. Default is the temp folder\n" +
" --daemon = fork into background and run as daemon (Unix only)\n" +
" --config = load configuration properties from here. Default is ./winstone.properties\n" +
Expand Down Expand Up @@ -298,7 +310,8 @@ private static void _main(String[] args) throws Exception {
private static void trimOffOurOptions(List arguments) {
for (Iterator itr = arguments.iterator(); itr.hasNext(); ) {
String arg = (String) itr.next();
if (arg.startsWith("--daemon") || arg.startsWith("--logfile") || arg.startsWith("--extractedFilesFolder"))
if (arg.startsWith("--daemon") || arg.startsWith("--logfile") || arg.startsWith("--extractedFilesFolder")
|| arg.startsWith("--pluginroot"))
itr.remove();
}
}
Expand Down Expand Up @@ -340,6 +353,15 @@ private static boolean hasWebRoot(List arguments) {
return false;
}

private static boolean hasPluginRoot(List arguments) {
for (Iterator itr = arguments.iterator(); itr.hasNext();) {
String s = (String) itr.next();
if(s.startsWith("--pluginroot="))
return true;
}
return false;
}

/**
* Figures out the URL of <tt>jenkins.war</tt>.
*/
Expand Down

0 comments on commit ecf966c

Please sign in to comment.