mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-16 21:42:27 +00:00
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:
1 parent
5ab8fb8aec
commit
a1239983e9
254 files changed
+502
-171
No files matched your search
@@ -30,6 +30,7 @@ import hudson.WebAppMain;
|
||||
import hudson.EnvVars;
|
||||
import hudson.ExtensionList;
|
||||
import hudson.DescriptorExtensionList;
|
||||
import hudson.remoting.Which;
|
||||
import hudson.Launcher.LocalLauncher;
|
||||
import hudson.matrix.MatrixProject;
|
||||
import hudson.matrix.MatrixBuild;
|
||||
@@ -93,6 +94,9 @@ import junit.framework.TestCase;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
import org.apache.maven.artifact.resolver.ArtifactResolutionException;
|
||||
import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
|
||||
import org.apache.maven.artifact.resolver.AbstractArtifactResolutionException;
|
||||
import org.jvnet.hudson.test.HudsonHomeLoader.CopyExisting;
|
||||
import org.jvnet.hudson.test.recipes.Recipe;
|
||||
import org.jvnet.hudson.test.recipes.Recipe.Runner;
|
||||
@@ -113,6 +117,7 @@ import org.w3c.css.sac.CSSException;
|
||||
import org.w3c.css.sac.CSSParseException;
|
||||
import org.w3c.css.sac.ErrorHandler;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
|
||||
|
||||
import com.gargoylesoftware.htmlunit.AjaxController;
|
||||
import com.gargoylesoftware.htmlunit.BrowserVersion;
|
||||
@@ -184,6 +189,7 @@ public abstract class HudsonTestCase extends TestCase {
|
||||
env.pin();
|
||||
recipe();
|
||||
AbstractProject.WORKSPACE.toString();
|
||||
|
||||
hudson = newHudson();
|
||||
hudson.setNoUsageStatistics(true); // collecting usage stats from tests are pointless.
|
||||
hudson.servletContext.setAttribute("app",hudson);
|
||||
@@ -606,6 +612,11 @@ public abstract class HudsonTestCase extends TestCase {
|
||||
// make dependency plugins available
|
||||
// TODO: probably better to read POM, but where to read from?
|
||||
// TODO: this doesn't handle transitive dependencies
|
||||
|
||||
// Tom: plugins are now searched on the classpath first. They should be available on
|
||||
// the compile or test classpath. As a backup, we do a best-effort lookup in the Maven repository
|
||||
// For transitive dependencies, we could evaluate Plugin-Dependencies transitively.
|
||||
|
||||
String dependencies = m.getMainAttributes().getValue("Plugin-Dependencies");
|
||||
if(dependencies!=null) {
|
||||
MavenEmbedder embedder = new MavenEmbedder(null);
|
||||
@@ -613,11 +624,40 @@ public abstract class HudsonTestCase extends TestCase {
|
||||
embedder.start();
|
||||
for( String dep : dependencies.split(",")) {
|
||||
String[] tokens = dep.split(":");
|
||||
Artifact a = embedder.createArtifact("org.jvnet.hudson.plugins", tokens[0], tokens[1], "compile"/*doesn't matter*/, "hpi");
|
||||
embedder.resolve(a, Arrays.asList(embedder.createRepository("http://maven.glassfish.org/content/groups/public/","repo")),embedder.getLocalRepository());
|
||||
File dst = new File(home, "plugins/" + tokens[0] + ".hpi");
|
||||
if(!dst.exists() || dst.lastModified()!=a.getFile().lastModified())
|
||||
FileUtils.copyFile(a.getFile(), dst);
|
||||
String artifactId = tokens[0];
|
||||
String version = tokens[1];
|
||||
File dependencyJar=null;
|
||||
// need to search multiple group IDs
|
||||
// TODO: extend manifest to include groupID:artifactID:version
|
||||
Exception resolutionError=null;
|
||||
for (String groupId : new String[]{"org.jvnet.hudson.plugins","org.jvnet.hudson.main"}) {
|
||||
|
||||
// first try to find it on the classpath.
|
||||
// this takes advantage of Maven POM located in POM
|
||||
URL dependencyPomResource = getClass().getResource("/META-INF/maven/"+groupId+"/"+artifactId+"/pom.xml");
|
||||
if (dependencyPomResource != null) {
|
||||
// found it
|
||||
dependencyJar = Which.jarFile(dependencyPomResource);
|
||||
break;
|
||||
} else {
|
||||
Artifact a;
|
||||
a = embedder.createArtifact(groupId, artifactId, version, "compile"/*doesn't matter*/, "hpi");
|
||||
try {
|
||||
embedder.resolve(a, Arrays.asList(embedder.createRepository("http://maven.glassfish.org/content/groups/public/","repo")),embedder.getLocalRepository());
|
||||
dependencyJar = a.getFile();
|
||||
} catch (AbstractArtifactResolutionException x) {
|
||||
// could be a wrong groupId
|
||||
resolutionError = x;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(dependencyJar==null)
|
||||
throw new Exception("Failed to resolve plugin: "+dep,resolutionError);
|
||||
|
||||
File dst = new File(home, "plugins/" + artifactId + ".hpi");
|
||||
if(!dst.exists() || dst.lastModified()!=dependencyJar.lastModified()) {
|
||||
FileUtils.copyFile(dependencyJar, dst);
|
||||
}
|
||||
}
|
||||
embedder.stop();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user