Error on groovy compile in buildSrc gradle 2.4

I am getting the following error

:buildSrc:compileJava UP-TO-DATE
startup failed:
buildSrc/src/main/groovy/com/home/gradle/InstallNameTask.groovy: -1: The return type of java.lang.Object getPath() in com.home.gradle.InstallNameTask is incompatible with java.lang.String in org.gradle.api.internal.AbstractTask
. At [-1:-1] @ line -1, column -1.
1 error

This seems very internal and does not provide any information about where to look at. Do you have any ideas?

Can you post the code for InstallNameTask? Are you by any chance overriding the getPath() method?

here it is:

package com.home.gradle

import org.gradle.api.DefaultTask
import org.gradle.api.tasks.TaskAction
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.Optional
import org.gradle.api.Project

class InstallNameTask extends DefaultTask {
    def libs

	def path

	def installNameTool() {
        libs.each { library ->
            def lib = library + ".dylib"
            def options = ["-id", [path, lib].join(File.separator), lib]
            exec {
                executable "install_name_tool"
                workingDir path
                args options

            def output = project.getCommandOutput(["otool", "-L", lib], path)
            output.split("\n").each { line ->
                if(line.size() > 0) {
                    def token = line.trim().split(" ")[0]
                    libs.each { dependant ->
                        def depLib = dependant + ".dylib"
                        if(depLib != lib) {
                            if(token.matches(~/${dependant}.*/)) {
                                println "Patching the @loader_path of ", token, " for ", lib
                                def ignore = project.getCommandOutput(
                                    ["install_name_tool", "-change", token,
                                        ["@loader_path", token].join(File.separator), lib], path)

This is your problem. The DefaultTask class declares a method getPath(). You’ll need to rename this property.