User:A faerber/Maven packaging
https://build.opensuse.org/project/show/Java:maven is hosting a new set of Maven packages (formerly at https://build.opensuse.org/project/show/home:a_faerber:hadoop).
maven-macros
A new package maven-macros has been created by me to facilitate packaging.
Careful: It conflicts with older versions of javapackages-tools, such as in Leap 42.2.
mavenrepodir
%{mavenrepodir} specifies the base path of the local Maven repository.
Install or symlink .pom and .jar files to %{buildroot}%{mavenrepodir}/groupId/artifactId-version.ext.
The directory is currently owned by maven-macros.
maven_artifact_version
%{maven_artifact_version groupId:artifactId} returns the version of an installed dependency.
General advice
Use full URLs whenever possible. That allows OBS to verify the files match the original ones. If a file is, e.g., a GitHub tarball, its filename will not match the URL, so use the #/ trick.
If URLs use version macros cleverly, the next contributor can update the version field(s) and run
osc service localrun download_files
for updating to a newer version.
Legacy packages
Maven and related packages rely on some non-mvn-built .jars that likely already are in https://build.opensuse.org/project/show/Java:packages.
If you come across such a dependency that already exists, make sure it installs .pom and .jar files to the new location %{mavenrepodir} and has a BuildRequires for maven-macros.
Maven based packages
To allow for RPM macros and automatic Provides and Requires, use:
BuildRequires: maven-macros
How to build without mvn:
- Is there an Ant build.xml file as alternative to Maven pom.xml?
- Is it trivial enough to duplicate build instructions into %build manually?
- Package official .jar in -bootstrap package
Bootstrap packages
If your package foo is part of maven's bootstrap cycle, consider adding a foo-bootstrap.spec file to it. In that case try to put everything into foo.spec and derive foo-bootstrap.spec via a pre_checkin.sh script so that only one .spec file needs to be maintained. A side-effect will be that you cannot use %{name} for URLs or directories as it would break for foo-bootstrap.
Always put the sources into your package, even when you only need the -bootstrap package at first.