Gradle Checkstyle plugin compatibility with google checkstyle - gradle

I've installed the google-java-format plugin and placed the following checkstyle in config/checkstyle/checkstyle.xml:
https://github.com/google/styleguide/blob/gh-pages/intellij-java-google-style.xml
My build.gradle looks like this:
plugins {
id 'org.springframework.boot' version '2.5.2'
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id 'java'
id 'checkstyle'
}
group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '11'
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}
test {
useJUnitPlatform()
}
So, when I run the task checkstyleMain, The following error message appears:
Document root element "code_scheme", must match DOCTYPE root "null".
Can anybody help?

Related

Build failed Spring Boot Plugin was not found

I download a repo 'gs-handling-form-submission' from spring.io and now I'm trying to build: gradle build
Following Error has being triggered
* Where:
Build file 'C:\Users\Username\Desktop\gs-handling-form-submission\complete\build.gradle' line: 11
* What went wrong:
Plugin [id: 'org.springframework.boot', version: '2.4.2'] was not found in any of the following sources:
- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Plugin Repositories (could not resolve plugin artifact 'org.springframework.boot:org.springframework.boot.gradle.plugin:2.4.2')
Searched in the following repositories:
Gradle Central Plugin Repository
I already added a repo url, changed spring.boot version, added buildscript.repositories() at the first line, even doing that, I can't get to compile.
plugins {
id 'org.springframework.boot' version '2.4.2'
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id 'java'
}
group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'
repositories {
jcenter()
mavenCentral()
maven {
url: "https://plugins.gradle.org/m2/"
}
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
implementation 'org.springframework.boot:spring-boot-starter-web'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}
test {
useJUnitPlatform()
}
Fixing the build.gradle, removing : url, was possible to build
plugins {
id 'org.springframework.boot' version '2.6.3'
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id 'java'
}
group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'
repositories {
jcenter()
mavenCentral()
maven {
url 'https://plugins.gradle.org/m2/'
}
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
implementation 'org.springframework.boot:spring-boot-starter-web'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}
test {
useJUnitPlatform()
}

Gradle 6.5.1 gretty 3.0.3 unable to run jetty

I am trying to build my first REST API, using jersey on Eclipse. This is my build.gradle:
plugins {
//id "com.dsvdsv.gradle.plugin" version "1.5.1"
//id 'org.gretty' version '2.1.0'
id "org.gretty" version "3.0.3"
//id 'com.bmuschko.tomcat'
id 'eclipse-wtp'
id 'war'
//id 'jetty'
id 'org.springframework.boot' version '2.4.2'
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id 'java'
id 'application'
}
group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '11'
mainClassName = 'com.example.demo.DemoApplication'
repositories {
mavenCentral()
//jcenter()
}
dependencies {
// https://mvnrepository.com/artifact/org.gretty/gretty-runner-tomcat85
//compile group: 'org.gretty', name: 'gretty-runner-tomcat85', version: '2.2.0'
implementation 'org.glassfish.jersey.containers:jersey-container-servlet:2.25.1'
implementation 'org.glassfish.jersey.inject:jersey-hk2:2.26'
implementation 'org.springframework.boot:spring-boot-starter'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
//implementation 'com.bmuschko:gradle-tomcat-plugin:2.5'
}
test {
useJUnitPlatform()
}
When I use gradle jettyStart or gradle jettyRunWar, getting below error:
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':jettyStart'.
Could not resolve all files for configuration ':grettyRunnerJetty94'.
Could not find org.gretty:gretty-runner-jetty94:3.0.3.
Required by:
project :
I also tried gretty 2.1.0 version, but it's unreachable. Gradle version is 6.5.1
As mentioned by #Knut Forkalsrud newer gretty versions are not in maven central and you need to add jcenter() to the list of repositories:
repositories {
jcenter()
mavenCentral()
// other repositories
}
Additional Note: The order of repositories is also important (similar to maven). So make sure you add the jcenter() at the right place in your list of repositories.

Cannot resolve external dependency org.springframework.boot:spring-boot-dependencies:2.4.1 because no repositories are defined

I created a multimodule spring boot, every module use spring.
My nvoice build.gradle
buildscript {
repositories {
mavenCentral()
}
}
plugins {
id 'org.springframework.boot' version '2.4.1'
id 'io.spring.dependency-management' version '1.0.10.RELEASE'
id 'java'
}
allprojects {
group = 'com.torenda'
sourceCompatibility = '11'
}
subprojects {
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'java'
repositories {
mavenCentral()
}
}
bootJar {
enabled = false
}
settings.gradle of nvoice
rootProject.name = 'nvoice'
include ':invoice'
include ':payment'
build.gradle of my invoice module
description = 'invoice'
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-r2dbc'
implementation 'org.springframework.boot:spring-boot-starter-webflux'
compileOnly 'org.projectlombok:lombok'
developmentOnly 'org.springframework.boot:spring-boot-devtools'
runtimeOnly 'io.r2dbc:r2dbc-postgresql'
runtimeOnly 'org.postgresql:postgresql'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'io.projectreactor:reactor-test'
}
bootJar {
enabled = true
}
When I try to build the app I get
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':bootRunMainClassName'.
Could not resolve all dependencies for configuration ':detachedConfiguration1'.
Cannot resolve external dependency org.springframework.boot:spring-boot-dependencies:2.4.1 because no repositories are defined.
Required by:
project :
Like you can see, repositories is definined in the main gradle file and i added it in the subprojects section too
It works if you move repositories under allprojects and remove buildscript:
plugins {
id 'org.springframework.boot' version '2.4.1'
id 'io.spring.dependency-management' version '1.0.10.RELEASE'
id 'java'
}
allprojects {
group = 'com.torenda'
sourceCompatibility = '11'
repositories {
mavenCentral()
}
}
subprojects {
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'java'
}
bootJar {
enabled = false
}

Unable to build SpringBootProject from terminal i.e command line

Could not resolve all files for configuration ':classpath'.
Could not resolve org.springframework.boot:spring-boot-gradle-plugin:2.3.0.RELEASE.
Required by:
project : > org.springframework.boot:org.springframework.boot.gradle.plugin:2.3.0.RELEASE
Could not resolve org.springframework.boot:spring-boot-gradle-plugin:2.3.0.RELEASE.
Could not parse POM https://plugins.gradle.org/m2/org/springframework/boot/spring-boot-gradle-plugin/2.3.0.RELEASE/spring-boot-gradle-plugin-2.3.0.RELEASE.pom
Unable to resolve version for dependency 'org.apache.commons:commons-compress:jar'
build.gradle
plugins {
id 'org.springframework.boot' version '2.3.0.RELEASE'
id 'io.spring.dependency-management' version '1.0.9.RELEASE'
id 'java'
}
group = 'com.learn'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-web'
runtimeOnly 'com.oracle.ojdbc:ojdbc8'
testImplementation('org.springframework.boot:spring-boot-starter-test') {
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}
}
test {
useJUnitPlatform()
}

Cannot change dependencies of configuration ':implementation' after it has been included in dependency resolution

I have got a very basic build.gradle file.
plugins {
id 'org.springframework.boot' version '2.2.5.RELEASE'
id 'io.spring.dependency-management' version '1.0.8.RELEASE'
id 'java'
}
group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '11'
repositories {
mavenCentral()
}
bootJar{
mainClassName = "$mainClassName";
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'org.springframework.boot:spring-boot-starter-web'
testImplementation('org.springframework.boot:spring-boot-starter-test') {
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}
}
I get the following error when bootJar task is placed before dependencies block. When placed after the dependencies block i don't get an error.
What went wrong:
A problem occurred evaluating root project 'sample-project-spring-boot'.
Cannot change dependencies of configuration ':implementation' after it has been included in dependency resolution.

Resources