gpt4 book ai didi

java - 尾随部分不允许有 Gradle 内容

转载 作者:行者123 更新时间:2023-12-01 16:14:42 26 4
gpt4 key购买 nike

将 SpringBoot Maven 构建转换为 Gradle 6.5,Maven 工作正常(转换前)Gradle BootJar(甚至只是构建)失败,并显示:

[ fatal error ] jboss-parent-12.pom:811:1:尾随部分不允许有内容。

为什么这里引用 jboss Parent 12?这是一个古老的 pom,使用 --scan 根本不会显示 jboss。 (--扫描下面的依赖项列表)

com.fasterxml.jackson.core:jackson-annotations:2.11.0
com.fasterxml.jackson.core:jackson-core:2.11.0
com.fasterxml.jackson.core:jackson-databind:2.11.0
com.fasterxml.jackson.module:jackson-module-parameter-names:2.11.0
com.gradle:gradle-enterprise-gradle-plugin:3.3.3
commons-codec:commons-codec:1.14
io.freefair.gradle:lombok-plugin:5.1.0
io.freefair.lombok:io.freefair.lombok.gradle.plugin:5.1.0
io.spring.gradle:dependency-management-plugin:1.0.9.RELEASE
net.java.dev.jna:jna-platform:5.5.0
net.java.dev.jna:jna:5.5.0
org.apache.commons:commons-compress:1.19
org.apache.httpcomponents:httpclient:4.5.12
org.apache.httpcomponents:httpcore:4.4.13
org.springframework.boot:org.springframework.boot.gradle.plugin:2.3.1.RELEASE
org.springframework.boot:spring-boot-buildpack-platform:2.3.1.RELEASE
org.springframework.boot:spring-boot-dependencies:2.3.1.RELEASE
org.springframework.boot:spring-boot-gradle-plugin:2.3.1.RELEASE
org.springframework.boot:spring-boot-loader-tools:2.3.1.RELEASE
org.springframework.boot:spring-boot-parent:2.3.1.RELEASE
org.springframework:spring-core:5.2.7.RELEASE
org.springframework:spring-jcl:5.2.7.RELEASE
org.testcontainers:testcontainers-bom:1.14.2

或者,有没有办法忽略它?即使使用

,BootJar 也不会生成 jar
plugins {
id 'java'
id 'application'
id 'io.freefair.lombok' version '5.1.0'
id 'org.springframework.boot' version '2.3.1.RELEASE'
}
apply plugin: 'java'
apply plugin: 'io.spring.dependency-management'
jar {
enabled = true
}
application {
mainClass = 'my.main.class.MyApplication'
}

最佳答案

不是构建工具方面的专家,但您可以继续执行以下步骤:

  1. gradle 干净构建
  2. 或者可以显式排除依赖项:

    configurations.all {
    exclude group: "org.jboss", module: "jboss-parent"
    }

    希望这对您有帮助。

关于java - 尾随部分不允许有 Gradle 内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62437560/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com