tech_memo / Gradle


tech_memo

テストをスキップしてbuild

gradle build -x test

gradleに追加したjarをEclipseに反映

  • Eclilpseにgradleプラグインが入っていない場合は、コマンドラインからgradleコマンドでEclipseのプロジェクトを更新(再作成)する
    gradle eclipse

mavenで追加したjarをgradleのcacheに取り込む

  1. gradle --stop で Gradle のデーモンを止める
  2. .gradle ディレクトリを削除する

build.gradle

ローカルのmavenリポジトリを参照

  • mavenLocal()を追加する
    repositories {
        mavenCentral()
        mavenLocal()
    }

実行可能な JAR ファイルを作成する

依存ライブラリを含む単一で実行可能なjarを生成する

  • 参考 : http://qiita.com/mychaelstyle/items/9338f558903ac0c14bc3
  • build.gradleファイルのjarの設定に以下を加える
    from configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
  • サンプル
    jar {
      manifest {
        attributes 'Implementation-Title': 'Mychael Style Tools', 'Implementation-Version': 1.0 
        attributes "Main-Class" : "com.mychaelstyle.tools.Main"
      }
      from configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
    }

Oracle公式のMavenリポジトリを使う

Proxy設定

  • $HOME/.gradle/gradle.propertiesに設定する
    systemProp.http.proxyHost=XXX.XXX.XXX.XXX
    systemProp.http.proxyPort=8080
    systemProp.https.proxyHost=XXX.XXX.XXX.XXX
    systemProp.https.proxyPort=8080
    // systemProp.https.proxyUser=****
    // systemProp.https.proxyPassword=****

最新の20件

2023-01-26 2022-11-11 2022-03-02 2022-02-03 2021-11-18 2021-11-11 2021-10-27 2021-10-04 2021-09-30 2021-08-24 2021-04-01 2021-02-25 2020-08-13 2020-05-22 2020-04-16 2020-04-15 2020-03-23 2020-03-12 2020-02-27

今日の1件

  • tech_memo/Gradle(1)

  • counter: 415
  • today: 1
  • yesterday: 0
  • online: 1