我正在尝试将Grails 2插件转换为Grails 3,但我无法从生成的jar中排除仅用于测试的几个域类。
该文档指出:
在build.gradle中,应从JAR文件中排除已编译的类:
jar {
exclude "com/demo/**/**"
}
...但是如果我尝试这样做,我将从Gradle中收到以下错误: Could not find method jar() for arguments [build_64zizslf5a7zfo329yz5tdsoi$_run_closure1@566c53c] on root project '...'
我可以发布整个堆栈跟踪,但看起来并没有太大帮助。我正在使用Gradle 2.3,该create-plugin
命令由命令生成的默认Gradle包装器提供。我也没有做任何其他更改,build.gradle
因为我的插件不需要任何外部依赖关系。
请参阅https://github.com/jeffbrown/excludesdemo上的项目。这包括https://github.com/jeffbrown/excludesdemo/tree/master/grails-app/domain下的2个域类。
build.gradle
位于https://github.com/jeffbrown/excludesdemo/blob/72896a3f88f617d530bbdde8976d5bfe8d1e820a/build.gradle#L73的顶级文件包含以下内容:
jar {
exclude 'package1/**'
}
运行时,./gradlew jar
您应该看到在生成的jar文件build/libs/excludesdemo-0.1-SNAPSHOT.jar
包含package2/Author.class
和不包含package1/Person.class
。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句