Default location of Jenkins war

I was looking at the recent Jenkins issues and saw JENKINS-68149, which states:

WAR file was moved from /usr/lib/jenkins/jenkins.war to /usr/share/java/jenkins.war

( or /usr/share/jenkins/jenkins.war if looking at the change).

The following is a question to understand historic context and decision process for the change. Was this related to the systemd changes or something else? Is there differing guidance for docker images vs package installation (into standard VM; ie: sudo yum install jenkins?

I’ve always been perplexed why the default location for jenkins.war was /usr/lib/jenkins and /var/lib/jenkins for $JENKINS_HOME, since the jenkins binary is not really a libary. Equally perplexed why it’s now /usr/share/jenkins/jenkins.war.

I’m only moderately familiar with the Linux Filesystem Hierarchy Standard or if it’s even applicable. I’m honestly not sure there’s any standard (though I’m sure there is one that’s happily ignored by java devs) as to how the FHS is extended for java apps. For example, is “java” considered the program and the binary (jenkins.war) is data?

The FHS says:
The /usr Hierarchy - 4.1. Purpose
/usr is the second major section of the filesystem. /usr is shareable, read-only data. … Any information that is host-specific or varies with time is stored elsewhere.
4.6. /usr/lib : Libraries for programming and packages
4.11. /usr/share : Architecture-independent data
The /usr/share hierarchy is for all read-only architecture independent data files

It would be my interpretation of the FHS to have seen the binary installed in /opt/jenkins/and the “data” ($JENKINS_HOME) in /var/opt/jenkins, with configuration in /etc/opt/jenkins or /etc/systemd/system/jenkins.

3.13. /opt : Add-on application software packages
5.12. /var/opt : Variable data for /opt
3.7.4. /etc/opt : Configuration files for /opt

This would be consistent with the implementation of:
PARAMS="--logfile=/var/log/jenkins/jenkins.log --webroot=/var/cache/jenkins/war"

In any case, anything inside /usr seems like an unusual choice. Any explanations?

The change was made as part of the systemd transition.

The Debian Java packaging page says

Packages install their JARs in /usr/share/java

RPM distributions provide the /usr/share/java directory in the javapackages-filesystem package.

Previously, the package was installed in /usr/share/jenkins/jenkins.war. That was a non-standard directory in the standard directory hierarchy. The systemd packaging transition was a good opportunity to place the archive in the same directory that contains other Java archives and to follow the instructions from the operating system providers about the location where packages should install their jar files.

We could call Jenkins an optional application and place it in /opt, but that’s not a very common behavior for Linux packages installed with the package manager.