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

标签 jakarta-ee gradle ejb packaging ear

这是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/

相关文章:

java - wildfly 10 多个实例(偏移量)但有一个监听器端口

java - 如何使用泛型类型@Inject对象

android - Gradle 项目同步在使用来自 GitHub 的库时失败

java - 如何生成由 websphere 9 上运行的应用程序分隔的日志文件?我使用 java.util.logging 来生成日志

java - JAX-RS 原始资源返回类型的自定义 JSON 表示

java - 在同一 EAR 中的 WAR 之间进行通信的选项

android - 在 Room 持久性上构建版本时出现错误 [DuplicatePlatformClasses] 类冲突

android - 在 Android Studio 上找不到 Theme.AppCompat.Light.NoActionBar

java - JEE架构问题: Service can inject Service? 或者Service只能注入(inject)Dao?

java - 非法参数异常 : Invalid ejb jar: it contains zero ejb