Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create a Debian package for my Java Web Application?

Kunagi is a simple Java Web application for which we are already creating a binary .deb package for our users. This package depends on tomcat6 and just puts the .war file into /var/lib/tomcat6/webapps. This works great on Debian and Ubuntu.

Now I want to create a real source package which can be integrated to Debian. Sadly I can not find any tutorial. There is a lot of fractioned information about tools like CDBS, DH7 or javahelper and their commands. But which one should I use?

I also have some conceptual questions:

  1. Usualy, web applications are installed by copying the webapp into the webapps directory of the web container. Would it then be right to make my package dependent on tomcat6 and install my webapp directly into /var/lib/tomcat6/webapps? Or should my webapp be installed somewhere else, providing a separate Tomcat configuration and run with its own user, like other services do?

  2. My webapp uses libraries (JARs) from other projects. Usualy these are placed in the WEB-INF/lib subdirectory of the webapp directory. Since including libraries in a package is not allowed in Debian, would it be right to add these projects as dependencies into my package and create symlinks in my WEB-INF/lib directory? Or how would I solve this problem?

  3. My webapp needs to write files (application data). Since Tomcat is running as user www-data on Debian, the only directory where my webapp can write is /var/lib/tomcat6/webapps. Is it the right place to put my data? Or should my package create something like /var/lib/my-webapp-name/ and grant write permissions for user www-data?

like image 284
Witek Avatar asked Mar 20 '12 16:03

Witek


1 Answers

Well... If you have to create Debian package than there is a great jdeb library which works for both ant and maven. The best feature is that it does not require any dpkg wrappers so your build will not be os-dependent.

like image 124
vsminkov Avatar answered Nov 15 '22 19:11

vsminkov