DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
View Events Video Library
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Integrating PostgreSQL Databases with ANF: Join this workshop to learn how to create a PostgreSQL server using Instaclustr’s managed service

Mobile Database Essentials: Assess data needs, storage requirements, and more when leveraging databases for cloud and edge applications.

Monitoring and Observability for LLMs: Datadog and Google Cloud discuss how to achieve optimal AI model performance.

Automated Testing: The latest on architecture, TDD, and the benefits of AI and low-code tools.

Related

  • Delivering Your Code to the Cloud With JFrog Artifactory and GitHub Actions
  • Automated CI/CD of Multiple Projects Using TeamCity’s Kotlin DSL
  • Main Features and Benefits of Google Kubernetes Engine
  • Automating Developer Workflows and Deployments on Heroku and Salesforce

Trending

  • Five Free AI Tools for Programmers to 10X Their Productivity
  • Decoding Business Source Licensing: A New Software Licensing Model
  • OneStream Fast Data Extracts APIs
  • How To Use ChatGPT API in Python for Your Real-Time Data
  1. DZone
  2. Testing, Deployment, and Maintenance
  3. Deployment
  4. Automate Grails App Builds with TeamCity

Automate Grails App Builds with TeamCity

Vaclav Pech user avatar by
Vaclav Pech
·
Feb. 06, 08 · News
Like (0)
Save
Tweet
Share
17.72K Views

Join the DZone community and get the full member experience.

Join For Free

The Grails framework has reached maturity with the recent release of its 1.0 version. As Grails is becoming increasingly popular and more and more enterprise applications based on Grails started appearing, I believe that Grails developers deserve the same level of tool support that is available to plain Java developers. This applies not only to IDEs, but also to continuous integration servers. Grails projects' needs for continuous integration don't differ from needs of any other enterprise projects.

TeamCity is a continuous integration server with many unique features, like pre-tested commit, unit and integration testing, integrated test reports, tight IDE (Eclipse, Visual Studio and IntelliJ IDEA) integration, code coverage calculation and reporting, parallel builds, VCS-event-based build triggering and many others. The good news is that most of these features are available to Grails projects as well. In my short series of how-to articles I'll show you how to configure TeamCity to leverage its full power for your Grails applications.

The ultimate goal

First I'll build your appetite with a couple of screenshots from my project build to demonstrate the options you have. We will gradually get to a point when you will be able to get the same screenshots from your own Grails project, I'm sure.

[img_assist|nid=803|title=|desc=|link=none|align=middle|width=428|height=232] 

You can quickly navigate to test reports.

[img_assist|nid=807|title=|desc=|link=none|align=none|width=640|height=274]

And view the reports on-line

[img_assist|nid=824|title=|desc=|link=none|align=middle|width=418|height=122] 

The generated war file of your Grails application can be downloaded with a single click

[img_assist|nid=825|title=|desc=|link=none|align=none|width=394|height=251] 

Cobertura code-coverage reports can be generated

[img_assist|nid=809|title=|desc=|link=none|align=none|width=640|height=341]

And viewed on-line

[img_assist|nid=826|title=|desc=|link=none|align=none|width=640|height=359]

Canoo webtest report online

How to jump-start your build process.

I assume you are familiar with Grails and TeamCity already.
TeamCity uses a powerfull concept of build agent grid, when the server distributes builds to any available build agent in the network, which is compatible with the build requirements. As Grails applications rely on Groovy and Grails installations, you need to install Groovy and Grails on at least one agent so that the agent can build your applications.
Grails projects themselves need to be configured in TeamCity just like any other projects. The only two steps that deserve our attention in this document are choosing a runner and setting agent requirements.

Runner

For a quick start I recommend using the command line runner to invoke grails commands directly as this is the easiest way to build Grails applications. The Ant runner is a little bit more demanding on configuration, but gives you many more options in exchange, so I'll cover it in a dedicated post.
Now back to the command-line runner. You specify "grails.bat" on Windows or "grails" on unixs in the Command executable field. In the Command parameters field you need to specify the grails command to invoke and and in the Artifact paths you set the path to files that your command is supposed to generate and you want to gain access to. This works well for war file generation, but for test reports it is not very convenient to have to download multiple report files. We will resolve this issue with later when configuring the Ant runner.

[img_assist|nid=827|title=|desc=|link=none|align=none|width=640|height=260] 

Configure ant runner to build the app and run tests

[img_assist|nid=808|title=|desc=|link=none|align=none|width=640|height=246]

Configure ant runner to generate a war file.

Agent requirements

To enable running Grails app builds only on Grails-compatible agents the following environment variables must be required to be set on the agent for all configurations:
GRAILS_HOME:exists
GROOVY_HOME:exists
Path:contains grails

[img_assist|nid=828|title=|desc=|link=none|align=none|width=640|height=303]

Set the required agent environment properties

Limitations

Certainly there are limitations compared to Java projects. For example, the test or webtest reports are not integrated into TeamCity and you have to retrieve them manually as project artifacts. Code coverage is also not supported for the command line runner. In the next article I'll cover the Ant runner, which will help us easily overcome these issues. 

Grail (web browser) Continuous Integration/Deployment TeamCity app

Opinions expressed by DZone contributors are their own.

Related

  • Delivering Your Code to the Cloud With JFrog Artifactory and GitHub Actions
  • Automated CI/CD of Multiple Projects Using TeamCity’s Kotlin DSL
  • Main Features and Benefits of Google Kubernetes Engine
  • Automating Developer Workflows and Deployments on Heroku and Salesforce

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends: