Mavenコア側で定義されているフェーズの実際の処理をプラグイン側で記述したものがゴール。
フェーズとゴールのマッピングは、packaging要素によって決まる。
フェーズを積み重ねた物がビルドライフサイクルで、デフォルト、クリーン、サイトの3種類のみ。
■代表的なフェーズ
compile
test
package
install
deploy
site
site-deploy
clean
■代表的なプラグインとゴール名
maven-resources-plugin resorces,testResources
maven-compiler-plugin compile,testCompile
maven-surefire-plugin test
maven-jar-plugin jar
maven-install-plugin install
maven-deploy-plugin deploy
■ゴール実行時の書式
$ mvn グループID:アーティファクトID:バージョン:ゴール名 $ mvn com.example:maven-hoge-plugin:1.0:samplegoal バージョンは省略できるので下記でもOK $ mvn グループID:アーティファクトID:ゴール名 $ mvn com.example:maven-hoge-plugin:samplegoal プラグインのグループIDがorg.apache.maven.pluginsで、プラグインのアーティファクトIDがmaven-xxxx-pluginだったら下記形式での省略もできる $ mvn xxxx:ゴール名 $ mvn xxxx:samplegoal
■mvnコマンドの書式
$ mvn オプション(複数指定可) フェーズ or ゴール(複数指定可) $ mvn -X compile war:war
コメントを残す