maven - 安装/使用 Grails Release Plugin 2.2.1 时遇到问题

标签 maven grails

我正在尝试获取 Grails release plugin工作,但遇到了一些麻烦。 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

.

.

很多故障排除细节如下。
您可以直接跳到下面彼得的回答


.

.

然后,我找到了这个 JIRA issue ,并且我列出了我的插件并且没有安装发布,所以我尝试了
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
这是我的 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 compilegrails 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目录。

关于maven - 安装/使用 Grails Release Plugin 2.2.1 时遇到问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18056918/

相关文章:

java - Maven 中的 Vaadin 应用程序获取小部件错误(使用 tomcat)

java - Hibernate 和 EclipseLink 提供程序

grails - 是否可以将简单的grails应用程序转换为可以在Adobe CQ中运行的OSGi软件包?

tomcat - 在 gant 脚本中使用(多词位)grails 目标

javascript - 如何在Grails中将remoteFunction值传递给Java脚本

mysql - grails 回滚数据库操作出现某些错误

java - 加特林与 GitLab CI/CD

java - maven ejb 项目 - 包含依赖项的包

java - Maven 程序集描述符属性

spring - grails 3 约束异常