gpt4 book ai didi

jakarta-ee - Gradle:找不到提供的方法()

转载 作者:行者123 更新时间:2023-12-04 13:57:02 27 4
gpt4 key购买 nike

这是preferred , providedprovided group这个在哪里documented ?

thufir@doge:~/NetBeansProjects/gradleEAR$ 
thufir@doge:~/NetBeansProjects/gradleEAR$ gradle clean

FAILURE: Build failed with an exception.

* Where:
Build file '/home/thufir/NetBeansProjects/gradleEAR/build.gradle' line: 40

* What went wrong:
A problem occurred evaluating root project 'gradleEAR'.
> Could not find method provided() for arguments [javax:javaee-api:7.0] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 2.991 secs
thufir@doge:~/NetBeansProjects/gradleEAR$



plugins {
id 'com.gradle.build-scan' version '1.8'
id 'java'
id 'application'
id 'ear'
}

mainClassName = 'net.bounceme.doge.json.Main'

buildScan {
licenseAgreementUrl = 'https://gradle.com/terms-of-service'
licenseAgree = 'yes'
}

repositories {
jcenter()
}

jar {
manifest {
attributes 'Main-Class': 'net.bounceme.doge.json.Main'
}
}

task fatJar(type: Jar) {
baseName = project.name + '-all'
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
with jar
manifest {
attributes 'Implementation-Title': 'Gradle Quickstart', 'Implementation-Version': '3.4.0'
attributes 'Main-Class': 'net.bounceme.doge.json.Main'
}
}

dependencies {
compile group: 'javax.json', name: 'javax.json-api', version: '1.1'
compile group: 'org.glassfish', name: 'javax.json', version: '1.1'
provided 'javax:javaee-api:7.0'
}

在参照:

How does Gradle resolve the javaee-api dependency to build an EAR?

最佳答案

provided配置由 war 添加插件(您没有应用)所以它在您的场景中不可用

我建议你使用 compileOnly可从 gradle 2.12+ 获得的配置

关于jakarta-ee - Gradle:找不到提供的方法(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45808984/

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