Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package apparat.embedding.maven;
 
 
 import java.io.File;

Author(s):
Joa Ebert
abstract class AbstractApparatMojo extends AbstractMojo {
The Maven project.

Parameter:
default-value="null" expression="${project}"
	protected MavenProject project;

Additional override for the target file if it is not the default artifact of your project.

Parameter:
expression="${apparat.overrideArtifact}"
	protected File overrideArtifact;

Whether or not to fail if the overrideArtifact is missing.

Parameter:
default-value="true" expression="${apparat.failIfOverrideIsMissing}"
	protected boolean failIfOverrideIsMissing;

		final MavenLogAdapter logAdapter = new MavenLogAdapter(getLog());
		try {
			apparat.log.Log.setLevel(logAdapter.getLevel());
			apparat.log.Log.addOutput(logAdapter);
			if(null == ) {
				if(null != ) {
					for(final Artifact artifact : .getAttachedArtifacts()) {
						processArtifact(artifact);
					}
				}
else {
						throw new MojoFailureException("File "++" does not exist.");
else {
						getLog().warn("Override "++" is missing.");
						return;
					}
				}
				try {
catch(final Throwable cause) {
					throw new MojoExecutionException("Apparat execution failed."cause);
				}
			}
finally {
			apparat.log.Log.removeOutput(logAdapter);
		}
	}
	private void processArtifact(final Artifact artifactthrows MojoExecutionExceptionMojoFailureException {
		if(null == artifact) {
			return;
		}
		final String artifactType = artifact.getType();
		if(artifactType.equals("swc") || artifactType.equals("swf")) {
			try {
				if(null != artifact.getFile()) {
					processFile(artifact.getFile());
				}
catch(final Throwable cause) {
				throw new MojoExecutionException("Apparat execution failed."cause);
			}
else {
			getLog().debug("Skipped artifact since its type is "+artifactType+".");
		}
	}
	abstract protected void processFile(final File filethrows MojoExecutionExceptionMojoFailureException;
New to GrepCode? Check out our FAQ X