org.watertemplate.i18n.GenerationMojo Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of watertemplate-i18n-maven-plugin Show documentation
Show all versions of watertemplate-i18n-maven-plugin Show documentation
Maven plugin that internationalizes your template files
package org.watertemplate.i18n;
import org.watertemplate.i18n.developer.DirectoryWatcher;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
@Mojo(name = "generate", defaultPhase = LifecyclePhase.PROCESS_RESOURCES)
public class GenerationMojo extends AbstractMojo {
@Parameter(name = "baseDir", required = true)
private String baseDir;
@Parameter(name = "destinationDir", required = true)
private String destinationDir;
@Parameter(name = "bundlesDir", required = true)
private String bundlesDir;
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
try {
Internationalization internationalization = new Internationalization(baseDir, destinationDir, bundlesDir);
internationalization.parse();
if (System.getProperty("dev-mode") != null) {
DirectoryWatcher directoryWatcher = new DirectoryWatcher(baseDir, bundlesDir);
directoryWatcher.watchRunning(internationalization::parse);
}
} catch (Exception e) {
throw new MojoExecutionException("Error in i18n plugin.", e);
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy