gpt4 book ai didi

jakarta-ee - gradle:无法为 org.gradle.api.Project 类型的根项目设置只读属性 'module' 的值

转载 作者:行者123 更新时间:2023-12-03 03:19:33 24 4
gpt4 key购买 nike

开始使用 somewhere 和 EAR 获取 packaging:

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

FAILURE: Build failed with an exception.

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

* What went wrong:
A problem occurred evaluating root project 'gradleEAR'.
> Cannot set the value of read-only property 'module' for root project 'gradleEAR' of type org.gradle.api.Project.

* 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: 11.862 secs
thufir@doge:~/NetBeansProjects/gradleEAR$

如何设置 module 属性的值?
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()
}

ear {
manifest {
attributes 'foo': 'bar'
}

deploymentDescriptor {
applicationName = "gradleEAR"
initializeInOrder = true
displayName = "gradleEAR"
description = "Trial App EAR for Gradle documentation"
libraryDirectory = "WEB-INF/lib"
module = "foo"
/*
webModule("TrialApp.war", "TrialApp")
*/
}

}






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'
compileOnly 'javax:javaee-api:7.0'
}

可能有用:

https://discuss.gradle.org/t/set-project-name-property-in-a-test/4333

http://mrhaki.blogspot.ca/2009/11/gradle-goodness-changing-project-name.html

最佳答案

您只能从 settings.gradle 文件中更改项目名称。

rootProject.name = 'foo' 

或任何其他模块也来自这里:
include "foo"
project(":foo").projectDir = file("modules/foo")

关于jakarta-ee - gradle:无法为 org.gradle.api.Project 类型的根项目设置只读属性 'module' 的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45829987/

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