Inspired by the Jetty Maven Plugin, the TomEE Maven Plugin is a feature-rich plugin that allows for:
Simply add the following to your pom.xml
<plugin>
<groupId>org.apache.openejb.maven</groupId>
<artifactId>tomee-maven-plugin</artifactId>
<version>1.0.0</version>
<configuration>
<tomeeVersion>1.5.0</tomeeVersion>
<tomeeClassifier>plus</tomeeClassifier>
</configuration>
</plugin>
The available commands can be discovered running:
mvn tomee:help
Should print output like the following:
[INFO] Available commands:
[INFO] - tomee:run: run and wait for the server
[INFO] - tomee:debug: run in debug mode and wait for the server (alias of run)
[INFO] - tomee:start: run the server
[INFO] - tomee:stop: stop the server (to use with start)
[INFO] - tomee:configtest: run configtest tomcat command
[INFO] - tomee:deploy <path>: deploy path archive
[INFO] - tomee:undeploy <path>: undeploy path archive. Note it should be the same path than the one used in deploy command
[INFO] - tomee:list: list ejbs deployed
[INFO] - tomee:build: build tomee but does not start it
[INFO] - tomee:help: this
Available configuration elements:
Name | Type | Since | Description |
---|---|---|---|
finalName | String | - | (no description) Default value is: ${project.build.finalName}. User property is: tomee-plugin.finalName. |
Name | Type | Since | Description |
---|---|---|---|
apacheRepos | String | - | (no description) Default value is: snapshots. User property is: tomee-plugin.apache-repos. |
appDir | String | - | relative to tomee.base. Default value is: apps. |
apps | List | - | (no description) |
args | String | - | (no description) User property is: tomee-plugin.args. |
bin | File | - | (no description) Default value is: ${project.basedir}/src/main/tomee/bin. User property is: tomee-plugin.bin. |
catalinaBase | File | - | (no description) Default value is: ${project.build.directory}/apache-tomee. |
config | File | - | (no description) Default value is: ${project.basedir}/src/main/tomee/conf. User property is: tomee-plugin.conf. |
debug | boolean | - | (no description) Default value is: false. User property is: tomee-plugin.debug. |
debugPort | int | - | (no description) Default value is: 5005. User property is: tomee-plugin.debugPort. |
deployOpenEjbApplication | boolean | - | (no description) Default value is: false. User property is: tomee-plugin.deploy-openejb-internal-application. |
keepServerXmlAsthis | boolean | - | (no description) Default value is: false. User property is: tomee-plugin.keep-server-xml. |
lib | File | - | (no description) Default value is: ${project.basedir}/src/main/tomee/lib. User property is: tomee-plugin.lib. |
libDir | String | - | relative to tomee.base. Default value is: lib. |
libs | List | - | supported formats: --> groupId:artifactId:version... -->
unzip:groupId:artifactId:version... --> remove:prefix (often
prefix = artifactId) |
password | String | - | (no description) User property is: tomee-plugin.pwd. |
quickSession | boolean | - | (no description) Default value is: true. User property is: tomee-plugin.quick-session. |
realm | String | - | (no description) User property is: tomee-plugin.realm. |
reloadOnUpdate | boolean | - | (no description) Default value is: false. User property is: tomee-plugin.reload-on-update. |
removeDefaultWebapps | boolean | - | (no description) Default value is: true. User property is: tomee-plugin.remove-default-webapps. |
removeTomeeWebapp | boolean | - | (no description) Default value is: false. User property is: tomee-plugin.remove-tomee-webapps. |
skipCurrentProject | boolean | - | (no description) Default value is: false. User property is: tomee-plugin.skipCurrentProject. |
synchronization | Synchronization | - | (no description) |
systemVariables | Map | - | (no description) |
tomeeAjpPort | int | - | (no description) Default value is: 8009. User property is: tomee-plugin.ajp. |
tomeeArtifactId | String | - | (no description) Default value is: apache-tomee. User property is: tomee-plugin.artifactId. |
tomeeClassifier | String | - | (no description) Default value is: webprofile. User property is: tomee-plugin.classifier. |
tomeeGroupId | String | - | (no description) Default value is: org.apache.openejb. User property is: tomee-plugin.groupId. |
tomeeHost | String | - | (no description) Default value is: localhost. User property is: tomee-plugin.host. |
tomeeHttpPort | int | - | (no description) Default value is: 8080. User property is: tomee-plugin.http. |
tomeeHttpsPort | Integer | - | (no description) User property is: tomee-plugin.https. |
tomeeShutdownPort | int | - | (no description) Default value is: 8005. User property is: tomee-plugin.shutdown. |
tomeeVersion | String | - | (no description) Default value is: -1. User property is: tomee-plugin.version. |
user | String | - | (no description) User property is: tomee-plugin.user. |
warFile | File | - | (no description) Default value is: ${project.build.directory}/${project.build.finalName}.${project.packaging}. |
webappDir | String | - | relative to tomee.base. Default value is: webapps. |
webapps | List | - | (no description) |
The lib tag allows to enrich the container with some additional librairies.
It supports some interesting pattern to complete the default maven format.
Note: the name tweak can be used to rename applications too
This plugin is also usable in projects which are not war. For instance you can use it in a pom project to setup a TomEE install, add libraries, deploy apps then run the server.
<plugin>
<groupId>org.apache.openejb.maven</groupId>
<artifactId>tomee-maven-plugin</artifactId>
<version>1.0.0</version>
<configuration>
<tomeeVersion>1.5.0</tomeeVersion>
<tomeeClassifier>plus</tomeeClassifier>
<debug>false</debug>
<debugPort>5005</debugPort>
<args>-Dfoo=bar</args>
<config>${project.basedir}/src/test/tomee/conf</config>
<libs>
<lib>mysql:mysql-connector-java:5.1.20</lib>
</libs>
<webapps>
<webapp>org.superbiz:myapp:4.3?name=ROOT</webapp>
<webapp>org.superbiz:api:1.1</webapp>
</webapps>
<apps>
<app>org.superbiz:mybugapp:3.2:ear</app>
</apps>
<libs>
<lib>mysql:mysql-connector-java:5.1.21</lib>
<lib>unzip:org.superbiz:hibernate-bundle:4.1.0.Final:zip</lib>
<lib>remove:openjpa-</lib>
</libs>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.openejb.maven</groupId>
<artifactId>tomee-maven-plugin</artifactId>
<version>1.0.1</version>
<configuration>
<synchronization>
<extensions>
<extension>.class</extension> <!-- if you want to update each time you build with mvn compile -->
</extensions>
</synchronization>
<reloadOnUpdate>true</reloadOnUpdate>
</configuration>
</plugin>
Synchronization block supports the following configuration:
reloadOnUpdate means to reload the context (webapp). It means undeploying/redeploying it.