generic

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:

Original spec file content

 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

New xmvn spec file

 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

Comparison of manual and automatic requires

Manual requires

test-artifact requires:

test-artifact-javadoc requires:

Automatic requires

test-artifact requires:

test-artifact-javadoc requires:

Notable spec file differences