public FilePath getModuleSetRootDir() { return core.getModuleSetRootDir(); }
public FilePath getModuleSetRootDir() { return core.getModuleSetRootDir(); }
/** * In multi module builds, ascend to the parents until hitting the project * root. * * @param build * @param pom * * @return the relative path component to copy sites of multi module builds. * @throws IOException * @throws InterruptedException */ private FilePath getModulePath(MavenBuildProxy build, MavenProject pom) throws IOException, InterruptedException { String rootArtifactId = build.execute(new MavenSiteArchiverBuildCallable()); String path = ""; MavenProject currentLevel = pom; // build the path to the module by ascending to the parent pom until the root project while (!rootArtifactId.equals(currentLevel.getArtifactId())) { path = currentLevel.getArtifactId() + File.separator + path; currentLevel = currentLevel.getParent(); } return build.getModuleSetRootDir().child("site").child(path); }
public boolean postExecute(MavenBuildProxy build, MavenProject pom, MojoInfo mojo, BuildListener listener, Throwable error) throws InterruptedException, IOException { if(!mojo.is("org.apache.maven.plugins","maven-site-plugin","site")) return true; File destDir; try { destDir = mojo.getConfigurationValue("outputDirectory", File.class); } catch (ComponentConfigurationException e) { e.printStackTrace(listener.fatalError("Unable to find the site output directory")); build.setResult(Result.FAILURE); return true; } if(destDir.exists()) { // try to get the storage location if this is a multi-module project. final String moduleName = getModuleName(build, pom); // store at MavenModuleSet level and moduleName final FilePath target = build.getModuleSetRootDir().child("site").child(moduleName); try { listener.getLogger().printf("[HUDSON] Archiving site from %s to %s\n", destDir, target); new FilePath(destDir).copyRecursiveTo("**/*",target); } catch (IOException e) { Util.displayIOException(e,listener); e.printStackTrace(listener.fatalError("Unable to copy site from %s to %s",destDir,target)); build.setResult(Result.FAILURE); } build.registerAsAggregatedProjectAction(this); } return true; }
target = build.getModuleSetRootDir(); } else {
target = build.getModuleSetRootDir(); } else { listener.getLogger().println("[HUDSON] Archiving javadoc");