尝试使用gradle 6.5.2构建Java项目并出现错误
A problem occurred evaluating settings 'hello-app'.
Could not get unknown property 'systemProp' for settings 'hello-app' of type
org.gradle.initialization.DefaultSettings.
settings.gradle内容:
rootProject.name = 'hello-app'
systemProp.javax.net.ssl.trustStore= '/opt/java/openjdk/lib/security/cacerts'
systemProp.javax.net.ssl.trustStorePassword= 'changeit'
build.gradle内容:
plugins {
id 'java'
id 'application'
id 'io.freefair.lombok' version '5.1.0'
id 'org.springframework.boot' version '2.3.2.RELEASE'
}
repositories {
jcenter()
mavenCentral()
jcenter {
url 'https://repo.company.com/artifactory/jcenter_link/'
}
mavenCentral {
url 'https://repo.company.com/artifactory/jcenter_link/'
url 'https://repo.company.com/artifactory/jitpack'
}
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web:2.3.2.RELEASE'
implementation 'org.springframework.boot:spring-boot-starter-actuator:2.3.2.RELEASE'
implementation 'io.micrometer:micrometer-core'
implementation 'io.micrometer:micrometer-registry-prometheus:1.5.3'
implementation 'io.springfox:springfox-swagger2:2.9.2'
implementation 'io.springfox:springfox-swagger-ui:2.9.2'
implementation 'com.company.rnd:jsonlogger:0.1.9'
implementation 'com.company.rnd:vault-client:0.0.6'
compileOnly 'org.projectlombok:lombok:1.18.12'
annotationProcessor 'org.projectlombok:lombok:1.18.12'
testImplementation 'org.springframework.boot:spring-boot-starter-test:2.3.2.RELEASE'
testImplementation 'org.junit.jupiter:junit-jupiter:5.5.1'
testImplementation 'org.hamcrest:hamcrest-all:1.3'
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4+"
}
application {
mainClassName = 'hello-app.src.main.java.com.company.rnd.apphello.ApphelloApplication'
}
test {
systemProperty 'spring.profiles.active', 'DEV'
mainClassName = 'hello-app.src.test.java.com.company.rnd.apphello.ApphelloApplicationTest'
}
allprojects {
apply plugin: "com.jfrog.artifactory"
}
artifactory {
contextUrl = "${artifactory_contextUrl}" //The base Artifactory URL if not overridden by the publisher/resolver
publish {
repository {
repoKey = 'gradle-release-local'
maven = true
}
}
resolve {
repository {
repoKey = 'jcenter_link'
maven = true
}
}
}
我该如何解决? 如果我将settings.gradle重命名为gradle.properties,则会出现以下错误: 评估根项目“ hello-app”时出现问题。
在类型org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler的对象上找不到参数[org.jfrog.buildinfo:build-info-extractor-gradle:4+]的方法classpath()。