英文:
How to fix gradle build failed due to void org.gradle.api.internal.artifacts.dsl.LazyPublishArtifact.<init>(org.gradle.api.provider.Provider) error?
问题
I am getting following exception when I try to build the spring boot project using Gradle build command. The code comiples and runs fine in IntelliJ Idea.
PS C:\SVN\Dactyl\IIOTWizards\SCADA\Trunk\source\Services\universal-service> gradle build
FAILURE: Build failed with an exception.
* What went wrong:
'void org.gradle.api.internal.artifacts.dsl.LazyPublishArtifact.<init>(org.gradle.api.provider.Provider)'
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 657ms
This is my build.gradle file.
plugins {
id 'org.springframework.boot' version '2.6.4'
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id 'java'
}
group = 'com.iiot.wizards'
version = '0.0.1-SNAPSHOT'
//sourceCompatibility = '1.8'
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}
repositories {
mavenCentral()
}
dependencies {
implementation files('lib/connection-manager-2.0.0.1.jar')
implementation files('lib/dlms-lib-2.0.0.1.jar')
// ... (omitted other dependencies for brevity)
test {
useJUnitPlatform()
}
}
英文:
I am getting following exception when I try to build the spring boot project using Gradle build command. The code comiples and runs fine in IntelliJ Idea.
PS C:\SVN\Dactyl\IIOTWizards\SCADA\Trunk\source\Services\universal-service> gradle build
FAILURE: Build failed with an exception.
* What went wrong:
'void org.gradle.api.internal.artifacts.dsl.LazyPublishArtifact.<init>(org.gradle.api.provider.Provider)'
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 657ms
This is my build.gradle file.
plugins {
id 'org.springframework.boot' version '2.6.4'
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id 'java'
}
group = 'com.iiot.wizards'
version = '0.0.1-SNAPSHOT'
//sourceCompatibility = '1.8'
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}
repositories {
mavenCentral()
}
dependencies {
implementation files('lib/connection-manager-2.0.0.1.jar')
implementation files('lib/dlms-lib-2.0.0.1.jar')
implementation files('lib/emdb-entities-2.0.0.1.jar')
implementation files('lib/emdb-model-2.0.0.1.jar')
implementation files('lib/emflex-ansi-meter-reader-2.0.0.1.jar')
implementation files('lib/emflex-dlms-meter-reader-2.0.0.1.jar')
implementation files('lib/iiot-wizards-common-2.0.0.1.jar')
implementation files('lib/iiot-wizards-communication-2.0.0.1.jar')
implementation files('lib/iiot-wizards-dnp3-2.0.0.1.jar')
implementation files('lib/iiot-wizards-dnp3-meter-reader-2.0.0.1.jar')
implementation files('lib/iiot-wizards-history-data-provider-2.0.0.1.jar')
implementation files('lib/iiot-wizards-history-data-writers-2.0.0.1.jar')
implementation files('lib/iiot-wizards-licensing-2.0.0.1.jar')
implementation files('lib/iiot-wizards-local-data-cache-manager-2.0.0.1.jar')
implementation files('lib/iiot-wizards-log-manager-2.0.0.1.jar')
implementation files('lib/iiot-wizards-messaging-2.0.0.1.jar')
implementation files('lib/iiot-wizards-mio-meter-reader-2.0.0.1.jar')
implementation files('lib/iiot-wizards-modbus-gprs-read-meter-2.0.0.1.jar')
implementation files('lib/iiot-wizards-modbus-meter-reader-2.0.0.1.jar')
implementation files('lib/iiot-wizards-scheduler-2.0.0.1.jar')
implementation files('lib/modbus-master-2.0.0.1.jar')
implementation files('lib/TinyLog-2.0.0.1.jar')
implementation files('lib/Utils-2.0.0.1.jar')
implementation files('lib/jniwrap-3.12.jar')
implementation files('lib/GoogleProtocolBuffer_2.6.1.jar')
implementation files('lib/comm.jar')
implementation files('lib/RXTXcomm.jar')
implementation files('lib/iiot-wizards-history-entities-2.0.0.1.jar')
// https://mvnrepository.com/artifact/commons-io/commons-io
implementation group: 'commons-io', name: 'commons-io', version: '2.11.0'
// https://mvnrepository.com/artifact/org.apache.commons/commons-lang3
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.12.0'
// https://mvnrepository.com/artifact/org.eclipse.paho/org.eclipse.paho.client.mqttv3
implementation group: 'org.eclipse.paho', name: 'org.eclipse.paho.client.mqttv3', version: '1.2.5'
// https://mvnrepository.com/artifact/com.rabbitmq/amqp-client
implementation group: 'com.rabbitmq', name: 'amqp-client', version: '5.13.1'
// https://mvnrepository.com/artifact/org.apache.commons/commons-compress
implementation group: 'org.apache.commons', name: 'commons-compress', version: '1.21'
// https://mvnrepository.com/artifact/commons-beanutils/commons-beanutils
implementation group: 'commons-beanutils', name: 'commons-beanutils', version: '1.9.4'
// https://mvnrepository.com/artifact/commons-cli/commons-cli
implementation group: 'commons-cli', name: 'commons-cli', version: '1.4'
// https://mvnrepository.com/artifact/org.apache.commons/commons-collections4
implementation group: 'org.apache.commons', name: 'commons-collections4', version: '4.4'
// https://mvnrepository.com/artifact/commons-logging/commons-logging
implementation group: 'commons-logging', name: 'commons-logging', version: '1.2'
// https://mvnrepository.com/artifact/org.apache.commons/commons-math3
implementation group: 'org.apache.commons', name: 'commons-math3', version: '3.6.1'
// https://mvnrepository.com/artifact/org.apache.commons/commons-text
implementation group: 'org.apache.commons', name: 'commons-text', version: '1.9'
// // https://mvnrepository.com/artifact/gnu.io/rxtx
// implementation group: 'gnu.io', name: 'rxtx', version: '2.1.7'
// https://mvnrepository.com/artifact/org.hibernate/hibernate-core
implementation group: 'org.hibernate', name: 'hibernate-core', version: '5.5.7.Final'
// https://mvnrepository.com/artifact/org.apiguardian/apiguardian-api
implementation group: 'org.apiguardian', name: 'apiguardian-api', version: '1.1.2'
// https://mvnrepository.com/artifact/org.dom4j/dom4j
implementation group: 'org.dom4j', name: 'dom4j', version: '2.1.3'
// https://mvnrepository.com/artifact/com.sun.xml.fastinfoset/FastInfoset
implementation group: 'com.sun.xml.fastinfoset', name: 'FastInfoset', version: '2.0.0'
// https://mvnrepository.com/artifact/org.hamcrest/hamcrest-core
testImplementation group: 'org.hamcrest', name: 'hamcrest-core', version: '2.2'
// https://mvnrepository.com/artifact/org.hibernate.javax.persistence/hibernate-jpa-2.1-api
implementation group: 'org.hibernate.javax.persistence', name: 'hibernate-jpa-2.1-api', version: '1.0.2.Final'
// // https://mvnrepository.com/artifact/org.hibernate.ogm/hibernate-ogm-mongodb
// implementation group: 'org.hibernate.ogm', name: 'hibernate-ogm-mongodb', version: '5.4.1.Final'
// https://mvnrepository.com/artifact/com.sun.istack/istack-commons-runtime
implementation group: 'com.sun.istack', name: 'istack-commons-runtime', version: '4.1.0-M1'
// https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-annotations
implementation 'com.fasterxml.jackson.core:jackson-annotations:2.13.0'
// https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core
implementation 'com.fasterxml.jackson.core:jackson-core:2.13.0'
// https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind
implementation 'com.fasterxml.jackson.core:jackson-databind:2.13.0'
// https://mvnrepository.com/artifact/org.javassist/javassist
implementation 'org.javassist:javassist:3.28.0-GA'
// https://mvnrepository.com/artifact/javax.annotation/javax.annotation-api
implementation 'javax.annotation:javax.annotation-api:1.3.2'
// https://mvnrepository.com/artifact/io.dropwizard.metrics/metrics-core
implementation 'io.dropwizard.metrics:metrics-core:4.2.4'
// https://mvnrepository.com/artifact/org.jboss.narayana.jta/narayana-jta
testImplementation 'org.jboss.narayana.jta:narayana-jta:5.12.1.Final'
// https://mvnrepository.com/artifact/io.netty/netty-all
implementation 'io.netty:netty-all:4.1.67.Final'
// https://mvnrepository.com/artifact/com.rabbitmq/amqp-client
implementation 'com.rabbitmq:amqp-client:5.13.1'
// // https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-core
// implementation 'org.apache.logging.log4j:log4j-core:2.14.1'
//
// // https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-slf4j-impl
// testImplementation 'org.apache.logging.log4j:log4j-slf4j-impl:2.14.1'
//
// // https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-api
// implementation 'org.apache.logging.log4j:log4j-api:2.14.1'
// // https://mvnrepository.com/artifact/org.slf4j/slf4j-api
// implementation 'org.slf4j:slf4j-api:1.7.32'
// // https://mvnrepository.com/artifact/org.slf4j/slf4j-log4j12
// testImplementation 'org.slf4j:slf4j-log4j12:1.7.32'
// // https://mvnrepository.com/artifact/org.slf4j/slf4j-simple
// testImplementation 'org.slf4j:slf4j-simple:1.7.32'
// https://mvnrepository.com/artifact/org.xerial/sqlite-jdbc
implementation 'org.xerial:sqlite-jdbc:3.36.0.3'
// https://mvnrepository.com/artifact/org.jvnet.staxex/stax-ex
implementation 'org.jvnet.staxex:stax-ex:2.1.0-M1'
// https://mvnrepository.com/artifact/org.glassfish.jaxb/txw2
implementation 'org.glassfish.jaxb:txw2:3.0.2'
// https://mvnrepository.com/artifact/com.googlecode.json-simple/json-simple
implementation 'com.googlecode.json-simple:json-simple:1.1.1'
implementation 'org.springframework.boot:spring-boot-starter-data-jdbc:2.5.6'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa:2.5.6'
// implementation 'org.springframework.boot:spring-boot-starter-data-mongodb:2.5.4'
implementation 'org.springframework.boot:spring-boot-starter-jdbc:2.5.6'
implementation 'org.springframework.boot:spring-boot-starter-oauth2-client:2.5.6'
implementation 'org.springframework.boot:spring-boot-starter-security:2.5.6'
implementation 'org.springframework.boot:spring-boot-starter-web:2.5.6'
compileOnly 'org.projectlombok:lombok:1.18.22'
runtimeOnly 'com.h2database:h2:1.4.200'
runtimeOnly 'com.microsoft.sqlserver:mssql-jdbc'
runtimeOnly 'com.oracle.database.jdbc:ojdbc8:21.1.0.0'
runtimeOnly 'mysql:mysql-connector-java:8.0.28'
runtimeOnly 'org.postgresql:postgresql:42.3.8'
annotationProcessor 'org.projectlombok:lombok:1.18.22'
testImplementation 'org.springframework.boot:spring-boot-starter-test:2.5.6'
testImplementation 'org.springframework.security:spring-security-test:5.5.1'
}
//jar {
// manifest {
// attributes(
// 'Class-Path': 'comm.jar jdom.jar optra.jar jxl-2.6.jar RXTXcomm.jar javax.ejb.jar javax.jms.jar sqljdbc42.jar guava-16.0.jar hamcrest-core.jar javax.servlet.jar commons-io-2.7.jar javax.resource.jar commons-cli-1.4.jar log4j-api-2.9.0.jar rabbitmq-client.jar javax.annotation.jar log4j-core-2.9.0.jar portmapper-2.0.0.jar javax.servlet.jsp.jar javax.transaction.jar netty-3.9.0.Final.jar sqlite-jdbc-3.7.2.jar metrics-core-2.2.0.jar metrics-core-3.1.2.jar poi-3.10.1-20140818.jar javax.servlet.jsp.jstl.jar poi-ooxml-3.10.1-20140818.jar GoogleProtocolBuffer_2.6.1.jar poi-ooxml-schemas-3.10.1-20140818.jar hibernate-jpa-2.1-api-1.0.2.Final.jar apiguardian-api-1.0.0.jar opentest4j-1.1.1.jar byte-buddy-1.10.7.jar hibernate-core-5.4.11.Final.jar classmate-1.5.1.jar antlr-2.7.7.jar dom4j-2.1.1.jar hibernate-commons-annotations-5.1.0.Final.jar FastInfoset-1.2.15.jar istack-commons-runtime-3.0.7.jar jandex-2.1.1.Final.jar javassist-3.24.0-GA.jar jaxb-api-2.3.1.jar javax.activation-api-1.2.0.jar javax.persistence-api-2.2.jar jaxb-runtime-2.3.1.jar jboss-logging-3.3.2.Final.jar jboss-transaction-api_1.2_spec-1.1.1.Final.jar stax-ex-1.8.jar txw2-2.3.1.jar commons-compress-1.19.jar javax.jms.jar javax.annotation.jar javax.ejb.jar javax.transaction.jar javax.resource.jar javax.servlet.jar javax.servlet.jsp.jar javax.servlet.jsp.jstl.jar comm.jar jdom.jar optra.jar lombok.jar ojdbc7.jar jxl-2.6.jar comm-2.0.jar RXTXcomm.jar javax.ejb.jar javax.jms.jar seroUtils.jar sqljdbc42.jar guava-16.0.jar h2-1.4.200.jar junit-4.10.jar txw2-2.3.1.jar antlr-2.7.7.jar dom4j-2.1.1.jar stax-ex-1.8.jar jniwrap-3.12.jar hamcrest-core.jar javax.servlet.jar commons-io-2.7.jar javax.resource.jar jaxb-api-2.3.1.jar classmate-1.5.1.jar commons-cli-1.4.jar log4j-api-2.9.0.jar rabbitmq-client.jar javax.annotation.jar log4j-core-2.9.0.jar opentest4j-1.1.1.jar portmapper-2.0.0.jar slf4j-api-1.7.30.jar byte-buddy-1.10.2.jar byte-buddy-1.10.7.jar javax.servlet.jsp.jar javax.transaction.jar json-simple-1.1.1.jar netty-3.9.0.Final.jar sqlite-jdbc-3.7.2.jar commons-lang3-3.11.jar FastInfoset-1.2.15.jar jandex-2.1.1.Final.jar jaxb-runtime-2.3.1.jar metrics-core-2.2.0.jar metrics-core-3.1.2.jar jackson-core-2.11.1.jar javassist-3.24.0-GA.jar junit-jupiter-5.4.2.jar poi-3.10.1-20140818.jar sqlite-jdbc-3.27.2.1.jar apiguardian-api-1.0.0.jar commons-compress-1.19.jar javax.servlet.jsp.jstl.jar jackson-databind-2.11.1.jar junit-jupiter-api-5.4.2.jar javax.persistence-api-2.2.jar jboss-logging-3.3.2.Final.jar poi-ooxml-3.10.1-20140818.jar GoogleProtocolBuffer_2.6.1.jar jackson-annotations-2.11.1.jar javax.activation-api-1.2.0.jar junit-jupiter-engine-5.4.2.jar junit-jupiter-params-5.4.2.jar hibernate-core-5.4.11.Final.jar junit-platform-engine-1.4.2.jar mysql-connector-java-8.0.15.jar istack-commons-runtime-3.0.7.jar junit-platform-commons-1.4.2.jar hibernate-jpa-2.1-api-1.0.2.Final.jar poi-ooxml-schemas-3.10.1-20140818.jar org.eclipse.paho.client.mqttv3-1.2.1.jar hibernate-commons-annotations-5.1.0.Final.jar jboss-transaction-api_1.2_spec-1.1.1.Final.jar'
// )
// }
//}
test {
useJUnitPlatform()
}
答案1
得分: 14
你正在使用Spring Boot 2.6 不支持Gradle 8.x:
Spring Boot的Gradle插件要求使用Gradle 6.8、6.9或7.x,并可与Gradle的配置缓存一起使用。
对于Gradle 8的支持是在Spring Boot 2.7中添加的,因此您可以升级到Spring Boot 2.7,或者降级到Gradle 7.x。
英文:
You are using Spring Boot 2.6 which does not support Gradle 8.x:
> Spring Boot’s Gradle plugin requires Gradle 6.8, 6.9, or 7.x and can be used with Gradle’s configuration cache.
Support for Gradle 8 was added in Spring Boot 2.7 so you can either upgrade to Spring Boot 2.7 or downgrade to Gradle 7.x.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论