/** Test copying all artifacts from a maven job */ public void testMavenAll() throws Exception { MavenModuleSet mp = setupMavenJob(); assertBuildStatusSuccess(mp.scheduleBuild2(0, new UserCause()).get()); FreeStyleProject p = createProject(mp.getName(), "", "", true, false, false); FreeStyleBuild b = p.scheduleBuild2(0, new UserCause()).get(); String dir = "org.jvnet.hudson.main.test.multimod/"; assertFile(true, dir + "moduleA/1.0-SNAPSHOT/moduleA-1.0-SNAPSHOT.jar", b); assertFile(true, dir + "moduleA/1.0-SNAPSHOT/pom.xml", b); assertFile(true, dir + "moduleB/1.0-SNAPSHOT/moduleB-1.0-SNAPSHOT.jar", b); assertFile(true, dir + "moduleB/1.0-SNAPSHOT/pom.xml", b); assertFile(true, dir + "moduleC/1.0-SNAPSHOT/moduleC-1.0-SNAPSHOT.jar", b); assertFile(true, dir + "moduleC/1.0-SNAPSHOT/pom.xml", b); // Test with filter p = createProject(mp.getName(), "**/*.jar", "", true, false, false); b = p.scheduleBuild2(0, new UserCause()).get(); assertFile(true, dir + "moduleA/1.0-SNAPSHOT/moduleA-1.0-SNAPSHOT.jar", b); assertFile(false, dir + "moduleA/1.0-SNAPSHOT/pom.xml", b); assertFile(true, dir + "moduleB/1.0-SNAPSHOT/moduleB-1.0-SNAPSHOT.jar", b); assertFile(false, dir + "moduleB/1.0-SNAPSHOT/pom.xml", b); assertFile(true, dir + "moduleC/1.0-SNAPSHOT/moduleC-1.0-SNAPSHOT.jar", b); assertFile(false, dir + "moduleC/1.0-SNAPSHOT/pom.xml", b); }
/** Test copying from maven job where artifacts manually archived instead of automatic */ public void testMavenJobWithArchivePostBuildStep() throws Exception { MavenModuleSet mp = setupMavenJob(); // Turn off automatic archiving and use a post-build step instead. // Artifacts will be stored with the parent build instead of the child module builds. mp.setIsArchivingDisabled(true); mp.getPublishersList().add(new ArtifactArchiver("moduleB/*.xml", "", false)); assertBuildStatusSuccess(mp.scheduleBuild2(0, new UserCause()).get()); FreeStyleProject p = createProject(mp.getName(), "", "", true, false, false); FreeStyleBuild b = p.scheduleBuild2(0, new UserCause()).get(); // Archived artifact should be copied: assertFile(true, "moduleB/pom.xml", b); // None of the maven artifacts should be archived or copied: String dir = "org.jvnet.hudson.main.test.multimod/"; assertFile(false, dir + "moduleA/1.0-SNAPSHOT/moduleA-1.0-SNAPSHOT.jar", b); assertFile(false, dir + "moduleA/1.0-SNAPSHOT/pom.xml", b); assertFile(false, dir + "moduleB/1.0-SNAPSHOT/moduleB-1.0-SNAPSHOT.jar", b); assertFile(false, dir + "moduleB/1.0-SNAPSHOT/pom.xml", b); assertFile(false, dir + "moduleC/1.0-SNAPSHOT/moduleC-1.0-SNAPSHOT.jar", b); assertFile(false, dir + "moduleC/1.0-SNAPSHOT/pom.xml", b); }