2014-08-28 29 views
0

Grails 2.3.10如何從自定義工件回購加載grails插件?

我已經創作了一個Grails插件供我公司使用,並安裝在公司的Artifactory回購庫中。我如何設置另一個項目的BuildConfig,以便在安裝插件時檢查公司的私人工件回購?

這是我曾嘗試:

repositories { 
    ... 
    grailsRepo "http://artifactory.mycompany.com/" 
} 

,也...

repositories { 
    ... 
    mavenRepo "http://artifactory.mycompany.com/" 
} 

這些都不似乎有任何效果。什麼是正確的配置更改或添加到grails插件回購?

理想情況下,我想無論是定製回購和插件進行檢查中央回購Grails的。

編輯:

爲了進一步澄清...我想我的項目被配置成下拉只存在於公司的artifactory的服務器上,而不是在中央Grails的插件式回購的插件。

我從Grails的以下輸出編譯:

Error | 
Resolve error obtaining dependencies: Could not find artifact org.grails.plugins:cascade-validation:zip:0.1.0 in grailsCentral (http://repo.grails.org/grails/plugins) (Use --stacktrace to see the full trace) 
Error | 
Resolve error obtaining dependencies: Could not find artifact org.grails.plugins:cascade-validation:zip:0.1.0 in grailsCentral (http://repo.grails.org/grails/plugins) (Use --stacktrace to see the full trace) 
Error | 
Resolve error obtaining dependencies: Could not find artifact org.grails.plugins:cascade-validation:zip:0.1.0 in grailsCentral (http://repo.grails.org/grails/plugins) (Use --stacktrace to see the full trace) 
Error | 
Could not find artifact org.grails.plugins:cascade-validation:zip:0.1.0 in grailsCentral (http://repo.grails.org/grails/plugins) 

它看起來像公司服務器不被訪問基於生成輸出。

+0

mavenRepo是足夠的回購 「基於網絡」。你確定,你已經把插件放在'plugins {}'而不是'dependencies {}'中。有沒有錯誤? '--verbose'和/或'--debug'是否會給出更好的錯誤? – cfrick 2014-08-28 18:32:14

+0

@cfrick:已更新。謝謝! – RMorrisey 2014-08-28 22:05:02

+0

你正在使用什麼'grails.project.dependency.resolver'? – cfrick 2014-08-28 22:40:31

回答

5

這裏是我如何做到這一點。該插件的BuildConfig.groovy:

grails.project.dependency.distribution = { 
    remoteRepository(id: "localPluginReleases", url: "http://localhost:8081/artifactory/plugins-release-local/") 
    remoteRepository(id: "localPluginSnapshots", url: "http://localhost:8081/artifactory/plugins-snapshot-local/") 
} 

插件,然後用包裝:

grails publish-plugin --allow-overwrite --noScm --repository=localPluginReleases 

應用程序的BuildConfig.groovy:

grails.project.dependency.resolution = { 
    repositories { 
     mavenRepo "http://localhost:8081/artifactory/plugins-snapshot-local/" 
     mavenRepo "http://localhost:8081/artifactory/plugins-release-local/" 
     // other stuff 
    } 
} 
+0

感謝您的幫助!當我把mavenRepo放在第一位時,我不再看到它在中心擊中Grails。有沒有辦法可以檢查兩個地方?此外...當我用發佈-plugin命令我得到這個錯誤: – RMorrisey 2014-08-29 13:43:16

+0

你怎麼知道這不是打Grails的中央「未找到庫‘真正的’配置」?如果你的其他插件是最新的,它不會下載任何東西。我通常使用'cd/path/to/my/app'(不是插件)和'rm -r target',然後使用'grails compile'來確保應用程序獲得最新的更新。我不確定你的發佈錯誤。你把正確的URL放在插件的BuildConfig.groovy中了嗎?我只是在我的開發盒上安裝了artifactory,並使用了默認設置。 – Ken 2014-08-29 13:57:04

+0

@Rororysey你找到了答案嗎?我無法發佈插件,我有正確的URL及以上 – Viriato 2014-11-18 17:31:51

相關問題