diff --git a/maven.spec b/maven.spec
index f81f36d..674cdf3 100644
--- a/maven.spec
+++ b/maven.spec
@@ -1,6 +1,6 @@
Name: maven
Version: 3.3.9
-Release: 4%{?dist}
+Release: 5%{?dist}
Summary: Java project management and project comprehension tool
License: ASL 2.0
URL: http://maven.apache.org/
@@ -13,10 +13,6 @@ Source200: %{name}-script
Patch0: 0001-Force-SLF4J-SimpleLogger-re-initialization.patch
-# If XMvn is part of the same RPM transaction then it should be
-# installed first to avoid triggering rhbz#1014355.
-OrderWithRequires: xmvn
-
BuildRequires: maven-local
BuildRequires: aether-api >= 1:0
@@ -76,6 +72,8 @@ BuildRequires: mvn(ch.qos.logback:logback-classic)
BuildRequires: mvn(org.mockito:mockito-core)
BuildRequires: mvn(org.codehaus.modello:modello-maven-plugin)
+Requires: %{name}-lib = %{version}-%{release}
+
# Theoretically Maven might be usable with just JRE, but typical Maven
# workflow requires full JDK, so we recommend it here.
Recommends: java-devel
@@ -130,6 +128,16 @@ Maven is a software project management and comprehension tool. Based on the
concept of a project object model (POM), Maven can manage a project's build,
reporting and documentation from a central piece of information.
+%package lib
+Summary: Core part of Maven
+Group: Documentation
+# If XMvn is part of the same RPM transaction then it should be
+# installed first to avoid triggering rhbz#1014355.
+OrderWithRequires: xmvn-minimal
+
+%description lib
+Core part of Apache Maven that can be used as a library.
+
%package javadoc
Summary: API documentation for %{name}
Group: Documentation
@@ -165,6 +173,8 @@ sed -i -e s:'-classpath "${M2_HOME}"/boot/plexus-classworlds-\*.jar':'-classpath
# its scope to provided
%pom_xpath_inject "pom:dependency[pom:artifactId='logback-classic']" "provided" maven-embedder
+%mvn_package :apache-maven __noinstall
+
%build
# Put all JARs in standard location, but create symlinks in Maven lib
@@ -195,10 +205,12 @@ install -d -m 755 %{buildroot}%{_sysconfdir}/%{name}
install -d -m 755 %{buildroot}%{_datadir}/bash-completion/completions
install -d -m 755 %{buildroot}%{_mandir}/man1
-for cmd in mvn mvnDebug mvnyjp; do
+for cmd in mvnDebug mvnyjp; do
sed s/@@CMD@@/$cmd/ %{SOURCE200} >%{buildroot}%{_bindir}/$cmd
echo ".so man1/mvn.1" >%{buildroot}%{_mandir}/man1/$cmd.1
done
+sed s/@@CMD@@/mvn/ %{SOURCE200} >%{buildroot}%{_datadir}/%{name}/bin/mvn-script
+ln -sf %{_datadir}/%{name}/bin/mvn-script %{buildroot}%{_bindir}/mvn
install -p -m 644 %{SOURCE2} %{buildroot}%{_mandir}/man1
install -p -m 644 %{SOURCE1} %{buildroot}%{_datadir}/bash-completion/completions/mvn
mv $M2_HOME/bin/m2.conf %{buildroot}%{_sysconfdir}
@@ -254,16 +266,19 @@ ln -sf $(build-classpath plexus/classworlds) \
)
-%files -f .mfiles
+%files lib -f .mfiles
%doc LICENSE NOTICE README.md
%{_datadir}/%{name}
-%attr(0755,root,root) %{_bindir}/mvn*
+%attr(0755,root,root) %{_datadir}/%{name}/bin/mvn-script
%dir %{_javadir}/%{name}
%dir %{_sysconfdir}/%{name}
%dir %{_sysconfdir}/%{name}/logging
%config(noreplace) %{_sysconfdir}/m2.conf
%config(noreplace) %{_sysconfdir}/%{name}/settings.xml
%config(noreplace) %{_sysconfdir}/%{name}/logging/simplelogger.properties
+
+%files
+%attr(0755,root,root) %{_bindir}/mvn*
%{_datadir}/bash-completion/completions/mvn
%{_mandir}/man1/mvn*.1.gz
@@ -272,6 +287,9 @@ ln -sf $(build-classpath plexus/classworlds) \
%changelog
+* Tue Jun 28 2016 Mikolaj Izdebski - 3.3.9-5
+- Add maven-lib subpackage
+
* Thu Apr 7 2016 Mikolaj Izdebski - 3.3.9-4
- Force SLF4J SimpleLogger re-initialization
- Resolves: rhbz#1324832