35
33

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

mavenでdependencyを自動的に更新

Last updated at Posted at 2012-11-20

versionsプラグインを使うと簡単にチェックすることができます。
http://mojo.codehaus.org/versions-maven-plugin/

まず、プロジェクトのpom.xmlに以下を追記します。

pom.xml
<pluginManagement>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>versions-maven-plugin</artifactId>
        <version>1.3.1</version>
      </plugin>
    </plugins>
  </pluginMangement>

この状態で、以下のコマンドを実行すれば、pom.xmlを勝手に最新のライブラリバージョンが入ったものに更新してくれます。

$ mvn versions:use-latest-versions

勝手に更新されては困るという場合は、更新があるかどうかの確認だけをすることもできます。

$ mvn versions:display-dependency-updates
…(省略)[INFO] The following dependencies in Dependencies are using the newest version:
[INFO]   com.google.code.findbugs:jsr305 ................................ 2.0.1
[INFO]   com.google.guava:guava ........................................ 13.0.1
[INFO]   commons-codec:commons-codec ...................................... 1.7
[INFO]   org.apache.commons:commons-lang3 ................................. 3.1
[INFO] 
[INFO] The following dependencies in Dependencies have newer versions:
[INFO]   junit:junit ............................................. 4.10 -> 4.11
[INFO]   org.apache.httpcomponents:httpclient .................. 4.1.3 -> 4.2.2
[INFO]   org.codehaus.jackson:jackson-core-asl ................ 1.9.5 -> 1.9.11
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 15.768s
[INFO] Finished at: Sat Nov 17 15:08:50 JST 2012
[INFO] Final Memory: 9M/148M
[INFO] ------------------------------------------------------------------------

依存するライブラリが多いと数分以上かかる事もあるのでご注意を。

35
33
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
35
33

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?