[英]Trouble Installing/Using Grails Release Plugin 2.2.1
我試圖讓Grails 發布插件正常工作,但是遇到了一些麻煩。 STS / GGTS附帶的Grails的當前版本是2.2.3,所以我不能使用發行插件的最新版本(3.0),因為這需要Grails 2.3。 相反,我嘗試安裝2.2.1版。
我首先將以下內容添加到BuildConfig.groovy中,並刷新了我的依賴項。
plugins {
... // other plugin dependencies
build ':release:2.2.1', ':rest-client-builder:1.0.3', {
export = false
}
... // other plugin dependencies
}
但是當我運行grails maven-install時出現以下錯誤
| Script 'MavenInstall' not found, did you mean:
1) UninstallPlugin
2) InstallPlugin
3) InstallDependency
4) InstallJQuery
5) InstallTemplates
。
。
以下是許多疑難解答的細節。
您可以跳過以下PETER的答案
。
。
然后,我發現了JIRA問題 ,並列出了我的插件,但未安裝發行版,因此我嘗試了
grails install-plugin release 2.2.1
並刷新了我的依賴關系,最后在GrailsCentralDeployer中出現編譯錯誤。 它找不到grails.plugins.rest.client.RestBuilder,所以我跑了
grails install-plugin rest-client-builder 1.0.3
並刷新了我的依賴關系,錯誤消失了。 在這一點上,我不確定我添加到BuildConfig.groovy中的代碼是否實際上在做任何事情。
現在,當我跑步
grails maven-install --stacktrace
我得到以下
| Loading Grails 2.2.3
| Configuring classpath.
| Environment set to development.....
| Packaging Grails application.....
| Error Error executing script MavenInstall: java.lang.ClassNotFoundException: grails.plugins.publish.DistributionManagementInfo (NOTE: Stack trace has been filtered. Use --verbose to see entire trace.)
java.lang.ClassNotFoundException: grails.plugins.publish.DistributionManagementInfo
如果有幫助,這是我的BuildConfig.groovy的內容
removed - refer to edit 2 below
編輯1這是我的was application.properties文件
#Grails Metadata file
#Thu Jul 25 07:05:41 EDT 2013
app.grails.version=2.2.3
app.name=swiper-admin
app.version=0.1
plugins.spring-security-cas=1.0.5
plugins.spring-security-core=1.2.7.3
plugins.spring-security-ldap=1.0.6
我將安全性插件從此處移至BuildConfig.groovy,一切正常,因此新文件如下所示
#Grails Metadata file
#Thu Jul 25 07:05:41 EDT 2013
app.grails.version=2.2.3
app.name=swiper-admin
app.version=0.1
我的新BuildConfig.groovy看起來像這樣。
removed - refer to edit 2 below
我運行grails clean
,然后進行grails compile
,然后執行grails maven-install
並得到相同的ClassNotFoundException: grails.plugins.publish.DistributionManagementInfo
然后我運行grails list-plugins --installed
,這是輸出
removed - refer to edit 2 below
編輯2
@ peter-ledbrook,之前,我看到了您的建議,我剛剛清理了這個項目。 我將grails.project.work.dir = "target"
添加到我的BuildConfig.groovy中,然后運行以下命令
user@computer:~/dev/workspace/swiper-admin$ grails clean
| Application cleaned.
user@computer:~/dev/workspace/swiper-admin$ grails refresh-dependencies
| Dependencies refreshed.
user@computer:~/dev/workspace/swiper-admin$ grails maven-install
| Script 'MavenInstall' not found, did you mean:
1) UninstallPlugin
2) InstallPlugin
3) InstallDependency
4) InstallJQuery
5) InstallTemplates
> Please make a selection or enter Q to quit: Q
user@computer:~/dev/workspace/swiper-admin$ grails compile
| Compiling 143 source files
| Compiling 27 source files.
user@computer:~/dev/workspace/swiper-admin$ grails maven-install
| Script 'MavenInstall' not found, did you mean:
1) UninstallPlugin
2) InstallPlugin
3) InstallDependency
4) InstallJQuery
5) InstallTemplates
> Please make a selection or enter Q to quit: Q
user@computer:~/dev/workspace/swiper-admin$
我的BuildConfig.groovy看起來像這樣
grails.servlet.version = "2.5" // Change depending on target container compliance (2.5 or 3.0)
grails.project.class.dir = "target/classes"
grails.project.test.class.dir = "target/test-classes"
grails.project.test.reports.dir = "target/test-reports"
grails.project.target.level = 1.6
grails.project.source.level = 1.6
grails.project.war.file = "${appName}-${appVersion}.war"
grails.project.work.dir = "target"
grails.project.dependency.resolution = {
// inherit Grails' default dependencies
inherits("global") { }
log "warn" // log level of Ivy resolver, either 'error', 'warn', 'info', 'debug' or 'verbose'
checksums true // Whether to verify checksums on resolve
legacyResolve false // whether to do a secondary resolve on plugin installation, not advised and here for backwards compatibility
repositories {
inherits true // Whether to inherit repository definitions from plugins
grailsPlugins()
grailsHome()
grailsCentral()
mavenLocal()
mavenCentral()
// uncomment these (or add new ones) to enable remote dependency resolution from public Maven repositories
//mavenRepo "http://snapshots.repository.codehaus.org"
//mavenRepo "http://repository.codehaus.org"
//mavenRepo "http://download.java.net/maven/2/"
//mavenRepo "http://repository.jboss.com/maven2/"
}
dependencies { }
plugins {
runtime ":hibernate:$grailsVersion"
runtime ":jquery:1.8.3"
runtime ":resources:1.2"
build ":tomcat:$grailsVersion"
build ':release:2.2.1', ':rest-client-builder:1.0.3', { export = false }
compile ':cache:1.0.1'
compile ":db-reverse-engineer:0.5"
//security
compile ":spring-security-core:1.2.7.3"
compile ":spring-security-cas:1.0.5"
compile ":spring-security-ldap:1.0.6"
}
}
grails.project.repos.atlassian_nexus.url = "https://atlassian.liberty.edu/nexus/content/groups/public"
grails.project.repos.atlassian_nexus.username = "terskine"
grails.project.repos.default = "atlassian_nexus"
和grails list-plugins --installed
看起來像這樣
| Loading Grails 2.2.3
| Configuring classpath.
| Environment set to development.....
Plug-ins you currently have installed are listed below:
-------------------------------------------------------------
cache 1.0.1 -- Cache Plugin
db-reverse-engineer 0.5 -- Grails Database Reverse Engineering Plugin
hibernate 2.2.3 -- Hibernate for Grails
jquery 1.8.3 -- JQuery for Grails
resources 1.2 -- Resources
spring-security-cas 1.0.5 -- Jasig CAS support for the Spring Security plugin.
spring-security-core1.2.7.3 -- Spring Security Core Plugin
spring-security-ldap1.0.6 -- LDAP authentication support for the Spring Security plugin.
tomcat 2.2.3 -- Apache Tomcat plugin for Grails
webxml 1.4.1 -- WebXmlConfig
To find more info about plugin type 'grails plugin-info [NAME]'
To install type 'grails install-plugin [NAME] [VERSION]'
For further info visit http://grails.org/Plugins
編輯問題是export = false
。 刪除它。 我不明白為什么它阻止插件的安裝,所以它可能是Grails中的錯誤。 在Grails JIRA中提出一個問題。
先前的答案
你在做什么看起來不錯。 我只需將這一行添加到BuildConfig.groovy
的開頭:
grails.project.work.dir = "target"
保存並運行
grails refresh-dependencies
grails maven-install
每當出現與類有關的奇怪錯誤時,只需刪除整個target
目錄即可。
不要使用install-plugin
,它已在2.3中被棄用並完全刪除。
您正確使用了BuildConfig.groovy
保存更改后,您只需要運行grails compile
或其他觸發依賴項解析的命令行腳本即可。 這將安裝所有缺少的插件及其依賴項,並報告所有錯誤。
請注意,由於您運行了install-plugin
,因此application.properties
可能有很多問題-請確保刪除其中所有引用已安裝插件的行。 對於插件,您可以刪除除以下內容以外的所有內容
app.grails.version=2.2.3
您的BuildConfig.groovy
看起來BuildConfig.groovy
,更多是文件的應用程序類型而不是插件。 您不需要grails.servlet.version
, grails.project.target.level
, grails.project.source.level
, grails.project.war.file
。 我也想保持簡單,並使用grails.project.work.dir
屬性將所有內容移動到target
文件夾。
而且您真的需要所有這些插件依賴項嗎? 它們在應用程序中有意義,但在插件中沒有意義,除非您的插件確實需要它們:
grails.project.work.dir = "target"
grails.project.dependency.resolution = {
inherits 'global'
log 'warn'
repositories {
grailsCentral()
mavenLocal()
mavenCentral()
}
dependencies {
}
plugins {
build ':release:2.2.1', ':rest-client-builder:1.0.3', { export = false }
}
}
grails.project.repos.foo.url = "https://server.domain.edu/nexus/content/groups/public"
grails.project.repos.foo.username = "bar"
grails.project.repos.default = "foo"
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.