arguments

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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
Name:           plexus-io
Version:        2.0.5
Release:        3%{?dist}
Summary:        Plexus IO Components

Group:          Development/Libraries
License:        ASL 2.0
URL:            http://plexus.codehaus.org/plexus-components/plexus-io
Source0:        https://github.com/sonatype/plexus-io/tarball/plexus-io-%{version}#/%{name}-%{version}.tar.gz
BuildArch: noarch

BuildRequires: java-devel >= 1:1.6.0
BuildRequires: jpackage-utils

BuildRequires: plexus-utils
BuildRequires: plexus-containers-container-default
BuildRequires: plexus-components-pom
BuildRequires: maven
BuildRequires: maven-compiler-plugin
BuildRequires: maven-enforcer-plugin
BuildRequires: maven-jar-plugin
BuildRequires: maven-install-plugin
BuildRequires: maven-javadoc-plugin
BuildRequires: maven-resources-plugin
BuildRequires: maven-surefire-plugin
BuildRequires: maven-surefire-provider-junit
BuildRequires: maven-doxia-sitetools
BuildRequires: mvn(org.apache.maven.plugins:maven-enforcer-plugin)
Requires:  jpackage-utils
Requires:  plexus-utils
Requires:  plexus-containers-container-default

%description
Plexus IO is a set of plexus components, which are designed for use
in I/O operations.

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

%description javadoc
API documentation for %{name}.

%prep
%setup -q -n sonatype-plexus-io-1a0010b

%build
mvn-rpmbuild -Dproject.build.sourceEncoding=ISO-8859-1 \ # see passing arguments to the maven in notable differences
             install javadoc:aggregate # see passing arguments to the maven in notable differences

%install
# jars
install -d -m 0755 %{buildroot}%{_javadir}/plexus
install -m 644 target/%{name}-%{version}.jar   %{buildroot}%{_javadir}/plexus/io.jar

# poms
install -d -m 755 %{buildroot}%{_mavenpomdir}
install -pm 644 pom.xml \
    %{buildroot}%{_mavenpomdir}/JPP.%{name}.pom

%add_maven_depmap JPP.%{name}.pom plexus/io.jar

# javadoc
install -d -m 0755 %{buildroot}%{_javadocdir}/%{name}
cp -pr target/site/api*/* %{buildroot}%{_javadocdir}/%{name}/

%files -f .mfiles
%doc NOTICE.txt

%files javadoc
%{_javadocdir}/%{name}

%changelog
* Thu Nov 22 2012 Jaromir Capik <jcapik@redhat.com> - 2.0.5-3
- Migration to plexus-containers-container-default

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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
Name:           plexus-io
Version:        2.0.5
Release:        4%{?dist}
Summary:        Plexus IO Components

Group:          Development/Libraries
License:        ASL 2.0
URL:            http://plexus.codehaus.org/plexus-components/plexus-io
Source0:        https://github.com/sonatype/plexus-io/tarball/plexus-io-%{version}#/%{name}-%{version}.tar.gz
BuildArch: noarch

BuildRequires: java-devel >= 1:1.6.0
BuildRequires: jpackage-utils

BuildRequires: plexus-utils
BuildRequires: plexus-containers-container-default
BuildRequires: plexus-components-pom
BuildRequires: xmvn
BuildRequires: maven-compiler-plugin
BuildRequires: maven-enforcer-plugin
BuildRequires: maven-jar-plugin
BuildRequires: maven-install-plugin
BuildRequires: maven-javadoc-plugin
BuildRequires: maven-resources-plugin
BuildRequires: maven-surefire-plugin
BuildRequires: maven-surefire-provider-junit
BuildRequires: maven-doxia-sitetools
BuildRequires: mvn(org.apache.maven.plugins:maven-enforcer-plugin)

%description
Plexus IO is a set of plexus components, which are designed for use
in I/O operations.

%package javadoc
Group:          Documentation
Summary:        Javadoc for %{name}

%description javadoc
API documentation for %{name}.

%prep
%setup -q -n sonatype-plexus-io-1a0010b

%build
%mvn_file  : plexus/io
%mvn_build -- -Dproject.build.sourceEncoding=ISO-8859-1 # see passing arguments to the maven in notable differences

%install
%mvn_install

%files -f .mfiles
%doc NOTICE.txt

%files javadoc -f .mfiles-javadoc

%changelog
* Thu Jan 17 2013 Michal Srb <msrb@redhat.com> - 2.0.5-4
- Build with xmvn

Comparison of manual and automatic requires

Manual requires

plexus-io-javadoc requires:

plexus-io requires:

Automatic requires

plexus-io-javadoc requires:

plexus-io requires:

Notable spec file differences