gpt4 book ai didi

gradle - 将Maven CheckStyle迁移到Gradle

转载 作者:行者123 更新时间:2023-12-03 03:22:16 25 4
gpt4 key购买 nike

我正在尝试从Maven迁移到Gradle,并使用checkstyle出现了一个奇怪的错误。

buildscript {
repositories {
mavenLocal()
jcenter()
mavenCentral()
}
dependencies {
classpath 'io.spring.gradle:dependency-management-plugin:0.5.3.RELEASE'
}
}

apply plugin: 'io.spring.dependency-management'
apply plugin: 'java'
apply plugin: 'checkstyle'


jar {
version = '0.1.0-SNAPSHOT'
}

repositories {
mavenLocal()
jcenter()
mavenCentral()
}

dependencyManagement {
imports {
mavenBom 'io.spring.platform:platform-bom:1.1.3.RELEASE'
}
}

dependencies {
checkstyle 'com.puppycrawl.tools:checkstyle:6.10.1'
compile('org.springframework.data:spring-data-commons')
testCompile('junit:junit')
testCompile('org.mockito:mockito-core')
testCompile('nl.jqno.equalsverifier:equalsverifier:1.7.5')
}

test {
maxParallelForks = 4
}

这是我得到的错误
gradle build                                                                           slave-vi
:compileJava UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE
:jar UP-TO-DATE
:assemble UP-TO-DATE
:checkstyleMain FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':checkstyleMain'.
> Unable to create a Checker: unable to read /home/xenoterracide/IdeaProjects/entity-api/config/checkstyle/checkstyle.xml - unable to parse configuration stream - Property ${checkstyle.cache.file} has not been set

* 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: 8.688 secs

我该如何使用最新版本的Checkstyle进行gradle?值得注意的是我的 checkstyle.xml与maven checkstyle 6.10.1和6.8一起使用

最佳答案

我在配置中找到了这个

    <property name="cacheFile" value="${checkstyle.cache.file}"/>

我不记得添加它了,也许它是sun配置文件的一部分,只是碰巧被maven插件填充了。

关于gradle - 将Maven CheckStyle迁移到Gradle,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32752639/

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