Sample Project which shows how to build a modular project with JPA persistence from dependency jar files.
Switch branches/tags
Nothing to show
Clone or download
Latest commit 7f2bd6c Jun 27, 2012
Failed to load latest commit information.
.settings initial Jun 27, 2012
de.slackspace.tutorials.entity initial Jun 27, 2012
de.slackspace.tutorials.web initial Jun 27, 2012
.project initial Jun 27, 2012 fixed typo Jun 27, 2012
pom.xml initial Jun 27, 2012

JPA Persistence in a modular maven application

Setup & Build project - IMPORTANT

To let the project run without errors, build and install the whole project as a first step. Type the following on the command line:

mvn clean compile install

Now locate your maven repository, under windows the path is mostly in your home directory. Mine is under C:\Users\cternes\.m2\repository. If you located your maven repository, try to find the recently installed jar version of the JPA persistence entity project. Mine is under C:\Users\cternes\.m2\repository\de\slackspace\tutorials\modular-jpa-persistence-entity\0.0.1-SNAPSHOT. Now open the pom.xml in the folder de.slackspace.tutorials.web. Search for the first occurence of entities.jar.location element and change the absolute file path to your jar file of the JPA persistence entity project in your maven repository. Mine looks like this:


NOTE: Please remind to change the backslashes to slashes!

Now you can run the project with jetty.

Run with standalone Jetty

To run the project with maven and Jetty simply navigate to the folder de.slackspace.tutorials.web and type the following on the command line:

mvn jetty:run

After the deployment you can access the project with your browser at http://localhost:8080/modular-jpa-persistence-web/

Run with another container

When running with another container than Jetty, you have to deploy the war-file manually. You can generate the war-file by navigating to the folder de.slackspace.tutorials.web typing on the command line:

mvn clean compile package -Denvironment=prod

Now you will find the war-file in the target directory of the project.