Le Mer 9 mars 2011 15:44, Stanislav Ochotnicky a écrit :
I've been asked to package apache-solr [1] in Fedora. This is a java library and webapp posing as a frontend to lucene for searching.
Packaging java jars is not a problem, but there are more problems with webapp part. I made it into subpackage apache-solr-webapp. Ant build creates war file (basically a zip with metadata and dependencies bundled). I expand this war file and replace dependencies with symlinks to %{_javadir}. I then place content of this directory inside /usr/share/java/webapps/apache-solr/. This makes it possible to use webapp in container (tomcat/jetty) while enabling us to update dependencies independently.
This is nothing new and actually why jpackage-utils contains a build-jar-directory command that populates a directory with symlinks (and a rebuild-jar-directory that refreshes them if necessary)
/usr/share/java/webapps/ is likely to conflict with this command logic BTW. /usr/share/java/ was supposed to contain only jars on jpackaged systems originally.
I was thinking about adding default configuration for tomcat inside yet another subpackage. But this would be just one simple xml file inside /etc/tomcat6/Catalina/localhost/. Plus solr needs additional configuration:
- creating of SOLR_HOME directory and placing it somewhere, presumably
/var/lib/solr). I have example solr home dir in %doc, but it is generic and configuration is not really usable in that state for anything other than serve as a commented example.
All in all seems like too much of a hassle for little gain.
It's not little gain. If you find it too complex to do manually, the usual solution is to write rpm macros or shell helpers to help deploy this kind of webapp.