Gradle uses convention over configuration which allows you to provide minimal information to build your project if you follow the standard project layout. That said everything is still configurable using a declarative style:
}
Because you have a real programming language you can do almost anything.
| ||
Note that this adds source directories rather than replacing them. The syntax for replacing is srcDirs = ['src/java'] and srcDirs = ['src/resources']. |
Showing posts with label gradle. Show all posts
Showing posts with label gradle. Show all posts
Saturday, March 14, 2015
Gradle: add source dirs vs replace source dirs
http://stackoverflow.com/questions/10570795/can-gradle-handle-builds-for-legacy-projects-without-having-to-restructure-direc?rq=1
Wednesday, March 30, 2011
Gradle Init script vs Build script
On 7/07/10 7:06 AM, Rene Groeschke wrote:
> hi there,
> I would like to apply the eclipse plugin on demand via init script
> while updating my eclipse classpath.
> Is there a way to get this working and avoid the UnsupportedOperation
> exception I got while trying " apply plugin'eclipse' " ?
Init scripts delegate to a Gradle instance, rather than a Project
instance as the build scripts do. And so, when you do apply plugin:
'eclipse', you're trying to apply a plugin designed to work with a
Project instance, to a Gradle instance. Of course, the error message
should tell you this (and what to do about it, too, I guess).
At the moment, it's a bit awkward to apply a project plugin from an init
script. You could do something like:
Ideally, the init script would offer something like an allprojects { }
method, to make this kind of thing simpler.
> hi there,
> I would like to apply the eclipse plugin on demand via init script
> while updating my eclipse classpath.
> Is there a way to get this working and avoid the UnsupportedOperation
> exception I got while trying " apply plugin'eclipse' " ?
Init scripts delegate to a Gradle instance, rather than a Project
instance as the build scripts do. And so, when you do apply plugin:
'eclipse', you're trying to apply a plugin designed to work with a
Project instance, to a Gradle instance. Of course, the error message
should tell you this (and what to do about it, too, I guess).
At the moment, it's a bit awkward to apply a project plugin from an init
script. You could do something like:
addListener(new ApplyPluginListener())
class ApplyPluginListener extends BuildAdapter {
public void projectsEvaluated(Gradle gradle) {
gradle.rootProject.allprojects { apply plugin: 'eclipse' }
}
} Ideally, the init script would offer something like an allprojects { }
method, to make this kind of thing simpler.
Tuesday, January 18, 2011
Gradle tips
// File: build.gradle
usePlugin 'java'
defaultTasks 'clean', 'build' // Run tasks clean and build if no task is specified.
Reference: http://mrhaki.blogspot.com/2009/11/gradle-goodness-setting-default-tasks.html
usePlugin 'java'
defaultTasks 'clean', 'build' // Run tasks clean and build if no task is specified.
Reference: http://mrhaki.blogspot.com/2009/11/gradle-goodness-setting-default-tasks.html
Wednesday, January 5, 2011
How to build mrm.jar using Gradle
apply plugin: 'java'
apply plugin: 'idea'
sourceCompatibility = 1.5
// version = '1.0'
jar.baseName = 'mrm'
gems_common_lib='../apps/build/ext/components/bndl_gems/build/gems_common/build/libs'
buildDate = new Date()
changes = 'Removed the usage of gems_common'
defaultTasks 'clean', 'build'
sourceSets {
main {
java {
srcDir 'src'
}
resources {
srcDir 'src/resources'
}
}
}
repositories {
mavenCentral()
}
dependencies {
compile files("${gems_common_lib}/gems_common.jar")
testCompile group: 'junit', name: 'junit', version: '4.+'
}
jar {
manifest {
attributes 'Manifest-Version': 1.0,
'Created-By': 'David Chang',
'Created-Date': buildDate,
'Change-Log': changes
}
}
How to build QuickBinder using Gradle
// build.gradle
apply plugin: 'java'
apply plugin: 'idea'
sourceCompatibility = 1.5
// version = '1.0'
jar.baseName = 'QuickBinder-ss'
// QuickBinder variables
qbVersion = 1.1
qbBuildDate = new Date()
qbChanges = 'Removed splash screen'
defaultTasks 'clean', 'build'
repositories {
mavenCentral()
}
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.+'
}
jar {
manifest {
attributes 'Manifest-Version': 1.0,
'Created-By': 'David Chang',
'Created-Date': qbBuildDate,
'QuickBinder-Version': qbVersion,
'QuickBinder-Change-Log': qbChanges,
'Main-Class': 'com.rci.edge.quickbinder.impl.QuickBinder'
}
from sourceSets.main.classes
exclude('com/rci/edge/quickbinder/logger/QuickSplashscreen*')
}
Subscribe to:
Posts (Atom)