Run Embedded TomEE 7.1.5 with Gradle

91 views Asked by At

how I can get the deployment into an embedded TomEE?

I used the CalculatorWs example and ported it to Gradle:

buildscript {

    repositories {
        mavenCentral()
    }

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

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

sourceCompatibility = 1.8

repositories {
    mavenLocal()
    mavenCentral()
}

dependencies {
    providedCompile 'org.apache.tomee:javaee-api:7.0-2'

    testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.0'
    testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.9.0'
    testImplementation 'org.assertj:assertj-core:3.23.1'
    testImplementation 'org.apache.tomee:openejb-cxf:7.1.4'
}

test {
    useJUnitPlatform()
}

But now I wonder. The CalculatorTest works fine with the javax.ejb.embeddable.EJBContainer. I want to deploy the created war into the embedded Tomee?

enter image description here

How can I tell gradle to deploy the war into the classpath of the embedded Tomee which starts greate with gradle tomee-embedded -i?

Thanks, Markus

1

There are 1 answers

0
Romain Manni-Bucau On

did you try configuring tomeeembedded section with classpathAsWar=true or other options? By default it just starts an empty tomee. Options are linked (maven as reference) on https://tomee.apache.org/latest/docs/developer/tools/gradle-plugins.html.

The side note is that the gradle plugin is no more compatible with last gradle versions (which changed its plugin API) so you can also just 1. add tomee-embedded in your buildscript dependencies and 2. write a custom task starting the container (new Container(new Configuration())) to replace the plugin.