2

I'm trying to setup a basic elasticsearch plugin with gradle that follows this example. I realized the build.gradle file in the repo is not sufficient (for some reason) so this is my current build.gradle file

 plugins {
    id 'java'
}

group 'test'
version '1.0-SNAPSHOT'

sourceCompatibility = 1.8


repositories {
    mavenCentral()
}

dependencies {
    classpath "org.elasticsearch.gradle:build-tools:6.5.4"
    testCompile group: 'junit', name: 'junit', version: '4.12'
}

apply plugin: 'elasticsearch.esplugin'

esplugin {
    name 'script-expert-scoring'
    description 'An example script engine to use low level Lucene internals for expert scoring'
    classname 'org.elasticsearch.example.expertscript.ExpertScriptPlugin'
    licenseFile rootProject.file('licenses/APACHE-LICENSE-2.0.txt')
    noticeFile rootProject.file('NOTICE.txt')
}

unitTest.enabled = false

I added the classpath dependency myself because I realized I probably need it. But now I'm getting an error saying

cannot find method classpath() for arguments [org.elasticsearch.gradle:build-tools:6.5.4]

Am I missing something or is this completely wrong?

ninesalt
  • 4,054
  • 5
  • 35
  • 75

1 Answers1

2

try to put it inside a buildscript block like this:

buildscript {
    repositories {
        mavenLocal()
        mavenCentral()
        jcenter()
    }

    dependencies {
        classpath "org.elasticsearch.gradle:build-tools:6.5.4"
    }
}

Here is a better example, or here if you want a more complete approach.

Thales Valias
  • 563
  • 5
  • 11