|
$ rpm -qp --provides simplemaven-1.0-1.fc21.noarch.rpm mvn(com.example:simplemaven) = 1.0 simplemaven = 1.0-1.fc21
|
|
$ rpm -qp --provides simplemaven-1.0-2.fc21.noarch.rpm mvn(com.example:simplemaven) = 1.0 mvn(simplemaven:simplemaven) = 1.0 simplemaven = 1.0-2.fc21
|
|
10: BuildRequires: maven-local
|
|
31: %dir %{_javadir}/%{name}
|
|
Add alias to Maven artifact
|
|
# Add following lines to %prep section of a spec file %pom_remove_dep :commons-io %pom_remove_dep :junit
|
|
All Maven projects need to have BuildRequires on `maven-local`. They also need to have Requires and BuildRequires on `jpackages-utils`, but build system adds these automatically. Package maintainer doesn't need to list them explicitly.
|
|
Another interesting lines:
|
|
Another major reason to disable the test phase is to speed up the local build process. This can also be achieved by specifying an additional switch `--without=tests` to the `fedpkg` or the `mock` tool instead of adding a switch to `%mvn_build`.
|
|
Another quite common thing to do is adding aliases to Maven artifact. Try to run `rpm -qp --provides` on your locally built RPM package:
|
|
Another switch `--without=javadoc` causes the build to skip Javadoc generation.
|
|
BuildRequires: maven-local BuildRequires: apache-commons-io ... %prep %setup -q
|
|
%build # Skip tests for now, missing dependency junit:junit:4.11 %mvn_build -f
|
|
By default, resulting JAR files will be installed in `%{_javadir}/%{name}`, therefore package needs to own this directory.
|
|
# Comment out following lines in %prep section #%%pom_remove_dep :commons-io #%%pom_remove_dep :junit
|
|
include::example$maven_project/simplemaven.spec[]
|
|
It is always recommended to run all available test suites during build. It greatly improves quality of the package.
|
|
%mvn_alias org.example:simplemaven simplemaven:simplemaven
|
|
%mvn_file : %{name}/%{name} %{name}
|
|
Note that to actually build the package with tests disabled you have to specify the switch to `%mvn_build`.
|