Maven 安装/使用Grails发行版插件2.2.1时出现问题
我正试图让圣杯发挥作用,但遇到了一些麻烦。STS/GGTS附带的Grails的当前版本是2.2.3,因此我不能使用最新版本(3.0)的发布插件,因为这需要Grails 2.3。相反,我尝试安装版本2.2.1 我首先将以下内容添加到BuildConfig.groovy中,并刷新了依赖项Maven 安装/使用Grails发行版插件2.2.1时出现问题,maven,grails,Maven,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', {
plugins {
... // other plugin dependencies
build ':release:2.2.1', ':rest-client-builder:1.0.3', {
export = false
}
... // other plugin dependencies
}
但在运行GrailsMaven安装时,我遇到了以下错误
| Script 'MavenInstall' not found, did you mean:
1) UninstallPlugin
2) InstallPlugin
3) InstallDependency
4) InstallJQuery
5) InstallTemplates
随后有许多故障排除细节。您可以直接跳到下面PETER的答案 然后,我发现了这个,我列出了我的插件,但发布版没有安装,所以我尝试了
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
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的内容
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
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"
| 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
我的新BuildConfig.groovy如下所示
removed - refer to edit 2 below
我运行了grails clean
然后grails compile
和grails maven安装
,得到了相同的ClassNotFoundException:grails.plugins.publish.DistributionManagementInfo
然后我运行了grailslistplugins--installed
,这是输出
removed - refer to edit 2 below
编辑2
@彼得·莱德布鲁克,在我看到你的建议之前,我刚刚清理了这个项目。我在BuildConfig.groovy中添加了
grails.project.work.dir=“target”
,然后运行以下命令
| 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
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 Metadata file
#Thu Jul 25 07:05:41 EDT 2013
app.grails.version=2.2.3
app.name=swiper-admin
app.version=0.1
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"
| 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
和grails列表插件——安装的如下所示
#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
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"
| 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
不要使用安装插件
,它已被弃用,并在2.3中被完全删除
您正确地使用了BuildConfig.groovy
——保存更改后,只需运行grails compile
或其他一些触发依赖项解析的命令行脚本。这将安装任何缺少的插件及其依赖项,并报告任何错误
请注意,由于您运行了install plugin
,您的应用程序中可能有cruft。properties
-请务必删除其中引用已安装插件的任何行。对于插件,您可以删除除
app.grails.version=2.2.3
您的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"
不要使用安装插件
,它已被弃用,并在2.3中被完全删除
您正确地使用了BuildConfig.groovy
——保存更改后,只需运行grails compile
或其他一些触发依赖项解析的命令行脚本。这将安装任何缺少的插件及其依赖项,并报告任何错误
请注意,由于您运行了install plugin
,您的应用程序中可能有cruft。properties
-请务必删除其中引用已安装插件的任何行。对于插件,您可以删除除
app.grails.version=2.2.3
您的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"
编辑问题在于导出=false
。去掉那个。我不明白为什么它会阻止插件的安装,所以它可能是Grails中的一个bug。在报告中提出一个问题
先前的答案
你所做的看起来很好。我只想将这一行添加到BuildConfig.groovy
的开头:
grails.project.work.dir = "target"
保存它,然后运行
grails refresh-dependencies
grails maven-install
每当出现与类相关的奇怪错误时,只需删除整个目标
目录。编辑问题在于导出=false
。去掉那个。我不明白为什么它会阻止插件的安装,所以它可能是Grails中的一个bug。在报告中提出一个问题
先前的答案
你所做的看起来很好。我只想将这一行添加到BuildConfig.groovy
的开头:
grails.project.work.dir = "target"
保存它,然后运行
grails refresh-dependencies
grails maven-install
每当出现与类相关的奇怪错误时,只需删除整个目标
目录。感谢您的快速回复。我想我不清楚。我正在开发一个应用程序,而不是插件。这是我的第一个grails应用程序,因此我非常感谢您的建议。你对我的BuildConfig.groovy的建议会有什么变化,因为我正在开发一个应用程序而不是插件。我将按照您的建议清理application.properties并尝试grails编译,然后让您知道