Skip to content

Instantly share code, notes, and snippets.

@renatoathaydes
Created January 20, 2024 21:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save renatoathaydes/eb4ac02c8363f5534dd9e083f55995d5 to your computer and use it in GitHub Desktop.
Save renatoathaydes/eb4ac02c8363f5534dd9e083f55995d5 to your computer and use it in GitHub Desktop.
Example code sharing in Gradle
// main build file, using code from buildSrc project....
// notice that the buildSrc project can be written in any JVM language!
task sayHello {
doLast {
println foo.MyFunctions.hello()
}
}
// buildSrc/build.gradle
plugins {
id 'groovy'
}
// add this to buildSrc/src/main/groovy/foo/MyFunctions.groovy
package foo
class MyFunctions {
static String hello() { 'hello' }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment