I am trying to build a debian package against Debian stretch. The debian/rules
file is this:
#!/usr/bin/make -f
%:
dh $@
override_dh_auto_build:
mvn clean package
When I build it using pbuilder-buildpackage
I get this build error:
mvn -e clean package
[INFO] Error stacktraces are turned on.
[ERROR] Could not create local repository at /nonexistent/.m2/repository -> [Help 1]
How do I resolve this error?
Best Answer
Debian packages can’t rely on a home directory during builds. This is enforced in
pbuilder
with the/nonexistent
home.To fix this, you need to supply the appropriate options to Maven so that it places its repository in
/tmp
. But really, instead of doing that, you should build-depend onmaven-debian-helper
and letdh
work its magic. Look at the Java packages in Debian for examples.