Mojoを作成する
import java.io.File;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugins.annotations.Execute;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
@Mojo(
name = "sample",
threadSafe = true,
defaultPhase = LifecyclePhase.COMPILE
)
public class SampleMojo extends AbstractMojo {
@Parameter(
property = "project.build.directory",
required = true
)
private File outputDirectory;
@Override
public void execute() throws MojoExecutionException {
getLog().info("sample plugin start!");
getLog().debug("project.build.directory is " + outputDirectory.getAbsolutePath());
}
}呼び出されるメソッドを実装する
実行するフェーズを指定する
設定を作成する
ログを出力する
マルチスレッド対応の明示
動作確認
Last updated