I got a project and it is built with gradle 6 or older version.
I've checked the other stakeoverflow discussion with compile/testCompile problem in gradle 7, and I change all the dependencies from compile/testCompile to api/testImplementation.
But it still doesn't work when I'm doing gradle build.
It still return with Configuration with name 'compile' not found
I've checked this:
Build error with gradle Could not find method testCompile()
What's the difference between implementation, api and compile in Gradle?
Here is my root gradle configuration:
buildscript {
repositories {
mavenCentral()
}
dependencies {
// https://github.com/google/protobuf-gradle-plugin
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.10'
}
}
plugins {
id 'application'
id 'java'
id 'java-library'
id "com.google.protobuf" version "0.8.10"
}
group 'com.ght'
version '61'
mainClassName = 'com.application'
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
// jcenter() is no longer support.
// jcenter()
mavenCentral()
}
sourceSets {
main {
proto {
srcDir 'src/main/protobuf'
include '**/*.protodevel'
}
}
}
dependencies {
testImplementation group: 'junit', name: 'junit', version: '4.12'
implementation group: 'com.google.protobuf', name: 'protobuf-java', version: '3.0.0'
// https://mvnrepository.com/artifact/ch.qos.logback/logback-classic
implementation group: 'ch.qos.logback', name: 'logback-classic', version: '1.1.3'
// https://mvnrepository.com/artifact/ch.qos.logback/logback-core
implementation group: 'ch.qos.logback', name: 'logback-core', version: '1.1.3'
// https://mvnrepository.com/artifact/org.slf4j/slf4j-implementation
implementation group: 'org.slf4j', name: 'slf4j-implementation', version: '1.7.26'
// https://mvnrepository.com/artifact/org.apache.commons/commons-lang3
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.2.1'
// https://mvnrepository.com/artifact/org.locationtech.jts/jts-core
implementation group: 'org.locationtech.jts', name: 'jts-core', version: '1.16.0'
// https://mvnrepository.com/artifact/org.apache.commons/commons-lang3
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.4'
// https://mvnrepository.com/artifact/com.vividsolutions/jts
implementation group: 'com.vividsolutions', name: 'jts', version: '1.13'
// https://mvnrepository.com/artifact/com.google.guava/guava
implementation group: 'com.google.guava', name: 'guava', version: '19.0'
// https://mvnrepository.com/artifact/org.apache.commons/commons-math3
implementation group: 'org.apache.commons', name: 'commons-math3', version: '3.5'
// https://mvnrepository.com/artifact/commons-logging/commons-logging
implementation group: 'commons-logging', name: 'commons-logging', version: '1.2'
}
protobuf {
// Configure the protoc executable
protoc {
// Download from repositories
artifact = 'com.google.protobuf:protoc:3.0.0'
}
generatedFilesBaseDir = "$projectDir/gen"
}
clean {
delete protobuf.generatedFilesBaseDir
}
jar{
from {
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
}
manifest {
attributes('Manifest-Version': archiveVersion, 'Main-Class': 'com.application')
}
exclude 'logback-test.xml'
exclude '**/schema/**'
exclude '**.proto'
}
Here is build error message:
A problem occurred configuring root project 'application'.
> Configuration with name 'compile' not found.
* Try:
> Run with --info or --debug option to get more log output.
* Exception is:
org.gradle.api.ProjectConfigurationException: A problem occurred configuring root project 'application'.
at org.gradle.configuration.project.LifecycleProjectEvaluator.wrapException(LifecycleProjectEvaluator.java:84)
at org.gradle.configuration.project.LifecycleProjectEvaluator.addConfigurationFailure(LifecycleProjectEvaluator.java:77)
at org.gradle.configuration.project.LifecycleProjectEvaluator.access$400(LifecycleProjectEvaluator.java:55)
at org.gradle.configuration.project.LifecycleProjectEvaluator$NotifyAfterEvaluate.run(LifecycleProjectEvaluator.java:255)
.
.
.
Caused by: org.gradle.api.artifacts.UnknownConfigurationException: Configuration with name 'compile' not found.
at org.gradle.api.internal.artifacts.configurations.DefaultConfigurationContainer.createNotFoundException(DefaultConfigurationContainer.java:108)
at org.gradle.api.internal.DefaultNamedDomainObjectCollection.getByName(DefaultNamedDomainObjectCollection.java:333)
at org.gradle.api.internal.artifacts.configurations.DefaultConfigurationContainer.getByName(DefaultConfigurationContainer.java:98)
at org.gradle.api.internal.artifacts.configurations.DefaultConfigurationContainer.getByName(DefaultConfigurationContainer.java:50)
.
.
.
at com.google.protobuf.gradle.ProtobufPlugin$_setupExtractIncludeProtosTask_closure21.doCall(ProtobufPlugin.groovy:369)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at org.gradle.util.internal.ClosureBackedAction.execute(ClosureBackedAction.java:73)
at org.gradle.util.internal.ConfigureUtil.configureTarget(ConfigureUtil.java:155)
at org.gradle.util.internal.ConfigureUtil.configureSelf(ConfigureUtil.java:131)
at org.gradle.api.internal.AbstractTask.configure(AbstractTask.java:666)
at org.gradle.api.DefaultTask.configure(DefaultTask.java:309)
.
.
.
gradle version: gradle 7.5
gradle JVM version: GraalVM version 17.0.3
IDE: intellij ide 2022.1.3
Thank you for any help.
You're using a very outdated version of the Protobuf Gradle plugin. Version 0.8.10 (2019) predates Gradle 7 (2021). The issue you're facing is likely to be fixed by upgrading the plugin.
plugins {
id "com.google.protobuf" version "0.8.19"
}
Related
I am new to sonarqube and trying to execute a code scan on a java/jaxrs backend with gradle.
My build.gradle is the following:
buildscript {
dependencies {
classpath group: "com.liferay", name: "com.liferay.gradle.plugins", version: "4.4.5"
classpath group: "org.sonarsource.scanner.gradle", name:"sonarqube-gradle-plugin", version:"3.3"
}
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
maven {
url "https://repository-cdn.liferay.com/nexus/content/groups/public"
}
}
}
apply plugin: "org.sonarqube"
apply plugin: "com.liferay.plugin"
dependencies {
compileOnly group: "javax.ws.rs", name: "javax.ws.rs-api", version: "2.1"
compileOnly group: "org.osgi", name: "org.osgi.service.component.annotations", version: "1.3.0"
compileOnly group: "org.osgi", name: "org.osgi.service.jaxrs", version: "1.0.0"
compile group: 'com.liferay', name: 'com.liferay.portal.remote.cors.api', version: '1.0.4'
compileInclude group: 'com.googlecode.json-simple', name: 'json-simple', version: '1.1.1'
compileOnly group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.5.5'
compileOnly group: 'org.apache.httpcomponents', name: 'httpcore', version: '4.4.9'
compileOnly group: 'org.apache.httpcomponents', name: 'httpmime', version: '4.5.5'
implementation group: 'com.liferay.portal', name: 'release.portal.api', version: '7.3.1-ga2'
implementation group: 'commons-lang', name: 'commons-lang', version: '2.6'
implementation group: 'com.google.code.gson', name: 'gson', version: '2.8.6'
//
implementation group: 'org.junit.platform', name: 'junit-platform-commons', version: '1.7.0'
testImplementation('org.junit.jupiter:junit-jupiter-api:5.4.2')
testRuntime('org.junit.jupiter:junit-jupiter-engine:5.4.2')
testCompile('org.junit.jupiter:junit-jupiter-params:5.4.2')
testImplementation group: 'org.junit.platform', name: 'junit-platform-launcher', version: '1.7.0'
testImplementation group: 'org.junit.platform', name: 'junit-platform-runner', version: '1.7.0'
testCompile group: 'com.googlecode.json-simple', name: 'json-simple', version: '1.1.1'
testImplementation group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.5.5'
testImplementation group: 'org.apache.httpcomponents', name: 'httpcore', version: '4.4.9'
testImplementation group: 'org.apache.httpcomponents', name: 'httpmime', version: '4.5.5'
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
task copyJar(type: Copy) {
from "build/libs"
into "../../../../files/osgi/modules/"
}
copyJar.dependsOn(build)
repositories {
maven {
url "https://repository-cdn.liferay.com/nexus/content/groups/public"
}
}
test {
useJUnitPlatform()
}
When I try to execute the sonar-scanner command from windows powershell or cmd:
.\gradlew sonarqube -Dsonar.projectKey=be_d254_enroll_center -Dsonar.host.url=http://localhost:9000 -Dsonar.login=1f774e64a98490b5e01646104342de340e40f263 -Dsonar.sources=src
I get the following error that points at another project be_256 different from the project from where I executed the command which is be_261
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':LR/rs/256/be_256'.
> Cannot add task 'downloadNode' as a task with that name already exists.
Config:
Sonarqube LTS 8.9.3
Gradle version 4.10.2
Java version 11
I tried to clear gradle cache but it did not work.
Any help is appreciated. Thanks.
Edit 1
I have been able to solve the previous error by completely uninstalling Gradle and re-installing it, I now have the following error:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':LR/rs/261/be_261'.
> Could not resolve all artifacts for configuration ':LR/resident_services/d261_update_address/be_d261_update_address:classpath'.
> Could not download sonar-scanner-api.jar (org.sonarsource.scanner.api:sonar-scanner-api:2.16.1.361)
> Could not get resource 'https://repository-cdn.liferay.com/nexus/content/groups/public/org/sonarsource/scanner/api/sonar-scanner-api/2.16.1.361/sonar-scanner-api-2.16.1.361.jar'.
> Could not GET 'https://repository-cdn.liferay.com/nexus/content/groups/public/org/sonarsource/scanner/api/sonar-scanner-api/2.16.1.361/sonar-scanner-api-2.16.1.361.jar'.
> Received fatal alert: handshake_failure
Edit 2
I am once again stuck on this issue, I have tried once again to clear gradle's cache but it did not work
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':LR/rs/256/be_256'.
> Cannot add task 'downloadNode' as a task with that name already exists.
This issue was fixed after I moved the BE folder to another directory.
I am trying to create dynamic query to a mongo database from spring boot gradle project.
My gradle version: 5.6.1
Here is my build.gradle file:
plugins {
id 'org.springframework.boot' version '2.2.2.RELEASE'
id 'io.spring.dependency-management' version '1.0.8.RELEASE'
id 'java'
}
group = 'com.onssoftware'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-data-mongodb'
// https://mvnrepository.com/artifact/com.querydsl/querydsl-mongodb
compile group: 'com.querydsl', name: 'querydsl-mongodb', version: '4.2.2'
// https://mvnrepository.com/artifact/com.querydsl/querydsl-apt
compile group: 'com.querydsl', name: 'querydsl-apt', version: '4.2.2'
//annotationProcessor group: 'com.querydsl', name: 'querydsl-apt', version: '4.2.2'
annotationProcessor "com.querydsl:querydsl-apt:4.2.2"
//annotationProcessor("org.springframework.data.mongodb.repository.support.MongoAnnotationProcessor")
testImplementation('org.springframework.boot:spring-boot-starter-test') {
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}
}
test {
useJUnitPlatform()
}
My application.properties file:
spring.data.mongodb.username = user
spring.data.mongodb.password = pass
spring.data.mongodb.host = 172.17.0.2
spring.data.mongodb.port = 27017
spring.data.mongodb.database = test_db
Problem is: Q classes are not generating for my Documents.
Any suggestion welcome. Thanks.
Possibly, duplicated with Java QueryDsl code generation does not generate Q class
And maybe it's because of Gradle version: try to check this https://github.com/ewerk/gradle-plugins/issues/112
Or you forget to include
compile group: 'org.mongodb.morphia', name: 'morphia', version: '1.3.2'
Meanwhile, I'll try to reproduce using #viktorgt repository
I made it working by adding both #Document and #Entity annotation.
import org.springframework.data.mongodb.core.mapping.Document;
import javax.persistence.Entity;
#Document
#Entity
public class MCQ {}
My build.gradle file is like:
// https://mvnrepository.com/artifact/org.hibernate/hibernate-annotations
compile group: 'org.hibernate', name: 'hibernate-annotations', version: '3.5.6-Final'
implementation 'org.springframework.boot:spring-boot-starter-data-mongodb'
// https://mvnrepository.com/artifact/com.querydsl/querydsl-mongodb
compile group: 'com.querydsl', name: 'querydsl-mongodb', version: '4.2.2'
// https://mvnrepository.com/artifact/com.querydsl/querydsl-apt
annotationProcessor "com.querydsl:querydsl-apt:4.2.2:jpa", "org.hibernate.javax.persistence:hibernate-jpa-2.1-api:1.0.2.Final"
// https://mvnrepository.com/artifact/com.google.code.morphia/morphia
//annotationProcessor group: 'com.google.code.morphia', name: 'morphia', version: '0.104'
// https://mvnrepository.com/artifact/org.mongodb.morphia/morphia
//annotationProcessor group: 'org.mongodb.morphia', name: 'morphia', version: '1.3.2'
//annotationProcessor("org.springframework.data.mongodb.repository.support.MongoAnnotationProcessor")
My gradle version: 5.6.2
i have a set of code that is using gradle to run the back end server. I am running gradle :bootRun in my terminal. When i run it, it begins to process and then throws this huge error about file location. How can I fix this if i can even fix this.
Parallel execution is an incubating feature.
> Configure project :owf-example-widgets
Gradle now uses separate output directories for each JVM language, but this build assumes a single directory for all classes from a source set. This behaviour has been deprecated and is scheduled to be removed in Gradle 5.0
at build_cnhv1cccaip845qupsm2wplss.run(C:\Users\ojandali\Desktop\ozone-temp-goss\ozone-framework-server\owf-framework\owf-example-widgets\build.gradle:31)
(Run with --stacktrace to get the full stack trace of this deprecation warning.)
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'owf-framework'.
> Could not resolve all files for configuration ':runtime'.
> Could not find org.ozoneplatform:owf-appconfig:0.9.1-0.
Searched in the following locations:
file:/C:/Users/ojandali/.m2/repository/org/ozoneplatform/owf-appconfig/0.9.1-0/owf-appconfig-0.9.1-0.pom
file:/C:/Users/ojandali/.m2/repository/org/ozoneplatform/owf-appconfig/0.9.1-0/owf-appconfig-0.9.1-0.jar
https://repo1.maven.org/maven2/org/ozoneplatform/owf-appconfig/0.9.1-0/owf-appconfig-0.9.1-0.pom
https://repo1.maven.org/maven2/org/ozoneplatform/owf-appconfig/0.9.1-0/owf-appconfig-0.9.1-0.jar
https://repo.grails.org/grails/core/org/ozoneplatform/owf-appconfig/0.9.1-0/owf-appconfig-0.9.1-0.pom
https://repo.grails.org/grails/core/org/ozoneplatform/owf-appconfig/0.9.1-0/owf-appconfig-0.9.1-0.jar
http://repository.springsource.com/maven/bundles/release/org/ozoneplatform/owf-appconfig/0.9.1-0/owf-appconfig-0.9.1-0.pom
http://repository.springsource.com/maven/bundles/release/org/ozoneplatform/owf-appconfig/0.9.1-0/owf-appconfig-0.9.1-0.jar
http://repository.springsource.com/maven/bundles/external/org/ozoneplatform/owf-appconfig/0.9.1-0/owf-appconfig-0.9.1-0.pom
http://repository.springsource.com/maven/bundles/external/org/ozoneplatform/owf-appconfig/0.9.1-0/owf-appconfig-0.9.1-0.jar
https://packages.atlassian.com/3rdparty/org/ozoneplatform/owf-appconfig/0.9.1-0/owf-appconfig-0.9.1-0.pom
https://packages.atlassian.com/3rdparty/org/ozoneplatform/owf-appconfig/0.9.1-0/owf-appconfig-0.9.1-0.jar
Required by:
project :
> Could not find org.ozoneplatform:owf-auditing:1.3.2-0.
Searched in the following locations:
file:/C:/Users/ojandali/.m2/repository/org/ozoneplatform/owf-auditing/1.3.2-0/owf-auditing-1.3.2-0.pom
file:/C:/Users/ojandali/.m2/repository/org/ozoneplatform/owf-auditing/1.3.2-0/owf-auditing-1.3.2-0.jar
https://repo1.maven.org/maven2/org/ozoneplatform/owf-auditing/1.3.2-0/owf-auditing-1.3.2-0.pom
https://repo1.maven.org/maven2/org/ozoneplatform/owf-auditing/1.3.2-0/owf-auditing-1.3.2-0.jar
https://repo.grails.org/grails/core/org/ozoneplatform/owf-auditing/1.3.2-0/owf-auditing-1.3.2-0.pom
https://repo.grails.org/grails/core/org/ozoneplatform/owf-auditing/1.3.2-0/owf-auditing-1.3.2-0.jar
http://repository.springsource.com/maven/bundles/release/org/ozoneplatform/owf-auditing/1.3.2-0/owf-auditing-1.3.2-0.pom
http://repository.springsource.com/maven/bundles/release/org/ozoneplatform/owf-auditing/1.3.2-0/owf-auditing-1.3.2-0.jar
http://repository.springsource.com/maven/bundles/external/org/ozoneplatform/owf-auditing/1.3.2-0/owf-auditing-1.3.2-0.pom
http://repository.springsource.com/maven/bundles/external/org/ozoneplatform/owf-auditing/1.3.2-0/owf-auditing-1.3.2-0.jar
https://packages.atlassian.com/3rdparty/org/ozoneplatform/owf-auditing/1.3.2-0/owf-auditing-1.3.2-0.pom
https://packages.atlassian.com/3rdparty/org/ozoneplatform/owf-auditing/1.3.2-0/owf-auditing-1.3.2-0.jar
Required by:
project :
> Could not find org.ozoneplatform:owf-security:4.0.4-0.
Searched in the following locations:
file:/C:/Users/ojandali/.m2/repository/org/ozoneplatform/owf-security/4.0.4-0/owf-security-4.0.4-0.pom
file:/C:/Users/ojandali/.m2/repository/org/ozoneplatform/owf-security/4.0.4-0/owf-security-4.0.4-0.jar
https://repo1.maven.org/maven2/org/ozoneplatform/owf-security/4.0.4-0/owf-security-4.0.4-0.pom
https://repo1.maven.org/maven2/org/ozoneplatform/owf-security/4.0.4-0/owf-security-4.0.4-0.jar
https://repo.grails.org/grails/core/org/ozoneplatform/owf-security/4.0.4-0/owf-security-4.0.4-0.pom
https://repo.grails.org/grails/core/org/ozoneplatform/owf-security/4.0.4-0/owf-security-4.0.4-0.jar
http://repository.springsource.com/maven/bundles/release/org/ozoneplatform/owf-security/4.0.4-0/owf-security-4.0.4-0.pom
http://repository.springsource.com/maven/bundles/release/org/ozoneplatform/owf-security/4.0.4-0/owf-security-4.0.4-0.jar
http://repository.springsource.com/maven/bundles/external/org/ozoneplatform/owf-security/4.0.4-0/owf-security-4.0.4-0.pom
http://repository.springsource.com/maven/bundles/external/org/ozoneplatform/owf-security/4.0.4-0/owf-security-4.0.4-0.jar
https://packages.atlassian.com/3rdparty/org/ozoneplatform/owf-security/4.0.4-0/owf-security-4.0.4-0.pom
https://packages.atlassian.com/3rdparty/org/ozoneplatform/owf-security/4.0.4-0/owf-security-4.0.4-0.jar
Required by:
project :
> Could not find org.ozoneplatform:owf-messaging:1.19.1-0.
Searched in the following locations:
file:/C:/Users/ojandali/.m2/repository/org/ozoneplatform/owf-messaging/1.19.1-0/owf-messaging-1.19.1-0.pom
file:/C:/Users/ojandali/.m2/repository/org/ozoneplatform/owf-messaging/1.19.1-0/owf-messaging-1.19.1-0.jar
https://repo1.maven.org/maven2/org/ozoneplatform/owf-messaging/1.19.1-0/owf-messaging-1.19.1-0.pom
https://repo1.maven.org/maven2/org/ozoneplatform/owf-messaging/1.19.1-0/owf-messaging-1.19.1-0.jar
https://repo.grails.org/grails/core/org/ozoneplatform/owf-messaging/1.19.1-0/owf-messaging-1.19.1-0.pom
https://repo.grails.org/grails/core/org/ozoneplatform/owf-messaging/1.19.1-0/owf-messaging-1.19.1-0.jar
http://repository.springsource.com/maven/bundles/release/org/ozoneplatform/owf-messaging/1.19.1-0/owf-messaging-1.19.1-0.pom
http://repository.springsource.com/maven/bundles/release/org/ozoneplatform/owf-messaging/1.19.1-0/owf-messaging-1.19.1-0.jar
http://repository.springsource.com/maven/bundles/external/org/ozoneplatform/owf-messaging/1.19.1-0/owf-messaging-1.19.1-0.pom
http://repository.springsource.com/maven/bundles/external/org/ozoneplatform/owf-messaging/1.19.1-0/owf-messaging-1.19.1-0.jar
https://packages.atlassian.com/3rdparty/org/ozoneplatform/owf-messaging/1.19.1-0/owf-messaging-1.19.1-0.pom
https://packages.atlassian.com/3rdparty/org/ozoneplatform/owf-messaging/1.19.1-0/owf-messaging-1.19.1-0.jar
Required by:
project :
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 10s
I am trying to figure out why the files are not being located or found.
UPDATE
this is the build.gradle file... I am trying to run gradle :bootRun
buildscript {
ext {
grailsVersion = '3.3.2'
gormVersion = '6.1.8.RELEASE'
}
repositories {
mavenLocal()
mavenCentral()
maven { url "https://plugins.gradle.org/m2/" }
maven { url 'https://repo.grails.org/grails/core' }
jcenter()
}
dependencies {
classpath group: 'io.spring.gradle', name: 'dependency-management-plugin', version: '1.0.4.RELEASE'
classpath group: 'org.grails', name: 'grails-gradle-plugin', version: grailsVersion
classpath group: 'org.grails.plugins', name: 'hibernate5', version: gormVersion - ".RELEASE"
classpath group: 'org.grails.plugins', name: 'database-migration', version: '3.0.3'
}
}
group 'org.ozoneplatform'
version '7.17.2-0'
apply plugin: 'idea'
apply plugin: 'maven'
apply plugin: 'java'
apply plugin: 'groovy'
apply plugin: 'war'
apply plugin: 'org.grails.grails-web'
apply plugin: 'org.grails.grails-gsp'
ext {
releaseVersion = version.toString().replaceFirst("-", ".")
tomcatBundleStaging = "$buildDir/staging/bundle"
}
repositories {
mavenLocal()
mavenCentral()
maven { url 'https://repo.grails.org/grails/core' }
maven { url 'http://repository.springsource.com/maven/bundles/release' }
maven { url 'http://repository.springsource.com/maven/bundles/external' }
maven { url 'https://packages.atlassian.com/3rdparty/' }
}
dependencyManagement {
imports {
mavenBom 'org.grails:grails-bom:' + grailsVersion
mavenBom 'org.ozoneplatform:ozone-classic-bom:7.17.2-0'
}
applyMavenExclusions false
}
grails {
plugins {
compile project(':owf-example-widgets')
}
}
configurations {
customTomcat {}
drivers {}
runtime.extendsFrom drivers
}
dependencies {
// Ozone
compile group: 'org.ozoneplatform', name: 'owf-appconfig', version: '0.9.1-0'
compile group: 'org.ozoneplatform', name: 'owf-auditing', version: '1.3.2-0'
compile group: 'org.ozoneplatform', name: 'owf-security', version: '4.0.4-0'
compile group: 'org.ozoneplatform', name: 'owf-messaging', version: '1.19.1-0'
customTomcat(group: 'org.ozoneplatform', name: 'owf-custom-tomcat', version: '1.2.3-0') {
artifact {
name = 'owf-custom-tomcat'
type = 'zip'
}
}
// Spring Boot
compile group: 'org.springframework.boot', name: 'spring-boot-autoconfigure'
compile group: 'org.springframework.boot', name: 'spring-boot-starter-logging'
provided group: 'org.springframework.boot', name: 'spring-boot-starter-tomcat'
// Grails
compile group: 'org.grails', name: 'grails-core'
compile group: 'org.grails', name: 'grails-web-boot'
compile group: 'org.grails', name: 'grails-logging'
compile group: 'org.grails', name: 'grails-plugin-rest'
compile group: 'org.grails', name: 'grails-plugin-databinding'
compile group: 'org.grails', name: 'grails-plugin-i18n'
compile group: 'org.grails', name: 'grails-plugin-services'
compile group: 'org.grails', name: 'grails-plugin-url-mappings'
compile group: 'org.grails', name: 'grails-plugin-interceptors'
compile group: 'org.grails.plugins', name: 'cache'
compile group: 'org.grails.plugins', name: 'cache-ehcache'
compile group: 'org.ehcache', name: 'ehcache'
compile group: 'org.grails.plugins', name: 'async'
compile group: 'org.grails.plugins', name: 'scaffolding'
compile group: 'org.grails.plugins', name: 'events'
compile group: 'org.grails.plugins', name: 'hibernate5'
compile group: 'org.grails.plugins', name: 'gsp'
compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind'
console group: 'org.grails', name: 'grails-console'
profile group: 'org.grails.profiles', name: 'web'
runtime group: 'org.glassfish.web', name: 'el-impl'
runtime group: 'com.h2database', name: 'h2'
runtime group: 'org.apache.tomcat', name: 'tomcat-jdbc'
drivers group: 'org.postgresql', name: 'postgresql'
testCompile group: 'org.grails', name: 'grails-gorm-testing-support'
testCompile group: 'org.grails', name: 'grails-web-testing-support'
testCompile group: 'org.grails', name: 'grails-datastore-rest-client'
testRuntime group: 'cglib', name: 'cglib-nodep'
// Grails Plugins
compile group: 'org.grails.plugins', name: 'converters'
compile group: 'org.grails.plugins', name: 'quartz'
compile group: 'org.grails.plugins', name: 'grails-pretty-time'
// Other
compile group: 'com.google.code.findbugs', name: 'jsr305'
compile group: 'org.hibernate', name: 'hibernate-core'
compile group: 'org.apache.httpcomponents', name: 'httpcore'
compile group: 'org.apache.httpcomponents', name: 'httpclient'
compile group: 'commons-fileupload', name: 'commons-fileupload'
}
bootRun {
jvmArgs('-Dspring.output.ansi.enabled=always',
'-Duser=testAdmin1',
'-Dowf.db.init',
'-Ddisable.auto.recompile=false',
'-Xverify:none')
addResources = false
}
war {
// Exclude the Spring .xml configuration files from the .war
// They will be copied to the Tomcat classpath at /tomcat/libs
rootSpec.exclude('ozone/framework/**')
}
idea {
module {
excludeDirs += file('archive')
excludeDirs += file('src/main/resources/public')
}
}
apply from: 'gradle/create-bundle.gradle'
apply from: 'gradle/report-test-coverage.gradle'
task wrapper(type: Wrapper) {
gradleVersion = '4.2.1'
}
I cannot find
compile group: 'org.ozoneplatform', name: 'owf-appconfig', version: '0.9.1-0'
compile group: 'org.ozoneplatform', name: 'owf-auditing', version: '1.3.2-0'
compile group: 'org.ozoneplatform', name: 'owf-security', version: '4.0.4-0'
compile group: 'org.ozoneplatform', name: 'owf-messaging', version: '1.19.1-0'
on Maven Central, I suspect that is the issue, because that is
They seem to have different names, see:
https://search.maven.org/search?q=g:org.ozoneplatform
For example
compile group: 'org.ozoneplatform', name: 'ozone-security', version: '4.0.3'
should work.
It is also possible for you to build the missing dependencies yourself, for example by checking out this repository and doing a build:
https://github.com/ozoneplatform/owf-security
I'm in the process of converting a JDK 8 app over to JDK 11. It builds using Gradle and uses JPA/Hibernate under the hood. I've upgraded the necessary Gradle modules, Spring Boot is now 2.1 and it's using the Gradle 5.1 wrapper. It uses QueryDSL JPA annotation processing to build the Q* classes off of a PostgreSQL database.
The following task in the build script generates the aformentioned classes:
compileJava {
doFirst {
generatedSourcesDir.mkdirs();
}
options.compilerArgs += [
'-s', generatedSourcesDir,
]
// dependsOn generateQueryDSL
}
And the commented-out QueryDSL generation task is:
task generateQueryDSL(type: JavaCompile, group: 'build', description: 'Generates the QueryDSL query types') {
source = sourceSets.main.java
classpath = configurations.compile + configurations.querydslapt
options.compilerArgs = [
"-proc:only",
"-processor", "com.querydsl.apt.jpa.JPAAnnotationProcessor"
]
destinationDir = generatedSourcesDir
}
The main error I'm receiving when running the Gradle compileJava task is the following:
* What went wrong:
Execution failed for task ':app-base:compileJava'.
> java.lang.NoClassDefFoundError: javax/persistence/Entity
I'm using the following build dependency:
compile group: 'org.eclipse.persistence', name: 'javax.persistence', version: '2.2.1'
Which hasn't been updated since last summer. Is there any way I can make the JavaCompile Gradle task work with JDK 11 and JPA 2.2?
UPDATE 2/1/2019 - build.gradle for the API project as requested by a user (works with JDK 11 and Spring Boot 2.1 and Gradle 4.8, it needs significant cleanup though for Gradle 5)
buildscript {
repositories {
jcenter()
mavenLocal()
mavenCentral()
maven { url "http://repo.spring.io/libs-release" }
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:2.1.2.RELEASE")
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
apply plugin: "jacoco"
jar {
enabled = true
}
repositories {
mavenLocal()
mavenCentral()
maven { url "http://repo.spring.io/libs-release" }
}
ext {
generatedSourcesDir = file("${buildDir}/generated-sources")
pojogenGeneratedDir = file("src/pojogen")
}
sourceSets {
main {
java {
srcDir "src/main/java"
srcDir pojogenGeneratedDir
srcDir generatedSourcesDir
}
}
}
configurations {
provided
compile.extendsFrom provided
}
compileJava {
doFirst {
generatedSourcesDir.mkdirs();
}
options.compilerArgs += [
'-s', generatedSourcesDir,
]
}
jar {
enabled = true
}
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
dependencies {
/*
SPRING
*/
testCompile("org.springframework.boot:spring-boot-starter-test:2.1.2.RELEASE")
// tag::tomcat[]
compile("org.springframework.boot:spring-boot-starter-web:2.1.2.RELEASE") {
exclude module: "spring-boot-starter-jetty:2.1.2.RELEASE"
}
compile("org.springframework.boot:spring-boot-starter-tomcat:2.1.2.RELEASE")
// end::tomcat[]
// tag::actuator[]
compile("org.springframework.boot:spring-boot-starter-actuator:2.1.2.RELEASE")
compile("org.springframework.boot:spring-boot-starter-security:2.1.2.RELEASE")
compile("org.springframework.boot:spring-boot-starter-data-jpa:2.1.2.RELEASE")
compile("org.springframework.boot:spring-boot-starter-batch:2.1.2.RELEASE")
compile("org.springframework.boot:spring-boot-devtools:2.1.2.RELEASE")
// end::actuator[]
/*
APACHE COMMONS
*/
// https://mvnrepository.com/artifact/org.apache.commons/commons-lang3
compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.8.1'
// https://mvnrepository.com/artifact/commons-io/commons-io
compile group: 'commons-io', name: 'commons-io', version: '2.6'
/*
GOOGLE GUAVA
*/
// https://mvnrepository.com/artifact/com.google.guava/guava
compile group: 'com.google.guava', name: 'guava', version: '27.0.1-jre'
/*
LOGBACK
*/
// https://mvnrepository.com/artifact/ch.qos.logback/logback-classic
testCompile group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.3'
/*
MOCKITO
*/
// https://mvnrepository.com/artifact/org.mockito/mockito-core
testCompile group: 'org.mockito', name: 'mockito-core', version: '2.23.4'
/*
JWT
*/
// https://mvnrepository.com/artifact/io.jsonwebtoken/jjwt
compile group: 'io.jsonwebtoken', name: 'jjwt', version: '0.9.1'
/*
MAIL
*/
// https://mvnrepository.com/artifact/com.sun.mail/javax.mail
compile group: 'com.sun.mail', name: 'javax.mail', version: '1.6.2'
// https://mvnrepository.com/artifact/javax.mail/javax.mail-api
compile group: 'javax.mail', name: 'javax.mail-api', version: '1.6.2'
/*
SWAGGER
*/
// https://mvnrepository.com/artifact/io.springfox/springfox-swagger2
compile group: 'io.springfox', name: 'springfox-swagger2', version: '2.9.2'
// https://mvnrepository.com/artifact/io.springfox/springfox-swagger-ui
compile group: 'io.springfox', name: 'springfox-swagger-ui', version: '2.9.2'
/*
PASSWORD VALIDATOR
*/
// https://mvnrepository.com/artifact/org.passay/passay
compile group: 'org.passay', name: 'passay', version: '1.3.1'
/*
LOMBOK
*/
// https://mvnrepository.com/artifact/org.projectlombok/lombok
provided group: 'org.projectlombok', name: 'lombok', version: '1.18.4'
/*
Thymeleaf
*/
// // https://mvnrepository.com/artifact/org.thymeleaf/thymeleaf
// compile group: 'org.thymeleaf', name: 'thymeleaf', version: '3.0.9.RELEASE'
//
// // https://mvnrepository.com/artifact/org.thymeleaf/thymeleaf-spring4
// compile group: 'org.thymeleaf', name: 'thymeleaf-spring4', version: '3.0.9.RELEASE'
/*
H2 (unit testing)
*/
// https://mvnrepository.com/artifact/com.h2database/h2
testCompile group: 'com.h2database', name: 'h2', version: '1.4.197'
/*
Thumbnail tools
*/
// https://mvnrepository.com/artifact/net.coobird/thumbnailator
compile group: 'net.coobird', name: 'thumbnailator', version: '0.4.8'
/*
JUNIT
*/
testCompile("junit:junit")
}
/*
BUILD EXCLUSIONS
*/
test {
systemProperties 'property': 'value'
testLogging {
events "passed", "skipped", "failed", "standardOut", "standardError"
}
}
/*
JaCoCo
*/
jacoco {
toolVersion = "0.7.6.201602180812"
reportsDir = file("$buildDir/customJacocoReportDir")
}
jacocoTestReport {
reports {
xml.enabled false
csv.enabled false
html.destination "${buildDir}/jacocoHtml"
}
}
I got it to work with JDK 11 by rolling back Gradle to 4.8 and rolling back Hibernate dependencies. Ask further if interested in exact dependencies I'm using.
I'm running my gradle project with "gradle bootrun" on a cmd prompt window.
The error I get is this:
What went wrong:
A problem occurred configuring root project 'kyp4-backend'.
Could not resolve all artifacts for configuration ':classpath'.
Could not find org.springframework.boot:spring-boot-gradle-plugin:1.4.0.BUILD-SNAPSHOT.
Searched in the following locations:
https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-gradle-plugin/1.4.0.BUILD-SNAPSHOT/maven-metadata.xml <-- PRODUCES 404 ERROR when you go to page
https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-gradle-plugin/1.4.0.BUILD-SNAPSHOT/spring-boot-gradle-plugin-1.4.0.BUILD-SNAPSHOT.pom <-- PRODUCES 404 ERROR when you go to page
https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-gradle-plugin/1.4.0.BUILD-SNAPSHOT/spring-boot-gradle-plugin-1.4.0.BUILD-SNAPSHOT.jar <-- PRODUCES 404 ERROR when you go to page
Required by:
project :
************ GRADLE *****************
So here's my build.gradle file:
buildscript {
ext {
springBootVersion = '1.5.3.RELEASE'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.4.0.BUILD-SNAPSHOT") ***<-- THIS DOESN'T EXIST on repo.Spring.io. Only 1.2.0 = 5.x*** or ***<-- on repo.spring.io***
}
}
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'eclipse'
apply plugin: 'spring-boot'
apply plugin: 'org.springframework.boot'
//apply plugin: 'war'
version = '0.0.1'
sourceCompatibility = 1.8
repositories {
jcenter()
mavenCentral()
flatDir {
dirs 'repository'
}
mavenCentral()
}
ext {
springCloudVersion = 'Edgware.SR3'
}
dependencies {
compile('org.springframework.boot:spring-boot-starter-aop')
compile('org.springframework.boot:spring-boot-starter-security')
compile('org.springframework.boot:spring-boot-starter-web')
compile("org.springframework.boot:spring-boot-devtools")
compile('org.springframework.boot:spring-boot-starter-actuator')
compile group: 'joda-time', name: 'joda-time'
compile group: 'com.myfolder', name: 'all_pfs', version: '7.1.9'
compile group: 'com.myfolder', name: 'pfs-client', version: '7.1.9'
compile group: 'com.myfolder.pfs.wic', name: 'pfs-wic', version: '1.1.0.RC3'
compile group: 'com.picketlink.picketlink', name: 'picketlink-fed', version: '2.0.3-SNAPSHOT'
compile group: 'commons-httpclient', name: 'commons-httpclient', version: '3.1'
compile group: 'commons-lang', name: 'commons-lang', version: '2.6'
compile group: 'org.apache.httpcomponents', name: 'httpclient'
compile group: 'xstream', name: 'xstream', version: '1.2.2'
compile group: 'javax.ejb', name: 'javax.ejb-api', version: '3.2'
compile group: 'io.springfox', name: 'springfox-swagger2', version:'2.6.1'
compile group: 'io.springfox', name: 'springfox-swagger-ui', version:'2.6.1'
compile group: 'org.apache.commons', name: 'commons-io', version: '1.3.2'
compile group: 'commons-beanutils', name: 'commons-beanutils', version: '1.8.3'
compile group: 'org.codehaus.jackson', name: 'jackson-mapper-asl', version: '1.9.13'
compile group: 'org.springframework', name: 'spring-messaging', version: '4.2.6.RELEASE'
compile group: 'org.springframework', name: 'spring-websocket', version: '4.3.11.RELEASE'
compile('org.springframework.boot:spring-boot-starter-test')
compile group: 'org.springframework.boot', name: 'spring-boot-starter-data-jpa', version: '1.5.6.RELEASE'
testCompile group: 'com.microsoft.sqlserver', name: 'sqljdbc4', version: '4.0'
compile name: "sqljdbc4-4.0"
//Added to implement slf4j logger
compile group: 'org.slf4j', name:'slf4j-api', version: '1.7.2'
//compile group: 'ch.qos.logback', name:'logback-classic', version: '1.0.9'
//compile group: 'ch.qos.logback', name:'logback-core', version: '1.0.9'
// jsoup HTML parser library # https://jsoup.org/
compile 'org.jsoup:jsoup:1.11.3'
compile group: 'com.datastax.cassandra',name: 'cassandra-driver-core',version:'3.2.0'
compile('org.springframework.boot:spring-boot-starter-data-cassandra')
compile('org.projectlombok:lombok:1.18.2')
compile group: 'com.myfolder.service.fusion.audit.client', name: 'audit-client', version: '2.0.1.RELEASE'
compile group: 'org.apache.httpcomponents', name: 'httpasyncclient', version: '4.1.3'
}
dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
}
}
But this is all starting with org.springframework.boot/.context/web.client does not exist:
Here's a couple images to show:
I deleted the Netbeans CACHE and let Netbeans rebuild projects and indicies... still, no joy!
Any help or insight would be greatly appreciated.
You have configured your buildscript to use Maven Central as its only repository:
repositories {
mavenCentral()
}
You have also configured it to depend on 1.4.0.BUILD-SNAPSHOT of Spring Boot's Gradle Plugin:
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.4.0.BUILD-SNAPSHOT")
}
Snapshots are not published to Maven Central, only releases are published there. Milestones and snapshots are published to https://repo.spring.io. Specifically, snapshots are available from https://repo.spring.io/snapshot and milestones are available from https://repo.spring.io/milestone. You can find 1.4.0.BUILD-SNAPSHOT of Boot's Gradle plugin here.
If you want to use a snapshot version of Spring Boot, you should add https://repo.spring.io/snapshot and https://repo.spring.io/milestone to the configured repositories:
repositories {
mavenCentral()
maven { url 'https://repo.spring.io/snapshot' }
maven { url 'https://repo.spring.io/milestone' }
}
The milestone repository is required as a Spring Boot snapshot may have milestone dependencies.
Alternatively, and particularly given that 1.4.0 is rather old now and no longer supported, you may want to upgrade to a more recent release. At the time of writing, 1.5.17.RELEASE is the latest in the 1.x line and 2.1.0.RELEASE is the latest in the 2.x line.
You could upgrade to 1.5.17.RELEASE like this:
buildscript {
ext {
springBootVersion = '1.5.17.RELEASE'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:$springBootVersion")
}
}