I am trying to package a Java application that is built with Maven.
I created the debian/ folder with mh_make and I have been reading/watching the tutorials:
- https://wiki.debian.org/Java/Packaging/Maven
- https://wiki.debian.org/Java/MavenRepoHelper
- https://wiki.debian.org/Java/Packaging
- https://www.youtube.com/watch?v=p767bS_8C_o
- And more which I am forgetting now
The project structure is as follows:
- parent POM
- my_app submodule
- my_app_lib submodule (used exclusively by my_app)
- shared_lib submodule (used by my_app but may also be needed by other apps)
I am trying to create two deb packages, which will:
- Install my_app and its lib in
/usr/share/my-app(package 1) - Install the shared lib in
/usr/share/java(package 2)
I am at the point where I have created part of package 1:
- Installed my app's main jar in
/usr/share/my-app/my-app.jarand its dependency lib jar/usr/share/my-app/lib/my-lib.jar(viamy-app.install) - Created a launch script
/usr/share/my-app/bin/my-appand symlinked it to/usr/bin(viamy-app.installandmy-app.links)
In the POM I also set the main class and instructed Maven to add a classpath in the jar's manifest.
My questions:
- How do I force the
mh_*scripts to not install themy_appormy_app_libartifacts and POMs in the/usr/share/maven-repoor/usr/share/javadirs? My poms file for reference:
# The setup below does not work - my_app and my_app_lib are installed in /usr/share/maven-repo
pom.xml --ignore-pom
my_app/pom.xml --has-package-version --ignore-pom --no-usj-versionless --dest-jar=/usr/share/my_app/my_app.jar
my_app_lib/pom.xml --has-package-version --ignore-pom
lshared_lib/pom.xml --ignore
- How do I set the
lib/prefix to the classpath generated by Maven? I have currently solved this by adding a<classpathPrefix>lib/</classpathPrefix>in the POM but I would prefer to set it as part of the packaging process as it is a Debian-specific change. - How do I link the shared lib to my app? Currently, I am thinking:
Install it as usual with another
<package>.pomsAdd dependency on the lib binary package to the my-app binary package
Add a symlink between
/usr/share/my-app/lib/shared-lib.jarand/usr/share/java/shared-lib.jarinmy-app.linksWould that work? Can I build a second binary package from the same source package? Is this the correct way of doing this?