I would prefer the tomee.xml
configuration to declare resources while using the TomEE Maven Plugin.
You can define your datasource in the TomEE Maven Plugin (similar to conf/tomee.xml
in a standalone deployment) as follows:
<?xml version="1.0" encoding="UTF-8"?>
<tomee>
<Resource id="myDS" type="javax.sql.DataSource">
JtaManaged = true
driverClassName = ${jdbc.driver}
url = ${jdbc.url}
username = ${jdbc.user}
password = ${jdbc.pw}
</Resource>
</tomee>
and reference the folder containing the tomee.xml
via <config>
in the TomEE Maven Plugin <configuration>
section.
Alternative would be to use a resources.xml
in WEB-INF
of your web application:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<Resource id="myDS" type="javax.sql.DataSource">
JtaManaged = true
driverClassName = ${jdbc.driver}
url = ${jdbc.url}
username = ${jdbc.user}
password = ${jdbc.pw}
</Resource>
</resources>