recipe: simple conversion

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
Name:           XXX
Version:        XXX
Release:        1%{?dist}
Summary:        XXX
License:        XXX
Group:          Development/Libraries
URL:            XXX
Source0:        XXX
BuildArch:      noarch

BuildRequires:  java-devel # see java-devel in notable differences
BuildRequires:  jpackage-utils # see jpackage-utils in notable differences
BuildRequires:  maven # see brmaven in notable differences
BuildRequires:  XXX

Requires:       jpackage-utils # see jpackage-utils in notable differences
Requires:       XXX # see autoreq in notable differences

%description
XXX

%package javadoc
Summary:        API documentation for %{name}
Group:          Documentation
Requires:       jpackage-utils

%description javadoc
This package provides %{summary}.

%prep
%setup -q

%build
mvn-rpmbuild verify javadoc:aggregate # see mvn_build in notable differences

%install
install -d -m 755 %{buildroot}%{_javadir}
install -p -m 644 target/%{name}-%{version}.jar %{buildroot}%{_javadir}/%{name}.jar

install -d -m 755 %{buildroot}%{_mavenpomdir}
install -p -m 644 pom.xml %{buildroot}%{_mavenpomdir}/JPP-%{name}.pom
%add_maven_depmap JPP-%{name}.pom %{name}.jar

install -d -m 755 %{buildroot}%{_javadocdir}/%{name}
cp -pr target/site/apidocs/* %{buildroot}%{_javadocdir}/%{name}

%files
%doc README
%doc LICENSE NOTICE
%{_javadir}/%{name}.jar
%{_mavenpomdir}/JPP-%{name}.pom
%{_mavendepmapfragdir}/%{name}

%files javadoc
%doc LICENSE NOTICE
%{_javadocdir}/%{name}

%changelog
* Wed Jan 23 2013 Mr Packager <root@localhost> - XXX-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
Name:           XXX
Version:        XXX
Release:        1%{?dist}
Summary:        XXX
License:        XXX
Group:          Development/Libraries
URL:            XXX
Source0:        XXX
BuildArch:      noarch

BuildRequires:  maven-local
BuildRequires:  XXX

%description
XXX

%package javadoc
Summary:        API documentation for %{name}
Group:          Documentation

%description javadoc
This package provides %{summary}.

%prep
%setup -q

%build
%mvn_build # see mvn_build in notable differences

%install
%mvn_install

%files -f .mfiles
%doc README
%doc LICENSE NOTICE
%dir %{_javadir}/%{name}

%files javadoc -f .mfiles-javadoc
%doc LICENSE NOTICE

%changelog
* Wed Jan 23 2013 Mr Packager <root@localhost> - XXX-1
- Initial packaging

Notable differences


References

{references}