提交 5f53febe 编写于 作者: C Christoph Kutzinski

[FIXED JENKINS-7577] NPE in site generation when building a single Maven module

上级 9cdd9cc0
......@@ -65,6 +65,9 @@ Upcoming changes</a>
(<a href="https://github.com/jenkinsci/jenkins/pull/151">pull request #151</a>)
<li class=bug>
If the user tries to run Jenkins on Java 1.4 and earlier, detect that more gracefully.
<li class=bug>
Fixed NPE in site generation when building a single Maven module
(<a href="http://issues.jenkins-ci.org/browse/JENKINS-7577">issue 7577</a>)
<li class=rfe>
AJP port is customizable in RPM/OpenSUSE packages
(<a href="https://github.com/jenkinsci/jenkins/pull/149">pull request #149</a>)
......
......@@ -30,6 +30,7 @@ import hudson.maven.MavenBuild;
import hudson.maven.MavenBuildProxy;
import hudson.maven.MavenModule;
import hudson.maven.MavenModuleSet;
import hudson.maven.MavenModuleSetBuild;
import hudson.maven.MavenReporter;
import hudson.maven.MavenReporterDescriptor;
import hudson.maven.MojoInfo;
......@@ -99,19 +100,21 @@ public class MavenSiteArchiver extends MavenReporter {
*
* @return the relative path component to copy sites of multi module builds.
* @throws IOException
* @throws InterruptedException
*/
private String getModuleName(MavenBuildProxy build, MavenProject pom) throws IOException {
final String moduleRoot;
try {
moduleRoot = build.execute(new BuildCallable<String, IOException>() {
private String getModuleName(MavenBuildProxy build, MavenProject pom) throws IOException, InterruptedException {
String moduleRoot = build.execute(new BuildCallable<String, IOException>() {
private static final long serialVersionUID = 1L;
//@Override
public String call(MavenBuild mavenBuild) throws IOException, InterruptedException {
return mavenBuild.getParentBuild().getModuleRoot().getRemote();
MavenModuleSetBuild moduleSetBuild = mavenBuild.getModuleSetBuild();
if (moduleSetBuild == null) {
throw new IOException("Parent build not found!");
}
});
} catch (InterruptedException e) {
throw new RuntimeException(e);
return moduleSetBuild.getModuleRoot().getRemote();
}
});
final File pomBaseDir = pom.getBasedir();
final File remoteWorkspaceDir = new File(moduleRoot);
if (pomBaseDir.equals(remoteWorkspaceDir)) {
......
......@@ -23,13 +23,16 @@
*/
package hudson.maven;
import com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException;
import hudson.tasks.Maven.MavenInstallation;
import java.io.File;
import org.junit.Assert;
import org.jvnet.hudson.test.Bug;
import org.jvnet.hudson.test.ExtractResourceSCM;
import org.jvnet.hudson.test.HudsonTestCase;
import java.io.File;
import com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException;
/**
* @author huybrechts
......@@ -99,6 +102,12 @@ public class MavenProjectTest extends HudsonTestCase {
wc.getPage(project, "site");
wc.getPage(project, "site/core");
wc.getPage(project, "site/client");
//@Bug(7577): check that site generation succeeds also if only a single module is build
MavenModule coreModule = project.getModule("mmtest:core");
Assert.assertEquals("site", coreModule.getGoals());
buildAndAssertSuccess(coreModule);
wc.getPage(project, "site/core");
}
/**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册