org.efaps.maven.plugin.CompileMojo Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of efaps-maven-plugin Show documentation
Show all versions of efaps-maven-plugin Show documentation
eFaps Maven Plug-In to install / deploy eFaps applications and create CI/Jms Classes.
/*
* Copyright 2003 - 2012 The eFaps Team
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Revision: $Rev: 7497 $
* Last Changed: $Date: 2012-05-11 12:49:11 -0500 (Fri, 11 May 2012) $
* Last Changed By: $Author: [email protected] $
*/
package org.efaps.maven.plugin;
import org.efaps.update.schema.program.esjp.ESJPCompiler;
import org.efaps.update.schema.program.jasperreport.JasperReportCompiler;
import org.efaps.update.schema.program.staticsource.CSSCompiler;
import org.efaps.update.schema.program.staticsource.JavaScriptCompiler;
import org.efaps.update.schema.program.staticsource.WikiCompiler;
import org.efaps.update.util.InstallationException;
import org.efaps.update.version.Application;
import org.efaps.util.EFapsException;
import org.jfrog.maven.annomojo.annotations.MojoGoal;
import org.jfrog.maven.annomojo.annotations.MojoParameter;
import org.jfrog.maven.annomojo.annotations.MojoRequiresDependencyResolution;
/**
* Compiles all ESPJ's and Cascade Style Sheets within eFaps.
*
* @author The eFaps Team
* @version $Id: CompileMojo.java 7497 2012-05-11 17:49:11Z [email protected] $
*/
@MojoGoal(value = "compile")
@MojoRequiresDependencyResolution
public final class CompileMojo
extends EFapsAbstractMojo
{
/**
* Number of UUID's to generate.
*/
@MojoParameter(expression = "${target}", defaultValue = "all")
private String target;
/**
* Executes the compile goal.
*/
public void execute()
{
init(true);
boolean abort = true;
try {
if ("all".equalsIgnoreCase(this.target)) {
getLog().info("==Compiling all Elements==");
Application.compileAll(getUserName(), getClasspathElements(), true);
} else {
reloadCache();
startTransaction();
if ("java".equalsIgnoreCase(this.target)) {
getLog().info("==Compiling Java==");
(new ESJPCompiler(getClasspathElements())).compile(null, true);
} else if ("css".equalsIgnoreCase(this.target)) {
getLog().info("==Compiling CSS==");
new CSSCompiler().compile();
} else if ("js".equalsIgnoreCase(this.target)) {
getLog().info("==Compiling Javascript==");
new JavaScriptCompiler().compile();
} else if ("wiki".equalsIgnoreCase(this.target)) {
getLog().info("==Compiling Wiki==");
new WikiCompiler().compile();
} else if ("jasper".equalsIgnoreCase(this.target)) {
getLog().info("==Compiling JasperReports==");
new JasperReportCompiler(getClasspathElements()).compile();
} else {
getLog().error("target: " + this.target + "' not found");
}
commitTransaction();
}
abort = false;
} catch (final InstallationException e) {
getLog().error(e);
} catch (final EFapsException e) {
getLog().error(e);
} finally {
try {
if (abort) {
abortTransaction();
}
} catch (final EFapsException e) {
getLog().error(e);
}
}
}
}