Created
January 9, 2012 06:49
-
-
Save waman/1581545 to your computer and use it in GitHub Desktop.
Gradle build file for JavaFX project
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apply plugin:'java' | |
defaultTasks 'test' | |
//defaultTasks 'clean', 'build' | |
// 設定項目↓↓↓ | |
group = 'org.waman' // グループ名 & implementation-vendor | |
version = 1.0 // アプリケーション・バージョン& implementation-version | |
def jdkVersion = 1.7 | |
def enc = 'UTF-8' | |
def mainClass = 'org.sample.Main' // 実行可能 Jar ファイルのメインクラス | |
// 設定項目↑↑↑ | |
def javafxHome = System.getenv('JAVAFX_HOME') | |
def antJavafxJar = 'build/classes/ant-javafx' | |
sourceCompatibility = jdkVersion | |
targetCompatibility = jdkVersion | |
[compileJava, compileTestJava].each{ it.options.encoding = enc } | |
// ***** Settings for dependencies ***** | |
repositories { | |
mavenCentral() | |
} | |
dependencies { | |
compile files("$javafxHome/rt/lib/jfxrt.jar") // 1. JavaFX ライブラリの Jar ファイル | |
testCompile 'junit:junit:4.10' | |
} | |
// ***** Settings for Executable Jar ***** | |
jar { | |
manifest { | |
// 2. Jar のマニフェストを設定 | |
attributes('Manifest-Version':1.0, 'JavaFX-Version':2.0, 'Main-Class':'com/javafx/main/Main', | |
'implemetation-vendor':group, 'implementation-title':name, 'implementation-version':version, | |
'JavaFX-Application-Class':mainClass) | |
} | |
from "$antJavafxJar/resources/classes" // 3. JavaFX アプリケーションに必要なクラス群 | |
} | |
// このタスクは「修正」の項目参照 | |
task unjarAntJavafxJar << { | |
if(!new File(antJavafxJar).exists()) | |
ant.unjar(src:"$javafxHome/tools/ant-javafx.jar", dest:antJavafxJar) | |
} | |
jar.dependsOn unjarAntJavafxJar |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment