This is a recipe for conversion of current mvn-rpmbuild spec file into xmvn style spec file.
In this recipe we'll show how to convert Maven projects using following keywords:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | Name: test-artifact Version: 0.1 Release: 1%{?dist} Summary: Test artifact License: Public Domain Group: Development/Libraries URL: http://mizdebsk.fedorapeople.org/xmvn Source0: %{name}-%{version}.tar.xz BuildArch: noarch BuildRequires: java-devel >= 1:1.7 BuildRequires: jpackage-utils # see jpackage-utils BuildRequires in notable differences BuildRequires: maven # see maven BuildRequires in notable differences BuildRequires: apache-commons-lang Requires: java >= 1:1.7 # see auto-requires in notable differences Requires: jpackage-utils # see auto-requires in notable differences Requires: apache-commons-lang # see auto-requires in notable differences Requires: objectweb-asm # see auto-requires in notable differences %description This is an example package. %package javadoc Summary: API documentation for %{name} Group: Documentation Requires: jpackage-utils # see javadoc subpackage Requires in notable differences %description javadoc This package provides %{summary}. %prep %setup -q %build mvn-rpmbuild verify javadoc:aggregate # see build section changes in notable differences %install install -d -m 755 %{buildroot}%{_javadir}/%{name} # see install section changes in notable differences install -p -m 644 target/test1-%{version}.jar %{buildroot}%{_javadir}/%{name}/test1.jar # see install section changes in notable differences install -d -m 755 %{buildroot}%{_mavenpomdir} # see install section changes in notable differences install -p -m 644 pom.xml %{buildroot}%{_mavenpomdir}/JPP.%{name}-test1.pom # see install section changes in notable differences %add_maven_depmap JPP.%{name}-test1.pom %{name}/test1.jar # see install section changes in notable differences install -d -m 755 %{buildroot}%{_javadocdir}/%{name} # see install section changes in notable differences cp -pr target/site/apidocs/* %{buildroot}%{_javadocdir}/%{name} # see install section changes in notable differences %files # see files section changes in notable differences %doc README # see files section changes in notable differences %doc LICENSE NOTICE # see files section changes in notable differences %{_javadir}/%{name} # see files section changes in notable differences %{_mavenpomdir}/JPP.%{name}-test1.pom # see files section changes in notable differences %{_mavendepmapfragdir}/%{name} # see files section changes in notable differences %files javadoc # see files section changes in notable differences %doc LICENSE NOTICE # see files section changes in notable differences %{_javadocdir}/%{name} # see files section changes in notable differences %changelog * Wed Jan 23 2013 Mr Packager <root@localhost> - 0.1-1 - Initial packaging |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | Name: test-artifact Version: 0.1 Release: 1%{?dist} Summary: Test artifact License: Public Domain Group: Development/Libraries URL: http://mizdebsk.fedorapeople.org/xmvn Source0: %{name}-%{version}.tar.xz BuildArch: noarch BuildRequires: java-devel >= 1:1.7 BuildRequires: maven-local # see maven BuildRequires in notable differences BuildRequires: apache-commons-lang %description This is an example package. %package javadoc Summary: API documentation for %{name} Group: Documentation %description javadoc This package provides %{summary}. %prep %setup -q %build %mvn_build # see build section changes in notable differences %install %mvn_install # see install section changes in notable differences %files -f .mfiles # see files section changes in notable differences %doc README # see files section changes in notable differences %doc LICENSE NOTICE # see files section changes in notable differences %dir %{_javadir}/%{name} # see files section changes in notable differences %files javadoc -f .mfiles-javadoc # see files section changes in notable differences %doc LICENSE NOTICE # see files section changes in notable differences %changelog * Wed Jan 23 2013 Mr Packager <root@localhost> - 0.1-1 - Initial packaging |
test-artifact requires:
test-artifact-javadoc requires:
test-artifact requires:
test-artifact-javadoc requires:
maven-local
packages don't need to build-require
jpackage-utils
any longer; maven-local
package takes
responsibility of requiring jpackage-utils
.xmvn
package.%build
section of typical
packages just constsis of a call to %mvn_build
macro, possibly with
some arguments. To see summary of accepted arguments, see mvn-build
--help
.%install
section was reduced to a one line: %mvn_install
macro call with no
arguments. If your package needs to install additional things besides
Maven artifacts (such as documentation, scripts in /usr/bin
etc.)
then you can put additional install commands before or after
%mvn_install
macro call.maven-local
instead of maven
. See the
announcement on
java-devel.%files
sections you don't
need to specify files which were automatically installed by
%mvn_install
macro. Lists of these files are available in .mfiles*
files created in builddir. You can use these file lists as arguments
to -f
option of %files
. Any additional files, such as
documentation, still need to be listed explicitly.jpackage-utils
. This
require will be auto-generated during package build.