gradle 无法获取配置容器的未知属性“compile”

uidvcgyl  于 2022-11-14  发布在  其他
关注(0)|答案(1)|浏览(323)

需要帮助:我正在尝试将gradle版本升级到7.4.2,但看到以下错误

  • 问题:评估根项目'service'时发生问题。无法取得org.gradle.api.internal.artifacts.configurations.DefaultConfigurationContainer类型之组态容器的未知属性'compile'。

它来自下面的代码行

war{

    archiveName 'xyz-svc-clt.war'
    
    manifest{
        attributes "Weblogic-Application-Version":  getBuildVersion(),
                   "Built-By": "${env.USERNAME}",
                   "Built-On": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"), 
                   "Class-Path": configurations.compile.collect { it.getName() }.join(' ')
        
    }
    
    if (isDev() == false){
        rootSpec.exclude("**/*_log4j.xml")
        rootSpec.exclude("**/*.properties")
    }   
    
    from('src/main/resources/'){
        include 'handler-chain.xml'
        into 'WEB-INF/classes/com/abc/xyz/service/xyzService/'      
    }
    
    from('src/main/resources/'){
        include 'handler-chain.xml'
        into 'WEB-INF/classes/com/abc/xyz/service/xyzService/notification/'
    }   
}

我看了类似的问题,尝试了不同的解决方案,但没有为我工作。修改配置。编译到配置。实现后,添加下面的行,但它没有工作。

project.configurations.implementation.setCanBeResolved(true)

我的代码中也有以下插件

apply plugin: 'java'
apply plugin: 'war'
eeq64g8w

eeq64g8w1#

以下更改对我有效

war{

    archiveName 'xyz-svc-clt.war'
    
    manifest{
        attributes "Weblogic-Application-Version":  getBuildVersion(),
                   "Built-By": "${env.USERNAME}",
                   "Built-On": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"), 
                   "Class-Path": configurations.compileClasspath.collect { it.getName() }.join(' ')
        
    }
    
    if (isDev() == false){
        rootSpec.exclude("**/*_log4j.xml")
        rootSpec.exclude("**/*.properties")
    }   
    
    from('src/main/resources/'){
        include 'handler-chain.xml'
        into 'WEB-INF/classes/com/abc/xyz/service/xyzService/'      
    }
    
    from('src/main/resources/'){
        include 'handler-chain.xml'
        into 'WEB-INF/classes/com/abc/xyz/service/xyzService/notification/'
    }   
}

相关问题