2016/07/29

GradleとEclipseについてのメモ1(Eclipseプロジェクト作成まで)

cd /d D:\programming\gradle-2.14.1

gradle wrapper

mkdir D:\programming\gradle-pj
cd /d D:\programming\gradle-pj

set PATH=%PATH%;D:\programming\gradle-2.14.1\bin
gradle --version

------------------------------------------------------------
Gradle 2.14.1
------------------------------------------------------------

Build time:   2016-07-18 06:38:37 UTC
Revision:     d9e2113d9fb05a5caabba61798bdb8dfdca83719

Groovy:       2.4.4
Ant:          Apache Ant(TM) version 1.9.6 compiled on June 29 2015
JVM:          1.8.0_05 (Oracle Corporation 25.5-b02)
OS:           Windows 8.1 6.3 amd64

gradle wrapper

:wrapper

BUILD SUCCESSFUL

Total time: 6.13 secs

D:\programming\gradle-pj>tree /F
フォルダー パスの一覧:  ボリューム ボリューム
ボリューム シリアル番号は 4C2A-94B2 です
D:.
│  gradlew
│  gradlew.bat

├─.gradle
│  └─2.14.1
│      └─taskArtifacts
│              cache.properties
│              cache.properties.lock
│              fileHashes.bin
│              fileSnapshots.bin
│              fileSnapshotsToTreeSnapshotsIndex.bin
│              taskArtifacts.bin

└─gradle
    └─wrapper
            gradle-wrapper.jar
            gradle-wrapper.properties

D:\programming\gradle-pj>gradle init --type java-library
:wrapper UP-TO-DATE
:init

BUILD SUCCESSFUL

Total time: 2.943 secs
D:\programming\gradle-pj>tree /F
フォルダー パスの一覧:  ボリューム ボリューム
ボリューム シリアル番号は 4C2A-94B2 です
D:.
│  build.gradle
│  gradlew
│  gradlew.bat
│  settings.gradle

├─.gradle
│  └─2.14.1
│      └─taskArtifacts
│              cache.properties
│              cache.properties.lock
│              fileHashes.bin
│              fileSnapshots.bin
│              fileSnapshotsToTreeSnapshotsIndex.bin
│              taskArtifacts.bin

├─gradle
│  └─wrapper
│          gradle-wrapper.jar
│          gradle-wrapper.properties

└─src
    ├─main
    │  └─java
    │          Library.java
    │
    └─test
        └─java
                LibraryTest.java

●build.gradle

apply plugin: 'java'
repositories {
    jcenter()
}

dependencies {
    compile 'org.slf4j:slf4j-api:1.7.21'
    testCompile 'junit:junit:4.12'
}

●settings.gradle

rootProject.name = 'gradle-pj'


build.gradleに以下を追加
apply plugin: 'eclipse'

D:\programming\gradle-pj>gradle eclipse
:eclipseClasspath
Download https://jcenter.bintray.com/org/slf4j/slf4j-api/1.7.21/slf4j-api-1.7.21.pom
Download https://jcenter.bintray.com/org/slf4j/slf4j-parent/1.7.21/slf4j-parent-1.7.21.pom
Download https://jcenter.bintray.com/org/slf4j/slf4j-api/1.7.21/slf4j-api-1.7.21.jar
Download https://jcenter.bintray.com/org/slf4j/slf4j-api/1.7.21/slf4j-api-1.7.21-sources.jar
:eclipseJdt
:eclipseProject
:eclipse

BUILD SUCCESSFUL

Total time: 11.916 secs
D:\programming\gradle-pj>tree /F
フォルダー パスの一覧:  ボリューム ボリューム
ボリューム シリアル番号は 4C2A-94B2 です
D:.
│  .classpath
│  .project
│  build.gradle
│  gradlew
│  gradlew.bat
│  settings.gradle

├─.gradle
│  └─2.14.1
│      └─taskArtifacts
│              cache.properties
│              cache.properties.lock
│              fileHashes.bin
│              fileSnapshots.bin
│              fileSnapshotsToTreeSnapshotsIndex.bin
│              taskArtifacts.bin

├─.settings
│      org.eclipse.jdt.core.prefs

├─gradle
│  └─wrapper
│          gradle-wrapper.jar
│          gradle-wrapper.properties

└─src
    ├─main
    │  └─java
    │          Library.java
    │
    └─test
        └─java
                LibraryTest.java