我尝试将外部.jar文件添加到grails 4.0应用程序中,尽管已在3.0 version中得到了回答,但我找不到4.0的答案。 (Grails 4.0从3.0有了显着变化。)
这是我到目前为止所做的:
runtime fileTree(dir: '/vagrant/libs', include: '*.jar')
import ext.*;
...
AnnotationRenderer ar = new AnnotationRenderer()
但是我总是得到“无法解析类AnnotationRenderer”。
有解决此问题的提示吗?
答案 0 :(得分:0)
要链接到不在Maven或任何其他公共仓库中的外部jar,请在build.gradle仓库部分中添加:
flatDir {
dirs 'libs'
}
然后在依赖项部分添加:
implementation name: 'myjarfilename'
我的实际文件名是myjarfilename.jar(例如,在build.grade中不包含“ .jar”)。