英文:
Any way to fail a build if package name is wrong using gradle?
问题
我们有一个CompilingClassloader,它使用包名称来查找源*.java文件,但最近有人修改了名称,使其与位置不匹配,因此它以一种奇怪的方式完全失败了。
无论如何,当包名称与Java文件的位置不匹配时,我们是否可以让Gradle构建失败?
嗯,我想根据mentallurg的说法,这个构建本应该失败(那将是很棒的)...但实际上它通过了。注意:我使用'head -3'命令查看了有错误的文件的前三行(您可以阅读文件路径以查看差异)。我知道javac允许这样,但想知道Gradle是否与不允许这样的Eclipse相匹配(那会很好)。
Gradle的版本是5.6.3
英文:
We have a CompilingClassloader that uses package names to find the source *.java files but someone recently modified the name to not match location, so it completely failed in a bizarre way.
Anyway we can have gradle fail the build when package name does not match java file location?
hmm, I guess according to mentallurg, this build was supposed to fail(which would rock)...instead it passed. NOTE: I 'head -3' the file in question that has the wrong package name(you can read the file path to see how it is different). I know javac allows that, but wondering if gradle matches eclipse which does not(that would be nice).
The version of gradle is 5.6.3
专注分享java语言的经验与见解,让所有开发者获益!
评论