我正在用 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-adapter-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 dependency-report 时,我可以看到关于 acme-adapter-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 compile 时,我并不走运,因为它随后抱怨无法解析 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...
区别在于acme依赖不在mavenCentral()中,而只在mavenRepo("D:/maven-repo")中.所以我想:也许它没有从本地磁盘中提取它然后......"并将版本更改为一些在 BuildConfig.groovy 文件.再次运行grails compile时,命令超时,说找不到版本:
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 文件未受影响,但实际上 acme-adapter-api.jar 已多次更改,但没有增加 maven build 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-SNAPSHOT...
I could fix it, when I increased the build number to 1.4-SNAPSHOT...
还有两个问题:
我将打开一个新问题来回答第 2 部分 此处
I will open a new question to answer part 2 here
更多推荐
Grails 和本地 Maven 依赖项
发布评论