0

I'm trying to add breakpoints in IntelliJ to debug foo.groovy when used like this:

def binding = new Binding();
binding.lineList = [list1];
binding.count = 5;

def shell = new GroovyShell(binding);
def result = shell.evaluate(new File("../../not-src-main-groovy/foo.groovy"));

This compiles and runs fine, BUT IntellIj won't stop at my breakpoints.

On the other hand, if I place foo.groovy in src/main/groovy/com/... then IntellIJ DOES stop at my breakpoints, as suggested in this stackoverflow answer.

But unlike that post, foo.groovy does multiple import statements. Those statements reference code from a different github repo, cloned locally outside my project at ../../not-src-main-groovy.

I've tried changing IntelliJ > Project Structure > Modules > mymodule > Dependencies > + > JARS or Directories > "../../not-src-main-groovy" but IntelliJ doesn't stop at the breakpoints.

How can I configure IntelliJ to stop at foo.groovy breakpoints?

mellow-yellow
  • 1,670
  • 1
  • 18
  • 38

1 Answers1

0

I found a solution. Because my project uses gradle, I added the following to build.gradle.

dependencies {
 ...
 compile files("include-me/**")
...
}

That way, gradle will include the files in the classpath during the compilation phase, but not actually compile them, since they're not in here:

sourceSets {
    main.groovy {
        srcDirs = [ 'src/main/groovy']
    }
}
mellow-yellow
  • 1,670
  • 1
  • 18
  • 38