`
agile_boy
  • 浏览: 554366 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

[转载]Grails plugins on Hudson

阅读更多

此文也是因为被“墙”才转载的,原文地址:http://adhockery.blogspot.com/2010/03/grails-plugins-on-hudson.html

 

Yesterday I spent some time setting up Hudson continuous integration build for my various Grails plugins. It was pretty straightforward but I've been asked to document the steps involved.

 

Each plugin has one or more test applications under test/projects each of which has grails.plugin.location.whatever = "../../.." in BuildConfig.groovy. So each plugin CI build needs to run not only the plugin's own unit tests but any integration and/or functional tests included in the test apps as well.

 

Hudson plugins

I installed the essential plugins I would need:

  • The Grails plugin makes building Grails projects much easier and allows you to build against multiple versions of Grails.
  • The Git plugin enables Hudson to pull from a Git repository such as GitHub.
  • The GitHub plugin adds links to the GitHub project in the Hudson build.
  • The Chuck Norris plugin encourages you to keep your tests from failing.

Configuring Grails

Under Manage Hudson -> Configure System there is a Grails Builder section where I entered the name and path of the various versions of Grails installed on the build box.

 

Connecting to GitHub

In the project configuration:

  • I pasted the GitHub project URL in the Github project field (shown if you have the GitHub plugin installed).
  • Under Source Code Management I selected Git then pasted the read-only repository URL into the URL of repository field.
  • I entered master in the Branch Specifier field as I've seen Hudson do odd things picking up changes from other branches before. I don't really need this behaviour and haven't had time to investigate it further yet.
  • I ticked Poll SCM under Build Triggers then set a cron expression of */5 * * * * so Hudson will poll GitHub every 5 minutes.

Grails build steps

  • Select Build with Grails from the Add build step drop down, then:
  •  
    • Select the Grails Installation you want to use.
    • Enter the Targets to run. These are the Grails commands that Hudson will execute. For example, I entered "test-app unit: -clean --non-interactive" package-plugin for the to run unit tests then package the plugin. The quotes allow arguments to be passed to individual targets so I'm telling the test-app phase to build clean and run non-interactively (i.e. Grails won't ask about things like installing or uninstalling plugins).
    • The other fields can be left blank for now.
  • Add further Grails build steps for test applications. The only difference in configuring these is that the targets will likely be different and Project Base Directory needs to be set to the relative path where the test apps lives, e.g. test/projects/content-caching

Isolating each build

One thing I found is that it's probably a good idea to specify separate working directory for each build. I found that simultaneous builds would stomp over each other's compiled classes otherwise. This is particularly an issue for me where I have a build for the Selenium RC plugin whilst one of the test apps for the Springcache plugin uses the latest Selenium RC release to run tests.

 

Hudson provides various environment variables so I just set grails.work.dir to /tmp/.grails/${JOB_NAME} in every case.

 

The other consideration is the port that Grails applications will use. If you are running any kind of functional tests the Grails application will start and it each Hudson job needs to use a separate server port or simultaneous jobs will experience port contention. The server port is also configured in the Grails build step. I've just assigned a different one to each job but I couldn't think of a particularly clever way to automate the port assignment.

 

Test reports

Under Post-build Actions I ticked Publish JUnit test result report then entered a comma-separated set of paths to the XML reports generated by each build step. For example, the Springcache plugin has the following reports configured:

target/test-reports/*.xml,test/projects/springcache-test/target/test-reports/*.xml,test/projects/content-caching/target/test-reports/*.xml

 

That's picking up the root plugin's unit test reports and the reports generated by the springcache-test and content-caching test applications. Hudson does a good job of merging these together into a unified test report.

 

Running tests that need a browser

Some of my tests use Selenium RC which drives a real browser. Given that Hudson is running on a headless box I had to get the display exported to a box with an X Windows environment.

 

Still to do

Right now all the plugins are building against Grails 1.2.1 only so the next task is to set up parallel builds using Grails 1.3-RC1. Ideally I would like to use Hudson's multi-configuration project capability to do that but I haven't had a chance to look into it yet. I'd also like to use Gradle to build the various project with one build step but I'd lose the convenience in switching Grails versions that the Hudson Grails plugin gives me.

 

分享到:
评论

相关推荐

    Grails Grails Grails

    Grails 的设计深受Ruby on Rails的影响,提供了MVC(模型-视图-控制器)架构模式,允许开发者快速构建动态、数据库驱动的Web应用。 **Groovy 语言基础** Groovy 是一种动态类型的、面向对象的编程语言,它可以无缝...

    Grails开发之(Rest教程).pdf

    在安全性配置部分,提及了org.grails.plugins:spring-security-core和org.grails.plugins:spring-security-rest,这代表了Grails项目中将使用Spring Security来管理安全问题,包括认证和授权,以及Spring Security ...

    grails 3.3.2 资源下载

    5. **Grails Plugins**: Grails 插件系统是其一大特色,提供了大量预构建的组件,如安全、缓存、邮件服务等。Grails 3.3.2可能包含一些新的或升级的插件,这些插件可以帮助开发者快速实现特定功能。 6. **Spring ...

    grails 中文手册

    5. **Grails Plugins** - Grails 插件系统是其核心特性之一,允许开发者重用和扩展功能。 - 例如:spring-security 插件提供安全控制,asset-pipeline 插件处理静态资源管理。 6. **Grails Templates** - 模板...

    Grails权威指南 Grails权威指南

    《Grails权威指南》是一本全面深入探讨Grails框架的专著,旨在帮助读者掌握这一强大的Web开发工具。Grails是一种基于Groovy语言的开源框架,它为构建现代、高效的应用程序提供了简洁高效的解决方案。本指南针对不同...

    Eclipse下搭建Grails项目

    【Grails项目搭建详解】 Grails是一个基于Groovy语言的开源Web应用框架,它简化了开发过程,尤其适合快速构建动态网站。在Eclipse中搭建Grails项目可能相对复杂,但通过以下步骤,即使是初学者也能顺利进行。 1. *...

    eclipse开发grails插件

    **Grails**是基于Groovy语言的全栈式Web开发框架,它借鉴了Ruby on Rails的设计理念,提供了快速开发的可能。Grails的核心特性包括MVC架构、领域驱动设计(GORM)、自动化构建过程以及丰富的插件系统。通过Eclipse的...

    Grails中文参考手册

    **Plugins** Grails 插件系统是其强大功能之一,允许开发者复用和扩展已有功能。例如,有用于认证、缓存、邮件发送等的插件,可以快速集成到项目中。 **Grails Command Line Interface (CLI)** Grails 提供了一个...

    grails快速开发web

    Grails 的设计灵感来源于 Ruby on Rails,它不仅继承了 Rails 的简洁性,还充分利用了 Java 平台的强大功能。 #### 二、Grails 的核心特性 - **面向领域语言 (DSL)**:Grails 提供了一种面向领域的语言,让开发者...

    grails-plugins-metadata

    Grails是一个基于Groovy语言的开源Web应用框架,它借鉴并融合了Ruby on Rails的设计理念,提供了高效的开发环境和强大的功能。 元数据在软件开发中扮演着至关重要的角色,尤其是在插件系统中。元数据包含了关于插件...

    grails-用户手册

    《Grails用户手册》 Grails,作为一个基于Groovy语言的开源Web应用框架,深受开发者喜爱,它简化了Java开发的复杂性,提供了强大的MVC(Model-View-Controller)架构,以及丰富的插件系统。这份用户手册将帮助你...

    grails-2.4.4.zip

    Grails 借鉴了Ruby on Rails的设计理念,引入了GORM(Grails Object Relational Mapping)用于数据库操作,以及一系列的插件系统,支持快速构建复杂的Web应用程序。 2. **Groovy语言基础** Grails 采用Groovy作为...

    grails学习

    grails.project.plugins.dir="./plugins" ``` 这将恢复旧的插件存储位置,从而解决编辑问题。 3. **静态参数插件应用** 使用 `<g:selectParams>` 和 `<g:staticParams>` 标签可以方便地在视图层处理静态参数。...

    Grails 入门指南+示例源码

    9. **Plugins**:Grails的插件系统,利用插件可以快速添加功能,如安全、缓存等。 10. **Testing**:了解Grails的测试框架,包括单元测试、集成测试和功能测试,以及如何编写和运行测试。 11. **持续集成与部署**...

    Grails学习记录

    9. **Grails Plugins**:丰富的插件生态系统,如Spring Security、Cache、Email等,可以帮助快速开发和扩展功能。 10. **Gradle构建工具**:Grails项目默认使用Gradle进行构建,理解Gradle的构建脚本和任务对于项目...

    TsuyoshiYamamoto_Acegi On Grails

     How to use Acegi on Grails  using Grails Domain class  Beans to support Acegi on Grails  Grails Acegi Plugin  Setting up Acegi Plugin  Secure your Ajax  Secure your Service

    Grails1.1中文文档.rar

    7. **Plugins**:Grails 插件系统是其一大亮点,提供了大量的预构建组件,如Spring Security、Hibernate、RESTful服务等,可以通过简单的命令行工具进行安装和集成。 ### Grails 1.1 版本特性 1. **性能提升**:...

    Grails权威指南.pdf

    - **Plugins**:Grails插件系统允许开发者复用和扩展功能,如安全、缓存、邮件服务等。 - **配置管理**:通过`grails-app/conf/`目录下的配置文件,如`Config.groovy`,进行项目配置。 3. **控制器和视图**: - ...

    grails 配置mongodb数据库

    Grails是一款基于Groovy语言的、高效的Web应用开发框架,它借鉴了Ruby on Rails的许多优秀特性。MongoDB则是一种流行的NoSQL数据库,以其灵活性、高性能和易于扩展性而闻名。 首先,我们需要确保已正确安装了Grails...

Global site tag (gtag.js) - Google Analytics