Problem setting up workspace in Eclipse

I am trying to set up Eclipse to start working on making a plugin. I follow the tutorial at https://docs.spongepowered.org/en/plugin/workspace/eclipse.html up until the point where it says “Right-click your project, and select Gradle > Refresh Dependencies.” When I do this, I get an this error:


FAILURE: Build failed with an exception.

  • Where:
    Build file ‘C:\Users\jacob_000\Desktop\Everything Minecraft\Modding\Plugins 1.8\Plugins\build.gradle’ line: 10

  • What went wrong:
    A problem occurred evaluating root project ‘Plugins’.
    Could not find method compile() for arguments [org.spongepowered:spongeapi:3.0.0] on root project ‘Plugins’.

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 0.518 secs


I have been trying to figure out what’s going on, but I just can’t find a fix. Does anyone know what’s happening here?

In your build.gradle file, you must include the java plugin:

plugins {
  id 'java'
}

Here is my current build.gradle file:


repositories {
mavenCentral()
maven {
name = ‘sponge’
url = ‘http://repo.spongepowered.org/maven
}
}

dependencies {
plugins {
id ‘java’
}

compile 'org.spongepowered:spongeapi:3.0.0'

}


Where would your code go?

It should look something like this:


plugins {
  id 'java'
}

repositories {
  mavenCentral()
  maven {
    name = 'sponge'
    url = 'http://repo.spongepowered.org/maven'
  }
}

dependencies {
  compile 'org.spongepowered:spongeapi:3.0.0'
}

Then I get this error:


FAILURE: Build failed with an exception.

  • Where:
    Build file ‘C:\Users\jacob_000\Desktop\Everything Minecraft\Modding\Plugins 1.8\Plugins\build.gradle’ line: 2

  • What went wrong:
    A problem occurred evaluating root project ‘Plugins’.
    Could not find method id() for arguments [java] on root project ‘Plugins’.

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 1.305 secs


Put this at the top and remove the plugins section

apply plugin: ‘java’
apply plugin: ‘eclipse’

1 Like

It worked! Thank you!