Grails和本地Maven依赖 [英] Grails and Local Maven Dependencies
问题描述
我开发Grails的一个小型Web前端。这基本上是通过JMS连接异步一个超轻型客户端应用程序。
I'm developing a small web frontend in Grails. It is basically a "ultra light-weight" client app that is connected async through JMS.
我在,我想从Maven仓库拉项目的两个依赖。他们是的ActiveMQ
和 ACME适配器-API
,一个内部的依赖,没有可用的远程存储库。
I have two dependencies in the project that I would like to pull from a Maven repository. They is activemq
and acme-adapter-api
, a in-house dependency, not available at the remote repository.
设置我的 BuildConfig.groovy
(的Grails 1.2M4 )文件像这样,为了访问我的依赖关系:
I set up my BuildConfig.groovy
(Grails 1.2M4) file like this, in order to access my dependencies:
repositories {
grailsPlugins()
grailsHome()
mavenCentral()
mavenRepo('D:/maven-repo')
} dependencies {
compile 'org.apache.activemq:apache-activemq:4.1.1'
compile 'com.acme:acme-adapter-api:1.3-SNAPSHOT'
}
当我运行 GRAILS依赖性的报告
,我可以看到关于 ACME适配器-API这一行
,例如:
When I run grails dependency-report
, I can see this line concerning the acme-adapter-api
, for example:
acme-adapter-api by com.acme
108 kB (0 kB downloaded, 108 kB in cache)
当我尝试运行的Grails编译
,我没有得到幸运的,因为它当时抱怨它无法从解析类 com.acme
组。
When I try to run grails compile
, I don't get lucky, as it then complains it is unable to resolve the classes from the com.acme
group.
有趣的是,的ActiveMQ
相关性似乎并不成为一个问题...
Interestingly the activemq
dependencies don't seem to be a problem...
所不同的是极致的依赖关系是不是在 mavenCentral()
,但只有在 mavenRepo(D:/ Maven的回购)
。所以我想:也许它不是拿起它,从本地磁盘,然后......,改变了版本有些好笑(1.999-SNAPSHOT)值好好尝试一下在 BuildConfig.groovy存在
文件。当运行的Grails编译
再次,命令超时,称该版本找不到:
The difference is that the acme dependencies are not in mavenCentral()
, but only in mavenRepo("D:/maven-repo")
. So I thought: "Maybe it is not picking it up from the local disk then..." and changed the version to some funny (1.999-SNAPSHOT) value that doens't exist in the BuildConfig.groovy
file. When running grails compile
again, the command timed out, saying that version could not be found:
UNRESOLVED DEPENDENCIES
D:/maven-repo: unable to get resource for com/acme#acme-adapter-api;1.999-SNAPSHOT
如此明显的局部依赖得到解决,但不知在下一步不适用,编译...
So obviously the local dependency gets resolved but somehow not applied in the next step, compilation...
推荐答案
原来,问题是当时的非清空缓存作为神器。虽然ActiveMQ的jar文件是不变,极致适配器-api.jar文件,其实很多时候改变,但不增加Maven构建ID,1.3,在上述情况下。
It turned out that the problem was then non empty cache for the artifact. While the activemq jar file was untouched, the acme-adapter-api.jar was in fact many times changed but without increasing the maven build id, 1.3, in the above case.
我可以修复它,当我增加了内部版本号为1.4快照...
I could fix it, when I increased the build number to 1.4-SNAPSHOT...
两个问题依然是:
- 是不是行家合同的总是的取快照版本,对于完全相同的原因是什么?
- 如何强制清空缓存?而且它在哪里?
- Isn't the maven contract to always fetch SNAPSHOT versions, for the exact same reason?
- How to forcefully empty the cache? And where is it?
I will open a new question to answer part 2 here
这篇关于Grails和本地Maven依赖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!