Merged revisions 16689-16697,16701-16710,16712-16714 via svnmerge from

https://www.dev.java.net/svn/hudson/branches/HUDSON-3251

........
  r16689 | kohsuke | 2009-03-29 08:52:25 -0700 (Sun, 29 Mar 2009) | 1 line
  
  [HUDSON-3251] (1/18) moving maven-related source to maven-plugin
........
  r16690 | kohsuke | 2009-03-29 08:57:23 -0700 (Sun, 29 Mar 2009) | 4 lines
  
  [HUDSON-3251] (3/18) moved KeptBecauseOfParent message
  
  Note I skipped (2/18) to move the logic into MavenProject.DescriptorImpl.isApplicable.
........
  r16691 | kohsuke | 2009-03-29 08:58:21 -0700 (Sun, 29 Mar 2009) | 3 lines
  
  [HUDSON-3251] (4/18) removed imports and javadoc links to Maven-related classes
........
  r16692 | kohsuke | 2009-03-29 08:59:49 -0700 (Sun, 29 Mar 2009) | 2 lines
  
  [HUDSON-3251] (5/18) moving maven-related functionality to maven plugin.
........
  r16693 | kohsuke | 2009-03-29 09:01:11 -0700 (Sun, 29 Mar 2009) | 5 lines
  
  [HUDSON-3251] (5/18) moving maven-related functionality to maven plugin
  
  Forgot to add a newly created file.
........
  r16694 | kohsuke | 2009-03-29 09:02:24 -0700 (Sun, 29 Mar 2009) | 1 line
  
  needs a copyright header on all files in the core
........
  r16695 | kohsuke | 2009-03-29 09:07:03 -0700 (Sun, 29 Mar 2009) | 1 line
  
  [HUDSON-3251] (6/18) updating poms and packaging to bundle maven plugin (with a minor adjustment to revert forkMode change)
........
  r16696 | kohsuke | 2009-03-29 09:17:58 -0700 (Sun, 29 Mar 2009) | 1 line
  
  [HUDSON-3251] (6/18) updating poms and packaging to bundle maven plugin (with a minor adjustment to revert forkMode change)
........
  r16697 | kohsuke | 2009-03-29 09:38:23 -0700 (Sun, 29 Mar 2009) | 2 lines
  
  [HUDSON-3251] (7/18) add a hudson.bundled.plugins property that can override the default bundled plugins.
........
  r16701 | kohsuke | 2009-03-29 15:14:38 -0700 (Sun, 29 Mar 2009) | 1 line
  
  [HUDSON-3251] (8/18) finding Maven jars through reflection for now. TODO: introduce a post-initialization hook
........
  r16702 | kohsuke | 2009-03-29 15:20:36 -0700 (Sun, 29 Mar 2009) | 2 lines
  
  [HUDSON-3251] (10/18) use lastModified to avoid unpacking bundled plugins unnecessarily.
........
  r16703 | kohsuke | 2009-03-29 15:21:15 -0700 (Sun, 29 Mar 2009) | 1 line
  
  [HUDSON-3251] (12/18) updating poms and packaging to bundle maven plugin
........
  r16704 | kohsuke | 2009-03-29 15:37:32 -0700 (Sun, 29 Mar 2009) | 1 line
  
  [HUDSON-3251] (15/18) resolve plugins from the classpath in tests. Slightly reworked.
........
  r16705 | kohsuke | 2009-03-29 15:38:12 -0700 (Sun, 29 Mar 2009) | 1 line
  
  [HUDSON-3251] (16/18) update hpi plugin version
........
  r16706 | kohsuke | 2009-03-29 15:38:54 -0700 (Sun, 29 Mar 2009) | 1 line
  
  [HUDSON-3251] (17/18) moved createExecutedMojoCache
........
  r16707 | kohsuke | 2009-03-29 15:42:38 -0700 (Sun, 29 Mar 2009) | 3 lines
  
  [HUDSON-3251] after looking at (18/18), I think the same effect can be achieved more easily by not setting this system property at all.
  
  Or am I missing something?
........
  r16708 | kohsuke | 2009-03-29 15:43:30 -0700 (Sun, 29 Mar 2009) | 1 line
  
  formatting change
........
  r16709 | kohsuke | 2009-03-29 15:58:16 -0700 (Sun, 29 Mar 2009) | 1 line
  
  [HUDSON-3251] ignore certain builders and publishers in Maven2 job type. This does the same thing as (2/18) in Tom's patch, but I believe this is better. Still needs to figure out how to do this for MavenModule, which doesn't have a descriptor.
........
  r16710 | kohsuke | 2009-03-29 16:01:00 -0700 (Sun, 29 Mar 2009) | 1 line
  
  ignore generated files
........
  r16712 | kohsuke | 2009-03-29 16:29:05 -0700 (Sun, 29 Mar 2009) | 3 lines
  
  [HUDSON-3251] revisited patch (8/18). ComputerListener is extended to support the preOnline step, so that some operations can be carried out whose failure will result in the node failing to become online.
  
  Maven-plugin uses this now to avoid the use of reflection.
........
  r16713 | kohsuke | 2009-03-29 16:38:48 -0700 (Sun, 29 Mar 2009) | 1 line
  
  switching to fork because otherwise the test fails with PermGen out of space
........
  r16714 | kohsuke | 2009-03-29 16:39:36 -0700 (Sun, 29 Mar 2009) | 1 line
  
  no, the next version is 1.295.
........


git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@16734 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
kohsuke committed 2009-03-30 21:55:33 +00:00
1 parent 5ab8fb8aec
commit a1239983e9
254 files changed
+502 -171

No files matched your search

+31 -4
View File
@@ -39,6 +39,7 @@ import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.Arrays;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -50,7 +51,6 @@ import org.apache.commons.io.FileUtils;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerResponse;
import org.kohsuke.stapler.QueryParameter;
import org.kohsuke.stapler.Stapler;
import org.kohsuke.stapler.WebApp;
/**
@@ -123,8 +123,21 @@ public final class PluginManager extends AbstractModelObject {
}
strategy = createPluginStrategy();
for( File arc : archives ) {
// load plugins from a system property, for use in the "mvn hudson-dev:run"
List<File> archivesList = new ArrayList<File>(Arrays.asList(archives));
String hplProperty = System.getProperty("hudson.bundled.plugins");
if (hplProperty != null) {
for (String hplLocation: hplProperty.split(",")) {
File hpl = new File(hplLocation.trim());
if (hpl.exists())
archivesList.add(hpl);
else
LOGGER.warning("bundled plugin " + hplLocation + " does not exist");
}
}
for( File arc : archivesList ) {
try {
PluginWrapper p = strategy.createPluginWrapper(arc);
plugins.add(p);
@@ -155,12 +168,26 @@ public final class PluginManager extends AbstractModelObject {
* If the war file has any "/WEB-INF/plugins/*.hpi", extract them into the plugin directory.
*/
private void loadBundledPlugins() {
// this is used in tests, when we want to override the default bundled plugins with .hpl versions
if (System.getProperty("hudson.bundled.plugins") != null) {
return;
}
Set paths = context.getResourcePaths("/WEB-INF/plugins");
if(paths==null) return; // crap
for( String path : (Set<String>) paths) {
String fileName = path.substring(path.lastIndexOf('/')+1);
try {
FileUtils.copyURLToFile(context.getResource(path),new File(rootDir,fileName));
URL url = context.getResource(path);
long lastModified = url.openConnection().getLastModified();
File file = new File(rootDir, fileName);
if (file.exists() && file.lastModified() != lastModified) {
FileUtils.copyURLToFile(url, file);
file.setLastModified(url.openConnection().getLastModified());
// lastModified is set for two reasons:
// - to avoid unpacking as much as possible, but still do it on both upgrade and downgrade
// - to make sure the value is not changed after each restart, so we can avoid
// unpacking the plugin itself in ClassicPluginStrategy.explode
}
} catch (IOException e) {
LOGGER.log(Level.SEVERE, "Failed to extract the bundled plugin "+fileName,e);
}