Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Main {
- public static void main(String[] args) {
- String currentDir = null;
- try {
- currentDir = new File(".").getCanonicalPath();
- LOG.info("Current application directory: " + currentDir);
- } catch (IOException e) {
- e.printStackTrace();
- }
- String war = currentDir + "\target\app.war";
- String tomeeConf = currentDir + "\src\main\tomee\conf\tomee.xml";
- // ARGUMENTS
- String[] setup = { "--path", war, "--tomeexml", tomeeConf };
- try {
- // PROGRAM:
- org.apache.tomee.embedded.Main.main(setup);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
- <?xml version="1.0" encoding="UTF-8"?>
- <tomee>
- <!-- Connection details specified in src/main/resource/persistence.xml -->
- <Resource id="APP-DATA" type="javax.sql.DataSource">
- IgnoreDefaultValues true
- JdbcDriver com.mysql.jdbc.Driver
- JdbcUrl jdbc:mysql://localhost:3306/scc-data
- UserName admin
- Password pass
- JtaManaged true
- </Resource>
- </tomee>
- <project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
- http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <groupId>rfpeake</groupId>
- <artifactId>theapp-parent</artifactId>
- <version>0.0.1-SNAPSHOT</version>
- <packaging>pom</packaging>
- <name>theapp</name>
- <description>Database project</description>
- <modules>
- <module>../theapp-app</module>
- </modules>
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <tomee.version>7.0.3</tomee.version>
- <tomee.classifier>webprofile</tomee.classifier>
- <mysql-connector-version>5.1.40</mysql-connector-version>
- <hibernate.version>5.2.9.Final</hibernate.version>
- <primefaces.version>6.1</primefaces.version>
- </properties>
- <dependencies>
- <!-- TOMEE EMBEDDED -->
- <dependency>
- <groupId>org.apache.tomee</groupId>
- <artifactId>tomee-embedded</artifactId>
- <version>${tomee.version}</version>
- </dependency>
- <!-- Declaration for JSF 2.2 with Tomee 7 -->
- <dependency>
- <groupId>javax</groupId>
- <artifactId>javaee-web-api</artifactId>
- <version>7.0</version>
- <scope>provided</scope>
- </dependency>
- <!-- JPA spec [required] -->
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-jpa_2.0_spec</artifactId>
- <version>1.1</version>
- <scope>provided</scope>
- </dependency>
- <!-- Hibernate -->
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-core</artifactId>
- <version>${hibernate.version}</version>
- <scope>provided</scope>
- </dependency>
- <!-- Hibernate EHCache -->
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-ehcache</artifactId>
- <version>${hibernate.version}</version>
- </dependency>
- <!-- Primefaces -->
- <dependency>
- <groupId>org.primefaces</groupId>
- <artifactId>primefaces</artifactId>
- <version>${primefaces.version}</version>
- <!-- JUnit -->
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>3.8.1</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
- </project>
- <project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
- http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>rfpeake</groupId>
- <artifactId>theapp-parent</artifactId>
- <version>0.0.1-SNAPSHOT</version>
- <relativePath>../theapp-parent/pom.xml</relativePath>
- </parent>
- <artifactId>theapp-app</artifactId>
- <packaging>war</packaging>
- <name>Database Application</name>
- <build>
- <finalName>theapp</finalName>
- <!-- pluginManagement tag required in Eclipse to avoid error:
- Plugin execution not covered by lifecycle configuration. -->
- <pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.apache.tomee.maven</groupId>
- <artifactId>tomee-embedded-maven-plugin</artifactId>
- <version>${tomee.version}</version>
- <configuration>
- <tomeeVersion>${tomee.version}</tomeeVersion>
- <tomeeClassifier>
- ${tomee.classifier}</tomeeClassifier>
- <synchronization>
- <extensions>
- <!-- To update each time app built
- with mvn compile -->
- <extension>.class</extension>
- <extension>.properties</extension>
- <extension>.css</extension>
- </extensions>
- <updateInterval>2</updateInterval>
- </synchronization>
- <!-- For some reason, must to be false
- or reloading does not work! -->
- <reloadOnUpdate>false</reloadOnUpdate>
- <warFile>
- ${project.build.directory}/${project.build.finalName}
- </warFile>
- <!-- path tused by tomEE in the tomee:deploy and
- tomee:undeploy goals -->
- <path>
- ${project.build.directory}/apache- tomee/webapps${project.build.finalName}
- </path>
- <args>
- -Djava.awt.headless=true -Dfile.encoding=UTF-8 -server
- -Xms128m -Xmx4096m -XX:PermSize=196m -XX:MaxPermSize=128m
- -XX:+DisableExplicitGC</args>
- <libs>
- <lib>
- mysql:mysql-connector-java:${mysql-connector-version}
- </lib>
- </libs>
- </configuration>
- <dependencies>
- <dependency>
- <groupId>org.apache.tomee</groupId>
- <artifactId>apache-tomee</artifactId>
- <version>${tomee.version}</version>
- <classifier>${tomee.classifier}</classifier>
- <type>zip</type>
- <!-- set this to runtime for it to work -->
- <scope>runtime</scope>
- </dependency>
- </dependencies>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>2.3.2</version>
- <configuration>
- <source>1.7</source>
- <target>1.7</target>
- <showDeprecation>true</showDeprecation>
- </configuration>
- </plugin>
- </plugins>
- </pluginManagement>
- </build>
- </project>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement