Hello Steve, I am a new user, and I don't know where to add "buildscript{"
part. Do you mean that as my build.gradle script file, or actually add
"buildscript {" literally to my build.gradle file?
I have changed my script to this, and it still doesn't work:
apply(plugin:'java')
repositories {
mavenCentral()
mavenRepo(urls:'http://google-gson.googlecode.com/svn/mavenrepo')
}
dependencies {
classpath('com.google.code.gson:gson:1.4')
}
task testGson << {
gson = new com.google.gson.Gson()
map = [a:'aaa',i:123,o:new Object()]
println(gson.toJson(map))
}
$ gradle testGson
FAILURE: Build failed with an exception.
* Where:
Build file '/home/zemian/source/myapp/build.gradle' line: 10
* What went wrong:
Could not compile build file '/home/zemian/source/myapp/build.gradle'.
Cause: startup failed:
build_gradle_64933bc2989646b749941b0b058be111: 10: unable to resolve class
com.google.gson.Gson
@ line 10, column 10.
gson = new com.google.gson.Gson()
^
1 error
* Try:
Run with -s or -d option to get more details. Run with -S option to get the
full (very verbose) stacktrace.
BUILD FAILED
Total time: 2.171 secs
-----
----
Zemian Deng
--
View this message in context:
http://old.nabble.com/How-to-use-dependecies-within-build-script-in-a-custom-task--tp28937827p28941033.html
Sent from the gradle-user mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email