Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8097855
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T21:53:39+00:00 2026-06-05T21:53:39+00:00

How do I build an outside Gradle project from a Grails controller? Grails 2.0.0

  • 0

How do I build an outside Gradle project from a Grails controller? Grails 2.0.0

UPDATE:
I emailed Adam Murdoch (co-founder of gradle) about this question: http://forums.gradle.org/gradle/topics/how_can_i_use_the_gradle_tooling_api_from_a_grails_controller

While, I don’t have a direct answer to this question, I do have a solution.
Any further insights on this subject would be greatly appreciated.


I used a gradle build script provided by Luke Daley. Ran build.gradle, and it output 4 jar files needed for gradle tooling api. I then put these into my Grails lib folder.

I then wrote the following code into my grails controller called consoleController.groovy.

import org.gradle.tooling.BuildLauncher
import org.gradle.tooling.GradleConnector
import org.gradle.tooling.ProjectConnection

class consoleController {
   def run = {
       println "new run -------------------------------------"
       println "Building file..."

       String projectDir = "C:\\Documents and Settings\\Administrator\\Desktop\\demo"
       GradleConnector connector = GradleConnector.newConnector()
       connector.forProjectDirectory(new File(projectDir))

       ProjectConnection connection = connector.connect()
       try {
           BuildLauncher launcher = connection.newBuild()
           launcher.forTasks("hello")
           launcher.run()
       } finally {
           connection.close()
       }
    }
 }

I also created a directory called “demo” – with a build.gradle file.

task hello {
    println "hello world"
}

I get the following stack trace – errors:
PLEASE SEE – http://forums.gradle.org/gradle/topics/how_can_i_use_the_gradle_tooling_api_from_a_grails_controller

Stack trace is too long for StackOverflow.com.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T21:53:41+00:00Added an answer on June 5, 2026 at 9:53 pm

    You may visit the post entitled http://forums.gradle.org/gradle/topics/how_can_i_use_the_gradle_tooling_api_from_a_grails_controller
    which provides directions for setting-up a minimal grails project for embedding the grails tooling API, and allows a user to trigger builds from a grails controller.

    Grails 2.0.0 should fully support the Gradle tooling API out of the box, but Spring Loaded a technology that enables hot-reloading of classes gets in the way of the gradle tooling API, and throws an error:
    java.lang.ClassNotFoundException: com.springsource.loaded.ri.ReflectiveInterceptor
    – when trying to build.

    Running the grails app with the -noreloading flag, solves the problem.

    > grails -noreloading run-app

    An alternative to Grails embedding, that would still allow builds to be triggered from a Grails controller would be to use a Continuous Integration server that supports REST, such as Jenkins (TeamCity, Bamboo, CruiseControl, etc.); while, this is not a direct solution to this question, these enterprise applications provide an alternative to Gradle embedding and are probably better suited for enterprise offerings.

    Cheers, TFM

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I build a project in C#. From another project I have 5 DLLs. Is
I am using Flash Build Image control to load the image from outside using
I'm looking to build + run my iphone xcode project totally outside of xcode.
I build a website, that: reads data from a website by HttpWebRequest Sort all
This build warning just started showing up. I'm building for 3.1.3. Not sure what
The build of the project is succesfull, but when I go the the url
I need to build an application outside of my normal comfort zone (web/PHP/JavaScript). Should
How is the order of the doFirst method determined in a gradle build script?
I build an OSX app which is distributed as a DMG outside of the
we have a settings.xml on a build server that restricts access to outside repositories

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.