HumayunM
HumayunM

Reputation: 554

Groovy Grails standalone application without tomcat or any other servlet container

I am new in groovy/grails and want to make a Standalone App utilising just Grails i.e. an Executable Jar without a Servlet Container.

It is possible in spring with @SpringBootApplication and SpringApplication.run() and adding this to maven pom.xml

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
    <exclusions>
        <exclusion>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
        </exclusion>
    </exclusions>
</dependency>

Is it possible to do it in Grails alone without using springBoot?
if yes, how?
if no, why not?

Upvotes: 1

Views: 405

Answers (2)

injecteer
injecteer

Reputation: 20699

As mentioned Grails is not meant to run outside a JEE container normally.

On the other hand you can theoretically create a Fat Jar packaged with embedded tomcat/jetty and run it as a standalone jar. It might work, but I didn't test it.

If you want to go hack-free way, you can pick Micnonaut as the closest Grails alternative, which is running on netty and thus doesn't need container.

Another option would be to use Ratpack which is also Groovy flavored and netty-based.

I had some good experience recently with a mix of standalone GORM and Vert.x (I had some specific requirements for async)

Upvotes: 1

Adeel Ansari
Adeel Ansari

Reputation: 39887

Checkout the Grails tag,

Grails is an Open Source, full stack, web application framework that ...

If it's not web then, it doesn't make much sense to go with Grails. I suppose, you're interested in a CLI application. I would suggest Micronaut, instead; particularly, refer to the section, Standalone Command Line Applications.

Helpful resources:

Upvotes: 2

Related Questions