How to fix gradle build failed due to void org.gradle.api.internal.artifacts.dsl.LazyPublishArtifact.<init>(org.gradle.api.provider.Provider) error?

huangapple go评论78阅读模式
英文:

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&gt; gradle build                                                                                                

FAILURE: Build failed with an exception.

* What went wrong:
'void org.gradle.api.internal.artifacts.dsl.LazyPublishArtifact.&lt;init&gt;(org.gradle.api.provider.Provider)'

* Try:
&gt; Run with --stacktrace option to get the stack trace.
&gt; Run with --info or --debug option to get more log output.
&gt; 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&gt; gradle build                                                                                                

FAILURE: Build failed with an exception.

* What went wrong:
&#39;void org.gradle.api.internal.artifacts.dsl.LazyPublishArtifact.&lt;init&gt;(org.gradle.api.provider.Provider)&#39;

* Try:
&gt; Run with --stacktrace option to get the stack trace.
&gt; Run with --info or --debug option to get more log output.
&gt; 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 &#39;org.springframework.boot&#39; version &#39;2.6.4&#39;
id &#39;io.spring.dependency-management&#39; version &#39;1.0.11.RELEASE&#39;
id &#39;java&#39;
}
group = &#39;com.iiot.wizards&#39;
version = &#39;0.0.1-SNAPSHOT&#39;
//sourceCompatibility = &#39;1.8&#39;
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}
repositories {
mavenCentral()
}
dependencies {
implementation files(&#39;lib/connection-manager-2.0.0.1.jar&#39;)
implementation files(&#39;lib/dlms-lib-2.0.0.1.jar&#39;)
implementation files(&#39;lib/emdb-entities-2.0.0.1.jar&#39;)
implementation files(&#39;lib/emdb-model-2.0.0.1.jar&#39;)
implementation files(&#39;lib/emflex-ansi-meter-reader-2.0.0.1.jar&#39;)
implementation files(&#39;lib/emflex-dlms-meter-reader-2.0.0.1.jar&#39;)
implementation files(&#39;lib/iiot-wizards-common-2.0.0.1.jar&#39;)
implementation files(&#39;lib/iiot-wizards-communication-2.0.0.1.jar&#39;)
implementation files(&#39;lib/iiot-wizards-dnp3-2.0.0.1.jar&#39;)
implementation files(&#39;lib/iiot-wizards-dnp3-meter-reader-2.0.0.1.jar&#39;)
implementation files(&#39;lib/iiot-wizards-history-data-provider-2.0.0.1.jar&#39;)
implementation files(&#39;lib/iiot-wizards-history-data-writers-2.0.0.1.jar&#39;)
implementation files(&#39;lib/iiot-wizards-licensing-2.0.0.1.jar&#39;)
implementation files(&#39;lib/iiot-wizards-local-data-cache-manager-2.0.0.1.jar&#39;)
implementation files(&#39;lib/iiot-wizards-log-manager-2.0.0.1.jar&#39;)
implementation files(&#39;lib/iiot-wizards-messaging-2.0.0.1.jar&#39;)
implementation files(&#39;lib/iiot-wizards-mio-meter-reader-2.0.0.1.jar&#39;)
implementation files(&#39;lib/iiot-wizards-modbus-gprs-read-meter-2.0.0.1.jar&#39;)
implementation files(&#39;lib/iiot-wizards-modbus-meter-reader-2.0.0.1.jar&#39;)
implementation files(&#39;lib/iiot-wizards-scheduler-2.0.0.1.jar&#39;)
implementation files(&#39;lib/modbus-master-2.0.0.1.jar&#39;)
implementation files(&#39;lib/TinyLog-2.0.0.1.jar&#39;)
implementation files(&#39;lib/Utils-2.0.0.1.jar&#39;)
implementation files(&#39;lib/jniwrap-3.12.jar&#39;)
implementation files(&#39;lib/GoogleProtocolBuffer_2.6.1.jar&#39;)
implementation files(&#39;lib/comm.jar&#39;)
implementation files(&#39;lib/RXTXcomm.jar&#39;)
implementation files(&#39;lib/iiot-wizards-history-entities-2.0.0.1.jar&#39;)
// https://mvnrepository.com/artifact/commons-io/commons-io
implementation group: &#39;commons-io&#39;, name: &#39;commons-io&#39;, version: &#39;2.11.0&#39;
// https://mvnrepository.com/artifact/org.apache.commons/commons-lang3
implementation group: &#39;org.apache.commons&#39;, name: &#39;commons-lang3&#39;, version: &#39;3.12.0&#39;
// https://mvnrepository.com/artifact/org.eclipse.paho/org.eclipse.paho.client.mqttv3
implementation group: &#39;org.eclipse.paho&#39;, name: &#39;org.eclipse.paho.client.mqttv3&#39;, version: &#39;1.2.5&#39;
// https://mvnrepository.com/artifact/com.rabbitmq/amqp-client
implementation group: &#39;com.rabbitmq&#39;, name: &#39;amqp-client&#39;, version: &#39;5.13.1&#39;
// https://mvnrepository.com/artifact/org.apache.commons/commons-compress
implementation group: &#39;org.apache.commons&#39;, name: &#39;commons-compress&#39;, version: &#39;1.21&#39;
// https://mvnrepository.com/artifact/commons-beanutils/commons-beanutils
implementation group: &#39;commons-beanutils&#39;, name: &#39;commons-beanutils&#39;, version: &#39;1.9.4&#39;
// https://mvnrepository.com/artifact/commons-cli/commons-cli
implementation group: &#39;commons-cli&#39;, name: &#39;commons-cli&#39;, version: &#39;1.4&#39;
// https://mvnrepository.com/artifact/org.apache.commons/commons-collections4
implementation group: &#39;org.apache.commons&#39;, name: &#39;commons-collections4&#39;, version: &#39;4.4&#39;
// https://mvnrepository.com/artifact/commons-logging/commons-logging
implementation group: &#39;commons-logging&#39;, name: &#39;commons-logging&#39;, version: &#39;1.2&#39;
// https://mvnrepository.com/artifact/org.apache.commons/commons-math3
implementation group: &#39;org.apache.commons&#39;, name: &#39;commons-math3&#39;, version: &#39;3.6.1&#39;
// https://mvnrepository.com/artifact/org.apache.commons/commons-text
implementation group: &#39;org.apache.commons&#39;, name: &#39;commons-text&#39;, version: &#39;1.9&#39;
//    // https://mvnrepository.com/artifact/gnu.io/rxtx
//    implementation group: &#39;gnu.io&#39;, name: &#39;rxtx&#39;, version: &#39;2.1.7&#39;
// https://mvnrepository.com/artifact/org.hibernate/hibernate-core
implementation group: &#39;org.hibernate&#39;, name: &#39;hibernate-core&#39;, version: &#39;5.5.7.Final&#39;
// https://mvnrepository.com/artifact/org.apiguardian/apiguardian-api
implementation group: &#39;org.apiguardian&#39;, name: &#39;apiguardian-api&#39;, version: &#39;1.1.2&#39;
// https://mvnrepository.com/artifact/org.dom4j/dom4j
implementation group: &#39;org.dom4j&#39;, name: &#39;dom4j&#39;, version: &#39;2.1.3&#39;
// https://mvnrepository.com/artifact/com.sun.xml.fastinfoset/FastInfoset
implementation group: &#39;com.sun.xml.fastinfoset&#39;, name: &#39;FastInfoset&#39;, version: &#39;2.0.0&#39;
// https://mvnrepository.com/artifact/org.hamcrest/hamcrest-core
testImplementation group: &#39;org.hamcrest&#39;, name: &#39;hamcrest-core&#39;, version: &#39;2.2&#39;
// https://mvnrepository.com/artifact/org.hibernate.javax.persistence/hibernate-jpa-2.1-api
implementation group: &#39;org.hibernate.javax.persistence&#39;, name: &#39;hibernate-jpa-2.1-api&#39;, version: &#39;1.0.2.Final&#39;
//    // https://mvnrepository.com/artifact/org.hibernate.ogm/hibernate-ogm-mongodb
//    implementation group: &#39;org.hibernate.ogm&#39;, name: &#39;hibernate-ogm-mongodb&#39;, version: &#39;5.4.1.Final&#39;
// https://mvnrepository.com/artifact/com.sun.istack/istack-commons-runtime
implementation group: &#39;com.sun.istack&#39;, name: &#39;istack-commons-runtime&#39;, version: &#39;4.1.0-M1&#39;
// https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-annotations
implementation &#39;com.fasterxml.jackson.core:jackson-annotations:2.13.0&#39;
// https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core
implementation &#39;com.fasterxml.jackson.core:jackson-core:2.13.0&#39;
// https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind
implementation &#39;com.fasterxml.jackson.core:jackson-databind:2.13.0&#39;
// https://mvnrepository.com/artifact/org.javassist/javassist
implementation &#39;org.javassist:javassist:3.28.0-GA&#39;
// https://mvnrepository.com/artifact/javax.annotation/javax.annotation-api
implementation &#39;javax.annotation:javax.annotation-api:1.3.2&#39;
// https://mvnrepository.com/artifact/io.dropwizard.metrics/metrics-core
implementation &#39;io.dropwizard.metrics:metrics-core:4.2.4&#39;
// https://mvnrepository.com/artifact/org.jboss.narayana.jta/narayana-jta
testImplementation &#39;org.jboss.narayana.jta:narayana-jta:5.12.1.Final&#39;
// https://mvnrepository.com/artifact/io.netty/netty-all
implementation &#39;io.netty:netty-all:4.1.67.Final&#39;
// https://mvnrepository.com/artifact/com.rabbitmq/amqp-client
implementation &#39;com.rabbitmq:amqp-client:5.13.1&#39;
//    // https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-core
//    implementation &#39;org.apache.logging.log4j:log4j-core:2.14.1&#39;
//
//    // https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-slf4j-impl
//    testImplementation &#39;org.apache.logging.log4j:log4j-slf4j-impl:2.14.1&#39;
//
//    // https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-api
//    implementation &#39;org.apache.logging.log4j:log4j-api:2.14.1&#39;
//    // https://mvnrepository.com/artifact/org.slf4j/slf4j-api
//    implementation &#39;org.slf4j:slf4j-api:1.7.32&#39;
//    // https://mvnrepository.com/artifact/org.slf4j/slf4j-log4j12
//    testImplementation &#39;org.slf4j:slf4j-log4j12:1.7.32&#39;
//    // https://mvnrepository.com/artifact/org.slf4j/slf4j-simple
//    testImplementation &#39;org.slf4j:slf4j-simple:1.7.32&#39;
// https://mvnrepository.com/artifact/org.xerial/sqlite-jdbc
implementation &#39;org.xerial:sqlite-jdbc:3.36.0.3&#39;
// https://mvnrepository.com/artifact/org.jvnet.staxex/stax-ex
implementation &#39;org.jvnet.staxex:stax-ex:2.1.0-M1&#39;
// https://mvnrepository.com/artifact/org.glassfish.jaxb/txw2
implementation &#39;org.glassfish.jaxb:txw2:3.0.2&#39;
// https://mvnrepository.com/artifact/com.googlecode.json-simple/json-simple
implementation &#39;com.googlecode.json-simple:json-simple:1.1.1&#39;
implementation &#39;org.springframework.boot:spring-boot-starter-data-jdbc:2.5.6&#39;
implementation &#39;org.springframework.boot:spring-boot-starter-data-jpa:2.5.6&#39;
//    implementation &#39;org.springframework.boot:spring-boot-starter-data-mongodb:2.5.4&#39;
implementation &#39;org.springframework.boot:spring-boot-starter-jdbc:2.5.6&#39;
implementation &#39;org.springframework.boot:spring-boot-starter-oauth2-client:2.5.6&#39;
implementation &#39;org.springframework.boot:spring-boot-starter-security:2.5.6&#39;
implementation &#39;org.springframework.boot:spring-boot-starter-web:2.5.6&#39;
compileOnly &#39;org.projectlombok:lombok:1.18.22&#39;
runtimeOnly &#39;com.h2database:h2:1.4.200&#39;
runtimeOnly &#39;com.microsoft.sqlserver:mssql-jdbc&#39;
runtimeOnly &#39;com.oracle.database.jdbc:ojdbc8:21.1.0.0&#39;
runtimeOnly &#39;mysql:mysql-connector-java:8.0.28&#39;
runtimeOnly &#39;org.postgresql:postgresql:42.3.8&#39;
annotationProcessor &#39;org.projectlombok:lombok:1.18.22&#39;
testImplementation &#39;org.springframework.boot:spring-boot-starter-test:2.5.6&#39;
testImplementation &#39;org.springframework.security:spring-security-test:5.5.1&#39;
}
//jar {
//    manifest {
//        attributes(
//                &#39;Class-Path&#39;: &#39;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&#39;
//        )
//    }
//}
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.

huangapple
  • 本文由 发表于 2023年5月6日 17:03:39
  • 转载请务必保留本文链接:https://go.coder-hub.com/76188050.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定