diff --git a/core/pom.xml b/core/pom.xml index b51244ec27..96eebe98a3 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -471,7 +471,6 @@ THE SOFTWARE. commons-io commons-io - 1.4 commons-lang diff --git a/maven-plugin/pom.xml b/maven-plugin/pom.xml index e9ec5a42c2..36d2f49396 100644 --- a/maven-plugin/pom.xml +++ b/maven-plugin/pom.xml @@ -182,7 +182,11 @@ THE SOFTWARE. org.jvnet.hudson hudson-maven-artifact-manager 1.0 - + + + commons-io + commons-io + org.jvnet.hudson hudson-maven-embedder diff --git a/maven-plugin/src/main/java/hudson/maven/MavenModule.java b/maven-plugin/src/main/java/hudson/maven/MavenModule.java index 95b7e1e0c2..59de43e742 100644 --- a/maven-plugin/src/main/java/hudson/maven/MavenModule.java +++ b/maven-plugin/src/main/java/hudson/maven/MavenModule.java @@ -88,6 +88,9 @@ public final class MavenModule extends AbstractMavenProjectant 1.8.0 + + + commons-io + commons-io + 2.0.1 + + junit junit diff --git a/test/src/test/java/hudson/maven/MavenMultiModuleTest.java b/test/src/test/java/hudson/maven/MavenMultiModuleTest.java index 7b65f4106c..29a0680840 100644 --- a/test/src/test/java/hudson/maven/MavenMultiModuleTest.java +++ b/test/src/test/java/hudson/maven/MavenMultiModuleTest.java @@ -110,49 +110,7 @@ public class MavenMultiModuleTest extends HudsonTestCase { pBuild.getDuration() >= summedModuleDuration); } - @Bug(7684) - public void testRelRootPom() throws Exception { - configureDefaultMaven("apache-maven-2.2.1", MavenInstallation.MAVEN_21); - MavenModuleSet m = createMavenProject(); - m.setRootPOM("../parent/pom.xml"); - m.getReporters().add(new TestReporter()); - m.setScm(new ExtractResourceWithChangesSCM(getClass().getResource("maven-multimod-rel-base.zip"), - getClass().getResource("maven-multimod-changes.zip"), - "moduleA")); - buildAndAssertSuccess(m); - - // Now run a second build with the changes. - m.setIncrementalBuild(true); - buildAndAssertSuccess(m); - - MavenModuleSetBuild pBuild = m.getLastBuild(); - ExtractChangeLogSet changeSet = (ExtractChangeLogSet) pBuild.getChangeSet(); - - assertFalse("ExtractChangeLogSet should not be empty.", changeSet.isEmptySet()); - - for (MavenBuild modBuild : pBuild.getModuleLastBuilds().values()) { - String parentModuleName = modBuild.getParent().getModuleName().toString(); - if (parentModuleName.equals("org.jvnet.hudson.main.test.multimod:moduleA")) { - assertEquals("moduleA should have Result.NOT_BUILT", Result.NOT_BUILT, modBuild.getResult()); - } - else if (parentModuleName.equals("org.jvnet.hudson.main.test.multimod:moduleB")) { - assertEquals("moduleB should have Result.SUCCESS", Result.SUCCESS, modBuild.getResult()); - } - else if (parentModuleName.equals("org.jvnet.hudson.main.test.multimod:moduleC")) { - assertEquals("moduleC should have Result.SUCCESS", Result.SUCCESS, modBuild.getResult()); - } - } - - long summedModuleDuration = 0; - for (MavenBuild modBuild : pBuild.getModuleLastBuilds().values()) { - summedModuleDuration += modBuild.getDuration(); - } - assertTrue("duration of moduleset build should be greater-equal than sum of the module builds", - pBuild.getDuration() >= summedModuleDuration); - } - - @Bug(6544) public void testEstimatedDurationForIncrementalMultiModMaven() throws Exception { diff --git a/test/src/test/java/hudson/maven/MavenMultiModuleTestIncremental.java b/test/src/test/java/hudson/maven/MavenMultiModuleTestIncremental.java new file mode 100755 index 0000000000..8c468d941b --- /dev/null +++ b/test/src/test/java/hudson/maven/MavenMultiModuleTestIncremental.java @@ -0,0 +1,69 @@ +package hudson.maven; + +import hudson.Launcher; +import hudson.model.BuildListener; +import hudson.model.Result; +import hudson.tasks.Maven.MavenInstallation; + +import java.io.IOException; + +import org.jvnet.hudson.test.Bug; +import org.jvnet.hudson.test.ExtractChangeLogSet; +import org.jvnet.hudson.test.ExtractResourceWithChangesSCM; +import org.jvnet.hudson.test.HudsonTestCase; + +/** + * @author Andrew Bayer + */ +public class MavenMultiModuleTestIncremental extends HudsonTestCase { + + @Bug(7684) + public void testRelRootPom() throws Exception { + configureDefaultMaven("apache-maven-2.2.1", MavenInstallation.MAVEN_21); + MavenModuleSet m = createMavenProject(); + m.setRootPOM("parent/pom.xml"); + m.getReporters().add(new TestReporter()); + m.setScm(new ExtractResourceWithChangesSCM(getClass().getResource("maven-multimod-rel-base.zip"), + getClass().getResource("maven-multimod-changes.zip"))); + + buildAndAssertSuccess(m); + + // Now run a second build with the changes. + m.setIncrementalBuild(true); + buildAndAssertSuccess(m); + + MavenModuleSetBuild pBuild = m.getLastBuild(); + ExtractChangeLogSet changeSet = (ExtractChangeLogSet) pBuild.getChangeSet(); + + assertFalse("ExtractChangeLogSet should not be empty.", changeSet.isEmptySet()); + + for (MavenBuild modBuild : pBuild.getModuleLastBuilds().values()) { + String parentModuleName = modBuild.getParent().getModuleName().toString(); + if (parentModuleName.equals("org.jvnet.hudson.main.test.multimod:moduleA")) { + assertEquals("moduleA should have Result.NOT_BUILT", Result.NOT_BUILT, modBuild.getResult()); + } + else if (parentModuleName.equals("org.jvnet.hudson.main.test.multimod:moduleB")) { + assertEquals("moduleB should have Result.SUCCESS", Result.SUCCESS, modBuild.getResult()); + } + else if (parentModuleName.equals("org.jvnet.hudson.main.test.multimod:moduleC")) { + assertEquals("moduleC should have Result.SUCCESS", Result.SUCCESS, modBuild.getResult()); + } + } + + long summedModuleDuration = 0; + for (MavenBuild modBuild : pBuild.getModuleLastBuilds().values()) { + summedModuleDuration += modBuild.getDuration(); + } + assertTrue("duration of moduleset build should be greater-equal than sum of the module builds", + pBuild.getDuration() >= summedModuleDuration); + } + + private static class TestReporter extends MavenReporter { + @Override + public boolean end(MavenBuild build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException { + assertNotNull(build.getProject().getWorkspace()); + assertNotNull(build.getWorkspace()); + return true; + } + } +}