Search code examples
javagradlebuild.gradleread-eval-print-loopgroovyshell

Adding Java REPL build.gradle


Consider my build.gradle:

plugins {
    id 'de.aaschmid.cpd' version '0.4'
}

group 'ar.fiuba.tdd'
version '1.0-SNAPSHOT'

apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'eclipse'
apply plugin: 'checkstyle'
apply plugin: 'maven'
apply plugin: 'findbugs'
apply plugin: 'pmd'
apply plugin: "jacoco"
apply from: 'gradle/fatjar.gradle'
apply from: 'gradle/quality.gradle'

sourceCompatibility = 1.8
targetCompatibility = 1.8

repositories {
    jcenter()
    maven {
        url "http://nexus-tecnicas7510.rhcloud.com/nexus/content/repositories/third-party"
    }
}

dependencies {
    testCompile 'org.hamcrest:hamcrest-all:1.3'
    testCompile 'junit:junit:4.12'
    compile 'org.jgrapht:jgrapht-core:0.9.1'
    compile 'com.googlecode.json-simple:json-simple:1.1'
}

How can I add a JAVA REPL like https://github.com/albertlatacz/java-repl or https://github.com/tkruse/gradle-groovysh-plugin ?

Thanks !


Solution

  • Gradle groovysh plugin contains the description, how it could be applied into your gradle script. You just have to add a plugin id in your plugins and modify buildscript dependencies like:

    plugins {
      id 'de.aaschmid.cpd' version '0.4'
      id "com.github.tkruse.groovysh" version "1.0.8"
    }
    

    And add the buildscript repository:

    buildscript {
        repositories {
            jcenter()
        }
    }