gpt4 book ai didi

grails - Grails内联(就地)插件无法解决依赖关系

转载 作者:行者123 更新时间:2023-12-02 14:15:26 30 4
gpt4 key购买 nike

我有一个名为Media的插件,该插件应负责图像大小调整等工作。

它具有以下依赖性:

dependencies {
compile group: 'org.ccil.cowan.tagsoup',
name: 'tagsoup',
version: '1.2'
runtime group: 'org.codehaus.groovy.modules.http-builder',
name: 'http-builder',
version: '0.5.2'
compile group: 'org.imgscalr',
name: 'imgscalr-lib',
version:'4.2'
compile group: 'org.apache.tika',
name: 'tika-core',
version: '1.3'
}

当我将插件作为独立应用程序运行时,一切正常。

比我创建一个应用程序并将就地插件依赖项添加到BuildConfig.groovy文件中。
// there is grails.project.dependency.resolution closure above
grails.plugin.location.Media = "../../plugins/Media";

当我运行应用程序时,出现此错误:
| Error Compilation error: startup failed:
/home/grails/plugins/Media/grails-app/controllers/frod/media/ImageServiceController.groovy: 14: unable to resolve class org.imgscalr.Scalr
@ line 14, column 1.
import org.imgscalr.Scalr
^

/home/grails/plugins/Media/src/groovy/frod/media/download/CachedContentDownloader.groovy: 3: unable to resolve class org.apache.http.HttpResponse
@ line 3, column 1.
import org.apache.http.HttpResponse
^

/home/grails/plugins/Media/src/groovy/frod/media/download/ContentDownloader.groovy: 3: unable to resolve class org.apache.http.HttpResponse
@ line 3, column 1.
import org.apache.http.HttpResponse
^

/home/grails/plugins/Media/src/groovy/frod/media/download/ContentDownloader.groovy: 4: unable to resolve class org.apache.http.client.HttpClient
@ line 4, column 1.
import org.apache.http.client.HttpClient
^

/home/grails/plugins/Media/src/groovy/frod/media/download/ContentDownloader.groovy: 6: unable to resolve class org.apache.http.impl.client.DefaultHttpClient
@ line 6, column 1.
import org.apache.http.impl.client.DefaultHttpClient
^

/home/grails/plugins/Media/src/groovy/frod/media/download/ContentDownloader.groovy: 5: unable to resolve class org.apache.http.client.methods.HttpGet
@ line 5, column 1.
import org.apache.http.client.methods.HttpGet
^

/home/grails/plugins/Media/src/groovy/frod/media/download/DownloadedContent.groovy: 3: unable to resolve class org.apache.http.HttpEntity
@ line 3, column 1.
import org.apache.http.HttpEntity
^

/home/grails/plugins/Media/src/groovy/frod/media/download/IContentDownloader.groovy: 3: unable to resolve class org.apache.http.HttpResponse
@ line 3, column 1.
import org.apache.http.HttpResponse
^

/home/grails/plugins/Media/src/groovy/frod/media/image/thumbnail/adjustment/crop/CropProcessor.groovy: 5: unable to resolve class org.imgscalr.Scalr
@ line 5, column 1.
import org.imgscalr.Scalr
^

/home/grails/plugins/Media/src/groovy/frod/media/image/thumbnail/adjustment/resize/IResizeAdjustment.groovy: 3: unable to resolve class org.imgscalr.Scalr
@ line 3, column 1.
import org.imgscalr.Scalr
^

/home/grails/plugins/Media/src/groovy/frod/media/image/thumbnail/adjustment/resize/IResizeAdjustment.groovy: 16: unable to resolve class Scalr.Mode
@ line 16, column 5.
public Scalr.Mode getMode();
^

/home/grails/plugins/Media/src/groovy/frod/media/image/thumbnail/adjustment/resize/IResizeAdjustment.groovy: 18: unable to resolve class Scalr.Method
@ line 18, column 5.
public Scalr.Method getMethod();
^
// and many others

如您所见,它无法解决依赖关系(您可以看到http-builder imgscalr-lib)。

我在Google上搜索了很多,发现可以尝试将legacyResolve设置为true。我用这些设置尝试了所有组合(插件,应用程序,插件+应用程序),并且结果相同-上面的错误。

谁能帮我这个?

我的grails版本是2.2.3

非常感谢你

坦率

最佳答案

依赖关系由Ivy解决,但这取决于POM文件是否可用。当您使用嵌入式插件时,情况并非如此,因为您只是指向插件源。您可以是多余的,可以将依赖项添加到应用程序的BuildConfig中,也可以使用maven-install脚本来打包该插件并将其复制到本地Maven缓存中。
maven-install不太方便,因为您每次在需要对应用程序可用的插件中进行更改时都必须重新运行它,但是它更接近于实际的安装过程。要使用像这样在本地发布的插件,请确保BuildConfig.groovy中未注释mavenLocal()并添加一个依赖项,就像您发布该插件时一样,例如compile ':myplugin:0.1'

关于grails - Grails内联(就地)插件无法解决依赖关系,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18237930/

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