提交 b3e1c8a4 编写于 作者: K kohsuke

[FIXED HUDSON-4226] Applied the patch and added a test case. This fix will be in 1.325.

I also added subversion.hpi in the dependency of the test-harness so that we can use Subversion check out for tests. I was afraid of a circular dependency problem when building the subversion plugin, but apparently Maven handles it gracefully.

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@21999 71c3de6d-444a-0410-be80-ed276b4c234a
上级 fae44fb5
...@@ -478,7 +478,7 @@ public class MavenBuild extends AbstractMavenBuild<MavenModule,MavenBuild> { ...@@ -478,7 +478,7 @@ public class MavenBuild extends AbstractMavenBuild<MavenModule,MavenBuild> {
@Override @Override
protected Lease decideWorkspace(Node n, WorkspaceList wsl) throws InterruptedException, IOException { protected Lease decideWorkspace(Node n, WorkspaceList wsl) throws InterruptedException, IOException {
return wsl.allocate(getParentBuild().getModuleRoot().child(getProject().getRelativePath())); return wsl.allocate(getModuleSetBuild().getModuleRoot().child(getProject().getRelativePath()));
} }
protected Result doRun(BuildListener listener) throws Exception { protected Result doRun(BuildListener listener) throws Exception {
......
...@@ -42,16 +42,14 @@ THE SOFTWARE. ...@@ -42,16 +42,14 @@ THE SOFTWARE.
<plugin> <plugin>
<artifactId>maven-surefire-plugin</artifactId> <artifactId>maven-surefire-plugin</artifactId>
<configuration> <configuration>
<!-- override with -DforkMode=pertest if you have "unable to create thread problems" on Windows <!-- override with -DforkMode=pertest if you have "unable to create thread problems" on Windows -->
-->
<forkMode>once</forkMode> <forkMode>once</forkMode>
<!--<reportFormat>plain</reportFormat>--> <!--<reportFormat>plain</reportFormat>-->
<redirectTestOutputToFile>true</redirectTestOutputToFile> <redirectTestOutputToFile>true</redirectTestOutputToFile>
<argLine>-XX:MaxPermSize=128m</argLine> <argLine>-XX:MaxPermSize=128m</argLine>
<systemProperties> <systemProperties>
<property> <property>
<!-- use AntClassLoader that supports predictable file handle release <!-- use AntClassLoader that supports predictable file handle release -->
-->
<name>hudson.ClassicPluginStrategy.useAntClassLoader</name> <name>hudson.ClassicPluginStrategy.useAntClassLoader</name>
<value>true</value> <value>true</value>
</property> </property>
...@@ -109,6 +107,11 @@ THE SOFTWARE. ...@@ -109,6 +107,11 @@ THE SOFTWARE.
<artifactId>maven-plugin</artifactId> <artifactId>maven-plugin</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </dependency>
<dependency>
<groupId>org.jvnet.hudson.plugins</groupId>
<artifactId>subversion</artifactId>
<version>1.7</version>
</dependency>
<dependency> <dependency>
<groupId>org.mortbay.jetty</groupId> <groupId>org.mortbay.jetty</groupId>
<artifactId>jetty</artifactId> <artifactId>jetty</artifactId>
......
...@@ -4,6 +4,7 @@ import org.jvnet.hudson.test.HudsonTestCase; ...@@ -4,6 +4,7 @@ import org.jvnet.hudson.test.HudsonTestCase;
import org.jvnet.hudson.test.Bug; import org.jvnet.hudson.test.Bug;
import org.jvnet.hudson.test.ExtractResourceSCM; import org.jvnet.hudson.test.ExtractResourceSCM;
import hudson.Launcher; import hudson.Launcher;
import hudson.scm.SubversionSCM;
import hudson.model.BuildListener; import hudson.model.BuildListener;
import hudson.model.Result; import hudson.model.Result;
...@@ -33,7 +34,7 @@ public class MavenBuildTest extends HudsonTestCase { ...@@ -33,7 +34,7 @@ public class MavenBuildTest extends HudsonTestCase {
public void testTestFailureInEarlyTaskSegment() throws Exception { public void testTestFailureInEarlyTaskSegment() throws Exception {
configureDefaultMaven(); configureDefaultMaven();
MavenModuleSet m = createMavenProject(); MavenModuleSet m = createMavenProject();
m.setGoals("clean install findbugs:findbugs"); m.setGoals("clean install findbugs:findbugs");
m.setScm(new ExtractResourceSCM(getClass().getResource("maven-test-failure-findbugs.zip"))); m.setScm(new ExtractResourceSCM(getClass().getResource("maven-test-failure-findbugs.zip")));
assertBuildStatus(Result.UNSTABLE, m.scheduleBuild2(0).get()); assertBuildStatus(Result.UNSTABLE, m.scheduleBuild2(0).get());
} }
...@@ -44,7 +45,7 @@ public class MavenBuildTest extends HudsonTestCase { ...@@ -44,7 +45,7 @@ public class MavenBuildTest extends HudsonTestCase {
public void testCompilationFailure() throws Exception { public void testCompilationFailure() throws Exception {
configureDefaultMaven(); configureDefaultMaven();
MavenModuleSet m = createMavenProject(); MavenModuleSet m = createMavenProject();
m.setGoals("clean install"); m.setGoals("clean install");
m.setScm(new ExtractResourceSCM(getClass().getResource("maven-compilation-failure.zip"))); m.setScm(new ExtractResourceSCM(getClass().getResource("maven-compilation-failure.zip")));
assertBuildStatus(Result.FAILURE, m.scheduleBuild2(0).get()); assertBuildStatus(Result.FAILURE, m.scheduleBuild2(0).get());
} }
...@@ -57,4 +58,20 @@ public class MavenBuildTest extends HudsonTestCase { ...@@ -57,4 +58,20 @@ public class MavenBuildTest extends HudsonTestCase {
return true; return true;
} }
} }
/**
* Workspace determination problem on non-aggregator style build.
*/
@Bug(4226)
public void testParallelModuleBuild() throws Exception {
configureDefaultMaven();
MavenModuleSet m = createMavenProject();
m.setScm(new SubversionSCM("https://www.dev.java.net/svn/hudson/trunk/hudson/test-projects/multimodule-maven"));
m.setAggregatorStyleBuild(false);
assertBuildStatusSuccess(m.scheduleBuild2(0).get());
// run module builds
assertBuildStatusSuccess(m.getModule("test$module1").scheduleBuild2(0).get());
assertBuildStatusSuccess(m.getModule("test$module1").scheduleBuild2(0).get());
}
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册