Preloader image

TomEE provides a gradle plugin for tomee-embedded "à la Jetty".

buildscript {
   repositories {
       mavenCentral()
   }

   dependencies {
       classpath 'org.apache.tomee.gradle:tomee-embedded:7.0.0'
   }
}

apply plugin: 'org.apache.tomee.tomee-embedded'

// ...

Then just start tomee with:

gradle tomee-embedded -i

Configuration

All the configuration is optional.

// plugin setup
def tomeeEmbedded = extensions.getByName('tomee-embedded')
tomeeEmbedded.tomeeVersion = 'other version'
tomeeEmbedded.skipDefaultRepository  = true // don't use central to retrieve tomee

// container dependencies
def tomeeEmbeddedDeps = configurations.getByName('tomee-embedded')
// add dependencies you need to this configuration

tomee-embedded task has several more advanced configuration like tomee properties, modules to deploy etc…​ Its configuration is pretty close to Embedded Maven Plugin.