description 'Java, Groovy and Kotlin examples for the picocli project.' buildscript { repositories { mavenCentral() } dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.10" } } apply plugin: 'groovy' apply plugin: 'kotlin' apply plugin: 'scala' apply plugin: 'java-library' sourceCompatibility = 1.8 // for the JSR-380 BeanValidation example targetCompatibility = 1.8 configurations { ivy } dependencies { api rootProject api project(':picocli-groovy') api "org.jetbrains.kotlin:kotlin-stdlib" api 'org.scala-lang:scala-library:2.13.3' ivy "org.apache.ivy:ivy:$ivyVersion" // for Intelli/J implementation "org.codehaus.groovy:groovy-all:$groovyVersion", "org.apache.ivy:ivy:$ivyVersion", // for Intelli/J // for the Logging example "org.apache.logging.log4j:log4j-api:2.13.0", "org.apache.logging.log4j:log4j-core:2.13.0", // for the JSR-380 BeanValidation example "javax.validation:validation-api:2.0.0.Final", "org.hibernate.validator:hibernate-validator:6.1.2.Final", "org.hibernate.validator:hibernate-validator-annotation-processor:6.1.2.Final", "javax.el:javax.el-api:3.0.0", "org.glassfish.web:javax.el:2.2.6" implementation "org.jetbrains.kotlin:kotlin-script-runtime:1.4.10" } tasks.withType(GroovyCompile) { // this, and the `configurations {ivy}` section, are a workaround for the dreaded // java.lang.NoClassDefFoundError: org/apache/ivy/core/report/ResolveReport // that occurs when trying to compile a groovy script containing a @Grab annotation in gradle. // see https://stackoverflow.com/questions/18173908/error-compiling-a-groovy-project-using-grab-annotation groovyClasspath += configurations.ivy } def generatedResources = "$buildDir/generated-resources/main" sourceSets { main { //register an output folder on the main SourceSet: output.dir(generatedResources, builtBy: 'generateVersionTxt') //it is now a part of the 'main' classpath and will be a part of the jar } } //a task that generates the resources for the example VersionProviderDemo1: task generateVersionTxt { description 'Creates a version.txt file with build info that is added to the root of the picocli-examples jar' doLast { new File(generatedResources).mkdirs() def generated = new File(generatedResources, "version.txt") generated.text = """ Version: $rootProject.version Buildtime: ${new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())} Application-name: $rootProject.name $project.name """ } } tasks.withType(Javadoc).all { enabled = false } //tasks.withType(Javadoc) { // options.addBooleanOption('Xdoclint:none', true) //} //tasks.withType(JavaCompile) { // options.compilerArgs << '-Xlint:unchecked' << '-Xlint:deprecation' << // '-processorpath' << 'C:\\Users\\remko\\IdeaProjects\\picocli3\\picocli-codegen\\build\\libs\\picocli-codegen-4.0.0-SNAPSHOT.jar;C:\\Users\\remko\\IdeaProjects\\picocli3\\build\\libs\\picocli-4.0.0-SNAPSHOT.jar' << // '-processor' << 'picocli.codegen.annotation.processing.AnnotatedCommandSourceGeneratorProcessor' //}