All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.jlgrock.javascriptframework.jsdocs.JsTestDocsJsarMojo Maven / Gradle / Ivy

package com.github.jlgrock.javascriptframework.jsdocs;

import java.io.File;
import java.util.List;
import java.util.Set;

import org.apache.log4j.Logger;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;

import com.github.jlgrock.javascriptframework.mavenutils.logging.MojoLogAppender;

/**
 * Generates javascript docs from the jsdoc-toolkit (the final version) and
 * stores them into a js archive.
 * 
 * @goal test-jsar
 * @phase package
 */
public class JsTestDocsJsarMojo extends AbstractJsDocsNonAggMojo {
	/**
	 * The Logger.
	 */
	private static final Logger LOGGER = Logger
			.getLogger(JsTestDocsJsarMojo.class);
	
	/**
	 * Specifies the destination directory where javadoc saves the generated
	 * HTML files. 
* See d.
* * @parameter expression="${destDir}" * default-value="${project.build.directory}/testapidocs" * @required */ private File outputDirectory; @Override public final File getOutputDirectory() { return outputDirectory; } /** * Specifies the directory to archive. * * @parameter default-value="${project.build.directory" */ private File jsarOutputDirectory; @Override public final File getArchiveOutputDirectory() { return jsarOutputDirectory; } @Override public final void execute() throws MojoExecutionException, MojoFailureException { LOGGER.debug("starting report execution..."); MojoLogAppender.beginLogging(this); try { ReportGenerator.extractJSDocToolkit(getToolkitExtractDirectory()); Set sourceFiles = getSourceFiles(); List args = createArgumentStack(sourceFiles); ReportGenerator.executeJSDocToolkit(getJsDocAppLocation(), args, getToolkitExtractDirectory()); File innerDestDir = getArchiveOutputDirectory(); String destFileName = getFinalName() + "-" + getClassifier() + getExtensionFormat(); File destFile = null; if (innerDestDir.exists()) { destFile = AbstractJsDocsMojo.generateArchive(this, innerDestDir, destFileName); } getProjectHelper().attachArtifact(getProject(), getExtensionFormat(), getClassifier(), destFile); } catch (Exception e) { LOGGER.error("There was an error in the execution of the report: " + e.getMessage(), e); throw new MojoExecutionException(e.getMessage(), e); } finally { MojoLogAppender.endLogging(); } } @Override public final String getClassifier() { return "test-jsdocs"; } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy