The error message:
all buildscript {} blocks must appear before any plugins {} blocks in the script
Explains what you need to do: move the buildscript block before the plugins block. E.g.
buildscript {
repositories { ... }
dependencies { ... }
...
}
plugins {
...
}
Don't put one inside the other.
However, regardless of the order, I don't think you are using the two blocks correctly in the first place.
Firstly, the buildscript
block is for configuring dependencies used in the actual script, and not what is used for building your project. So things like junit or easymock does not make sense here. You most likely wanted to put the dependencies block outside as these are for the project.
Secondly, the plugins
block can be seen as a newer easier way of writing apply plugin
where you usually don't have to configure the buildscript classpath. You should use it wherever you can instead of the older and more verbose way. If you are in doubt about how to write a third-party plugin in the newer way, find it in the Gradle Plugins Portal and read the description there.
Try with something like this instead:
plugins {
id 'java'
id 'war'
id 'jacoco'
id 'eclipse'
id "fr.putnami.gwt" version "0.4.0"
id "info.solidsoft.pitest" version "1.3.0"
id "de.fntsoftware.gradle.markdown-to-pdf" version "1.1.0"
}
repositories {
mavenCentral()
}
dependencies {
testCompile 'junit:junit:4.12'
testCompile 'org.easymock:easymock:2.5.2'
testCompile 'com.google.gwt:gwt-dev:2.8.1'
compile 'net.sourceforge.plantuml:plantuml:8001'
}
Also be aware that the Putnami GWT plugin is no longer maintained, but has an (at this time relative) active fork.
Also also, compile
is deprecated and you should use implementation
if your version of Gradle and your plugins support it.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…