2015年8月22日土曜日

Pleiades Mars 64bit Java 移行 (Gradle 移行)

Luna から Mars へプロジェクトを移行する。

Pleiades Mars インストール

c:\pleiades を c:\pleiades.old にリネーム

Pleiades Mars 64bit Java Full Edition をダウンロード。
http://mergedoc.sourceforge.jp/index.html#/pleiades.html

エクスプローラでダウンロードした zip ファイルを選択し、中にある pleiades ディレクトリを c:\ へD&Dして解凍。

STS インストール

「ヘルプ」「Eclipse マーケットプレース」
「検索」で「STS」を検索
「Spring Tool Suite (STS) for Eclipse 3.7.0.RELEASE」をインストール

Jacoco プラグインインストール

http://s6131.blogspot.jp/2014/03/java-jacoco.html

Gradle インストール

gradle-2.6-all.zip をダウンロード
https://gradle.org/
エクスプローラでダウンロードした zip ファイルを選択し、中にある gradle-2.6 ディレクトリを c:\ へD&Dして解凍。

コントロールパネル→システム→システムの詳細設定→環境変数→システム環境変数
Path の先頭に c:\gradle-2.6\bin; を追加

Gradle プロジェクト設定

「ファイル」「新規」「その他」「Gradle」「Gradle プロジェクト」
プロジェクト名 sample として「完了」

sample プロジェクトを選択している状態で、「ファイル」「インポート」

「一般」「ファイル・システム」「参照」で「c:\pleiades.old\workspace\sample」を指定
「src」ディレクトリのみを選択してインポートを実行する。

sample プロジェクト右クリック、「プロパティ」
「Java のビルド・パス」「ソース」タブで「フォルダの追加」
src/main/resources
src/test/resources

build.gradle を編集
// Apply the java plugin to add support for Java
def defaultEncoding = 'UTF-8'
apply plugin: 'war'
apply plugin: 'eclipse'
apply plugin: 'eclipse-wtp'
group = 'jp.s6131'
version = '1.0.0-BUILD-SNAPSHOT'
description = """sample"""
sourceCompatibility = 1.8
targetCompatibility = 1.8
// In this section you declare where to find the dependencies of your project
repositories {
    // Use 'jcenter' for resolving your dependencies.
    // You can declare any Maven/Ivy/file repository here.
    jcenter()
}
// In this section you declare the dependencies for your production and test code
dependencies {
    compile(group: 'org.springframework', name: 'spring-context', version:'4.0.5.RELEASE') {
        exclude(module: 'commons-logging')
    }
    compile group: 'org.springframework', name: 'spring-context-support', version:'4.0.5.RELEASE'
    compile group: 'org.springframework', name: 'spring-webmvc', version:'4.0.5.RELEASE'
    compile group: 'org.springframework', name: 'spring-jdbc', version:'4.0.5.RELEASE'
    compile group: 'org.springframework', name: 'spring-test', version:'4.0.5.RELEASE'
    compile group: 'org.springframework.security', name: 'spring-security-web', version:'3.2.3.RELEASE'
    compile group: 'org.springframework.security', name: 'spring-security-config', version:'3.2.3.RELEASE'
    compile group: 'org.springframework.batch', name: 'spring-batch-core', version:'2.2.5.RELEASE'
    compile group: 'commons-dbcp', name: 'commons-dbcp', version:'1.2.2'
    compile group: 'c3p0', name: 'c3p0', version:'0.9.1.2'
    compile group: 'org.apache.velocity', name: 'velocity', version:'1.7'
    compile group: 'org.aspectj', name: 'aspectjrt', version:'1.8.0'
    compile group: 'org.mybatis', name: 'mybatis', version:'3.2.4'
    compile group: 'org.mybatis', name: 'mybatis-spring', version:'1.2.2'
    compile group: 'mysql', name: 'mysql-connector-java', version:'5.1.29'
    compile group: 'org.codehaus.jackson', name: 'jackson-core-asl', version:'1.9.13'
    compile group: 'org.codehaus.jackson', name: 'jackson-mapper-asl', version:'1.9.13'
    compile group: 'org.slf4j', name: 'slf4j-api', version:'1.7.7'
    compile group: 'javax.inject', name: 'javax.inject', version:'1'
    compile group: 'javax.servlet', name: 'jstl', version:'1.2'
    compile group: 'org.apache.poi', name: 'poi', version:'3.10-FINAL'
    compile group: 'org.dbunit', name: 'dbunit', version:'2.4.9'
    runtime group: 'org.slf4j', name: 'jcl-over-slf4j', version:'1.7.7'
    runtime group: 'org.slf4j', name: 'slf4j-log4j12', version:'1.7.7'
    runtime(group: 'log4j', name: 'log4j', version:'1.2.15') {
        exclude(module: 'mail')
        exclude(module: 'jms')
        exclude(module: 'jmxtools')
        exclude(module: 'jmxri')
    }
    testCompile group: 'junit', name: 'junit', version:'4.7'
    providedCompile 'javax.servlet:javax.servlet-api:3.1.0'
    providedCompile 'javax.servlet.jsp:jsp-api:2.2'
}

コマンドプロンプトを実行、gradle を実行する。
cd \pleiades\workspace\sample
gradle eclipse

「ウィンドウ」「ビューの表示」「その他」「サーバー」で「サーバー」表示、
Tomcat8 サーバーを作成、sample プロジェクトを追加する。

Tomcat サーバーを起動し、Luna 時と同動作をする事を確認。