java -jar my-app-in-tomee.jar

Starting Tomcat, TomEE or OpenEJB is quite simple, basically a single script to run….but a script. Sometimes in production you can’t use bash or something else and these scripts can be broken in the shell you have access to.

Another point can be the normalisation in the enterprise of runners: all java apps should be runnable with java -jar app.jar.

Well globally sometimes you need a jar to run TomEE. If you read my previous posts you know there are few solutions but nothing very simple.

That’s why TomEE Maven Plugin now supports an exec goal.

The exec goal has a simple trick: if you don’t specify script configuration it will use, if you specify java it will handle startup using plain java.

Once this trick understood you can simply add tomee-mave-plugin in your pom as usual and then call exec goal:

mvn tomee:exec

This will create an executable jar :).

What is behind the hood?

Basically nothing fancy. Maven TomEE Plugin can create a tomee ready to run and zip it. Exec goal simply reuses this zip, put it in a jar and when you run java -jar command, it unpacks the zip locally to run the extracted tomee.

Last note: this goal will be part of TomEE 1.6.1 release.

Have fun with TomEE!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s