[英]Trouble Installing/Using Grails Release Plugin 2.2.1
I'm trying to get the Grails release plugin to work, but running into some trouble. 我试图让Grails 发布插件正常工作,但是遇到了一些麻烦。 The current version of Grails that ships with STS/GGTS is 2.2.3, so I can't use the most recent version (3.0) of the release plugin because that requires Grails 2.3. STS / GGTS附带的Grails的当前版本是2.2.3,所以我不能使用发行插件的最新版本(3.0),因为这需要Grails 2.3。 Instead, I tried to install version 2.2.1. 相反,我尝试安装2.2.1版。
I started by adding the following to my BuildConfig.groovy and refreshed my dependencies. 我首先将以下内容添加到BuildConfig.groovy中,并刷新了我的依赖项。
plugins {
... // other plugin dependencies
build ':release:2.2.1', ':rest-client-builder:1.0.3', {
export = false
}
... // other plugin dependencies
}
but I got the following error when I ran grails maven-install 但是当我运行grails maven-install时出现以下错误
| Script 'MavenInstall' not found, did you mean:
1) UninstallPlugin
2) InstallPlugin
3) InstallDependency
4) InstallJQuery
5) InstallTemplates
. 。
. 。
LOTS OF TROUBLE SHOOTING DETAILS FOLLOW. 以下是许多疑难解答的细节。
YOU CAN JUST SKIP TO PETER'S ANSWER BELOW 您可以跳过以下PETER的答案
. 。
. 。
Then, I found this JIRA issue , and I listed my plug-ins and release was not install, so I tried 然后,我发现了JIRA问题 ,并列出了我的插件,但未安装发行版,因此我尝试了
grails install-plugin release 2.2.1
and refreshed my dependencies and I ended up with a compilation error in GrailsCentralDeployer. 并刷新了我的依赖关系,最后在GrailsCentralDeployer中出现编译错误。 It could not find grails.plugins.rest.client.RestBuilder, so I ran 它找不到grails.plugins.rest.client.RestBuilder,所以我跑了
grails install-plugin rest-client-builder 1.0.3
and refreshed my dependencies and the error went away. 并刷新了我的依赖关系,错误消失了。 At this point, I'm not sure if the code I added to BuildConfig.groovy is actually doing anything. 在这一点上,我不确定我添加到BuildConfig.groovy中的代码是否实际上在做任何事情。
Now, when I run 现在,当我跑步
grails maven-install --stacktrace
I get the following 我得到以下
| 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
If it helps, here are the contents of my BuildConfig.groovy 如果有帮助,这是我的BuildConfig.groovy的内容
removed - refer to edit 2 below
EDIT 1 This is my was application.properties file 编辑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
I moved the security plugins from here to BuildConfig.groovy and everything worked fine, so the new file looks like this 我将安全性插件从此处移至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
and my new BuildConfig.groovy looks like this. 我的新BuildConfig.groovy看起来像这样。
removed - refer to edit 2 below
I ran grails clean
and then grails compile
and the grails maven-install
and got the same ClassNotFoundException: grails.plugins.publish.DistributionManagementInfo
我运行grails clean
,然后进行grails compile
,然后执行grails maven-install
并得到相同的ClassNotFoundException: grails.plugins.publish.DistributionManagementInfo
I then ran grails list-plugins --installed
and this is the output 然后我运行grails list-plugins --installed
,这是输出
removed - refer to edit 2 below
Edit 2 编辑2
@peter-ledbrook, Before, I saw your advice, I have freshly cleaned the project. @ peter-ledbrook,之前,我看到了您的建议,我刚刚清理了这个项目。 I added grails.project.work.dir = "target"
to my BuildConfig.groovy then ran the following 我将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$
My BuildConfig.groovy looks like this 我的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"
and grails list-plugins --installed
look like this 和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
Edit The problem is the export = false
. 编辑问题是export = false
。 Remove that. 删除它。 I don't understand why it's preventing the installation of the plugin, so it's possibly a bug in Grails. 我不明白为什么它阻止插件的安装,所以它可能是Grails中的错误。 Raise an issue in the Grails JIRA . 在Grails JIRA中提出一个问题。
Previous answer 先前的答案
What you're doing looks fine. 你在做什么看起来不错。 I would simply add this line to the beginning of BuildConfig.groovy
: 我只需将这一行添加到BuildConfig.groovy
的开头:
grails.project.work.dir = "target"
Save that and then run 保存并运行
grails refresh-dependencies
grails maven-install
Any time there seem to be strange class-related errors, simply delete the whole of the target
directory. 每当出现与类有关的奇怪错误时,只需删除整个target
目录即可。
Don't use install-plugin
, it's deprecated and removed entirely in 2.3. 不要使用install-plugin
,它已在2.3中被弃用并完全删除。
You were correct to use BuildConfig.groovy
- after saving the change you just need to run grails compile
or some other commandline script that triggers dependency resolution. 您正确使用了BuildConfig.groovy
保存更改后,您只需要运行grails compile
或其他触发依赖项解析的命令行脚本即可。 This will install any missing plugins and their dependencies, and report any errors. 这将安装所有缺少的插件及其依赖项,并报告所有错误。
Note that since you ran install-plugin
you probably have cruft in application.properties
- be sure to delete any lines in there that refer to installed plugins. 请注意,由于您运行了install-plugin
,因此application.properties
可能有很多问题-请确保删除其中所有引用已安装插件的行。 For a plugin you can delete everything except for 对于插件,您可以删除除以下内容以外的所有内容
app.grails.version=2.2.3
Your BuildConfig.groovy
looks a bit weird, more of an application type of file than a plugin. 您的BuildConfig.groovy
看起来BuildConfig.groovy
,更多是文件的应用程序类型而不是插件。 You don't need grails.servlet.version
, grails.project.target.level
, grails.project.source.level
, grails.project.war.file
. 您不需要grails.servlet.version
, grails.project.target.level
, grails.project.source.level
, grails.project.war.file
。 Also I like to keep things simple and move everything to the target
folder with the grails.project.work.dir
property. 我也想保持简单,并使用grails.project.work.dir
属性将所有内容移动到target
文件夹。
And do you really need all of those plugin dependencies? 而且您真的需要所有这些插件依赖项吗? They make sense in an application, but not in a plugin unless your plugin really does need them: 它们在应用程序中有意义,但在插件中没有意义,除非您的插件确实需要它们:
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.