How to create gradle application using existing grails app in STS?

(Rushi Vyas) #1

How to create a gradle aap using grails application in STS specially?

(Peter Niederwieser) #2

I don’t understand the question. Can you explain in more detail?

(Rushi Vyas) #3

I have created one simple grails application. Now I want to create a WAR file of the grails app using some script in Gradle.

All this is done in STS so, I think I am not able to create a gradle correctly that would include complete grails application. I tried to follow a online help on the following link, But what i can see in my gradle application is only “view” pages and no controller/domain groovy classes.


(Peter Niederwieser) #4

Are you saying that you have written a Gradle build for your Grails project? If all you need is a War, why not just do “grails war”?

(Rushi Vyas) #5

I have created a grails application. I wanted that my gradle application should import it and the i will run a gradle script that will convert this grails application (contained inside my gradle) into WAR file that i can deploy on an independent server.

(Peter Niederwieser) #6

What do you mean by gradle application? As I said, if all you need is a War for your Grails app, then you don’t need a Gradle build. Also, a Gradle build will have to be written by yourself, even though the Grails Gradle Plugin should help a lot.

(Rushi Vyas) #7

I am building a grails app from gradle’s build.gradle file [ I am referring the steps from ]

Later on my aim is to create a war file of this grails app from the same build file. Now what I feel is that when i use the script "apply plugin: ‘war’ " it is not able to create a war file, since this script tries to pick the code from the location /src/groovy or /src/java. and since my code is at none of this place it is at the location /grails-app I am not able to generate the war file.

Or is my approach incorrect, then suggest me a nice one

Could you help me on this, Please

(Peter Niederwieser) #8

As I said, your best chance to use Gradle with Grails is to use the Grails Gradle plugin (see link above). In any case, you’ll likely get better Eclipse support when you import as a Grails project rather than as a Gradle project.

(Rushi Vyas) #9

Thank you very much…

for this help.