LoginSignup
1
0

More than 5 years have passed since last update.

pom.xmlから必要な情報を抜き出す

Posted at

以下のコマンドを実行するとguice-3.0.pomから「groupId:artifactId:version」を表示する

mvn -f guice-3.0.pom -q '-Dexec.executable=echo' '-Dexec.args=${project.groupId}:${project.artifactId}:${project.version}' --non-recursive org.codehaus.mojo:exec-maven-plugin:1.6.0:exec

exec.argsに渡す文字列を変更すれば出力する内容は自由に変更可能。
参考: https://stackoverflow.com/a/39665194

以下のように取得することもできるが複数のパラメータをまとめてとることはできない模様。

mvn org.apache.maven.plugins:maven-help-plugin:3.1.0:evaluate "-Dexpression=project.version" -q -DforceStdout

参考: https://stackoverflow.com/a/3545363

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0