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

li.rudin.mavenjs.plugin.CompileMojo Maven / Gradle / Ivy

package li.rudin.mavenjs.plugin;

import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;

import li.rudin.mavenjs.plugin.compile.CompilerVisitor;

import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugin.logging.Log;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;

/**
 * Compiles all supported files in target/classes dir
 * @author user
 *
 */
@Mojo(defaultPhase=LifecyclePhase.COMPILE, name="compile")
public class CompileMojo extends AbstractMavenjsMojo
{

	@Override
	public void execute() throws MojoExecutionException, MojoFailureException
	{

		Log logger = getLog();

		try
		{
			logger.info("Mavenjs compiling: " + project.getBuild().getOutputDirectory());
			
			//compile target/classes
			if (new File(project.getBuild().getOutputDirectory()).exists())
				Files.walkFileTree(Paths.get(project.getBuild().getOutputDirectory()), new CompilerVisitor(logger));

		}
		catch (IOException e)
		{
			logger.error(e);
			throw new MojoFailureException("optimize", e);
		}



	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy