1

We have a small java based server (a simple app which fetches data using MySQL and hibernate) which needs to run standalone (e.g. java -cp <....> com.foo.Server).

Currently we use mvn for the entire build process and use mvn exec:java (http://mojo.codehaus.org/exec-maven-plugin/java-mojo.html) to run the application using maven.

We would like to package this application with its set of jar dependencies so that I can just use the command given above to run it on a production box (which will not have maven).

Database information present under META-INF\persistence.xml

<property name="hibernate.connection.url" value="jdbc:mysql://192.168.1.1:3306/foo/>
<property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/>
<property name="hibernate.connection.username" value="u1"/>
<property name="hibernate.connection.password" value="u1pass"/>
  1. How should I package this application or create a deployment image which I can deploy it on a production box.
  2. How do I pass database credentials to this application in the production box. Currently the information is contained within the access jars (under META-INF\persistence.xml).
priya
  • 24,861
  • 26
  • 62
  • 81

2 Answers2

2

A couple options to consider:

Community
  • 1
  • 1
ryanbrainard
  • 5,918
  • 35
  • 41
  • I am fine with the assembler option to package the dependencies for [1]. Any pointers to solving [2] – priya Oct 20 '11 at 05:21
  • Setting them in environment variables or a local properties file that is read by the app are common options for storing credentials or info that is specific the the server. – ryanbrainard Oct 20 '11 at 05:50
0

There are various software to package the java application in market for example Installshield etc. You can also export you application as runnable jar file. I think all latest IDE support packaging the java application. Let me know which IDE you are using and I will try to answer your question specifically.

Mike
  • 1,889
  • 5
  • 26
  • 32
  • We are not using any IDE at the moment, just relying on mvn for the entire build lifecycle. – priya Oct 20 '11 at 05:01