apply { plugin 'java' plugin 'maven' plugin 'eclipse' } repositories { mavenRepo url: "http://192.175.204.100/nexus/content/groups/public/" } // Project Settings group = groupId version = "${rootProject.releaseVersion}-${rootProject.releaseBuildNumber}" // Java Settings sourceCompatibility = 1.6 targetCompatibility = 1.6 [compileJava,compileTestJava].each { c-> c.options.encoding = 'UTF-8' c.options.debug(debugLevel: 'source,lines,vars') } dependencies { compile 'mysql:mysql-connector-java:5.1.20' compile 'log4j:log4j:1.2.16' testCompile 'mockit:jmockit:0.999.4' testCompile 'junit:junit:4.10' } task sourcesJar(type: Jar, dependsOn:classes) { classifier = 'sources' from sourceSets.main.allSource } artifacts { archives sourcesJar } eclipse { pathVariables 'GRADLE_USER_HOME': gradle.gradleUserHomeDir } // Release Dist Setting task releaseDist(type: Zip) { from("src/main/bin") { into "${baseName}-${version}/bin" } from("src/main/etc") { into "${baseName}-${version}/etc" } from("src/main/logrotate") { into "${baseName}-${version}/logrotate" } from("src/main/sql") { into "${baseName}-${version}/sql" } from(jar.outputs.files) { into "${baseName}-${version}/lib" } from(configurations.matching { it.name in ['compile'] }.flatten()) { into "${baseName}-${version}/lib" } } releaseDist.dependsOn build /** mainClassName = "jp.ossc.imortAuditlog.ImportAuthLogMain" applicationName = 'import_auth_log' startScripts << { println "Adding classpath setting to ${outputDir}/${applicationName}" def scriptFile = file "${outputDir}/${applicationName}" scriptFile.text = scriptFile.text.replace('CLASSPATH=$APP_HOME/lib', 'CLASSPATH=$APP_HOME/etc:$APP_HOME/lib') println "Adding classpath setting to ${outputDir}/${applicationName}.bat" scriptFile = file "${outputDir}/${applicationName}.bat" scriptFile.text = scriptFile.text.replace('CLASSPATH=%APP_HOME%\\lib', 'CLASSPATH=%APP_HOME%\\etc;%APP_HOME%\\lib') } applicationDistribution.from("src/main/bin") { into "bin" } applicationDistribution.from("src/main/etc") { into "etc" } applicationDistribution.from("src/main/logrotate") { into "logrotate" } applicationDistribution.from("src/main/sql") { into "sql" } // workaround: because distZip task don't execute sourcesJar task. distZip.dependsOn sourcesJar **/ // Gradle Wrapper Setting task wrapper(type: Wrapper) { gradleVersion = '1.0' }