Last active
March 22, 2018 16:36
-
-
Save sixman9/5233679 to your computer and use it in GitHub Desktop.
My base Gradle build file, with sample Intellij & Eclipse project config section - This a version of https://github.com/sixman9/gradleExample/blob/master/build.gradle.
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
version = 0.1 | |
apply plugin: 'java' | |
//apply plugin: 'groovy' | |
apply plugin: 'idea' | |
apply plugin: 'eclipse' | |
apply plugin:'application' //See 'mainClassName', issue 'gradle run' | |
mainClassName = "YourMainClassNameHere" | |
//[project] Templates plugin | |
//See also 'http://www.tellurianring.com/projects/gradle-plugins/gradle-templates/apply.groovy' | |
apply from: 'https://raw.github.com/townsfolk/gradle-templates/master/installation/apply.groovy' | |
//Libraries to aid this build script itself | |
buildscript { | |
repositories { | |
mavenLocal() | |
mavenCentral() | |
//mavenRepo name: "jboss" url: "http://repository.jboss.org/maven2/" | |
} | |
dependencies { | |
//classpath "group:artefact:version", "etc." | |
} | |
} | |
//Actual project repositories | |
repositories { | |
mavenCentral() | |
mavenRepo url: "http://repository.jboss.org/maven2/" | |
} | |
//RTFM ;-), I dunno.. | |
/* | |
configurations { | |
all*.exclude group: 'xml-apis', module: 'xml-apis' | |
} | |
*/ | |
//Actual project dependencies | |
dependencies { | |
//compile "group:artefact:version", "etc." | |
//runtime "group:artefact:version", "etc." | |
//provided "group:artefact:version", "etc." | |
//See http://stackoverflow.com/questions/2572811/gradle-make-a-3rd-party-jar-available-to-local-gradle-repository | |
//runtime files('libs/a.jar', 'libs/b.jar') | |
//runtime fileTree(dir: 'libs', include: '*.jar') | |
} | |
//Generate self-distributing Gradle wrapper - BTW, simple task definition | |
task('wrapper', type: Wrapper).configure { | |
gradleVersion = '1.6' | |
} | |
//sdk version variable - used for IDE setup (later) | |
def versionCompatibility = 1.6 | |
//From the Eclipse plugin - manipulates the project file and classpath etc. | |
eclipse { | |
project { | |
comment = "" | |
buildCommand "org.eclipse.jdt.core.javabuilder" | |
natures "com.springsource.sts.grails.core.nature", | |
"org.eclipse.jdt.groovy.core.groovyNature", | |
"org.eclipse.jdt.core.javanature", | |
"com.springsource.sts.gradle.core.nature" | |
} | |
classpath { | |
containers "com.springsource.sts.gradle.classpathcontainer" | |
} | |
} | |
//From the idea plugin - manipulates the project file's XML etc. | |
idea { | |
project { | |
jdkName = versionCompatibility | |
ipr { | |
withXml { provider -> | |
def node = provider.asNode() | |
// Use GIT | |
def vcsConfig = node.component.find { it.'@name' == 'VcsDirectoryMappings' } | |
vcsConfig.mapping[0].'@vcs' = 'Git' | |
// Set Gradle home | |
def gradleSettings = node.appendNode('component', [name: 'GradleSettings']) | |
gradleSettings.appendNode('option', [name: 'SDK_HOME', value: gradle.gradleHomeDir]) | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment