%define debug_package %{nil}
Name:                nailgun
Version:             1.0.1
Release:             1
Summary:             Framework for running Java from the cli without the JVM startup overhead
License:             ASL 2.0
URL:                 http://martiansoftware.com/nailgun/
Source0:             https://github.com/martylamb/nailgun/archive/%{name}-all-%{version}.zip
Source1:	     xmvn-reactor
BuildRequires:       maven-local mvn(org.sonatype.oss:oss-parent:pom:) maven

%description
Nailgun is a client, protocol, and server for running Java programs from the
command line without incurring the JVM startup overhead. Programs run in the
server (which is implemented in Java), and are triggered by the client
(written in C), which handles all I/O.

%package javadoc
Summary:             Javadocs for %{name}
BuildArch:           noarch

%description javadoc
This package contains the API documentation for %{name}.

%prep
%setup -q -n %{name}-%{name}-all-%{version}
find ./ -name '*.jar' -exec rm -f '{}' \;
find ./ -name '*.class' -exec rm -f '{}' \;
#%pom_remove_plugin :maven-javadoc-plugin
%pom_remove_plugin :maven-source-plugin
cp %{SOURCE1} ./.xmvn-reactor

nailgun_prefix=`pwd|awk -F"BUILD" '{print $1"BUILD"}'`
sed -i 's#nailgun_prefix#'"$nailgun_prefix"'#g' ./.xmvn-reactor

%build
mvn package

%install
%mvn_install

mkdir -p %{buildroot}/%{_datadir}/javadoc/%{name} 
install -p nailgun-server/target/nailgun-server-1.0.1-javadoc.jar %{buildroot}/%{_datadir}/javadoc/%{name}
install -p nailgun-examples/target/nailgun-examples-1.0.1-javadoc.jar %{buildroot}/%{_datadir}/javadoc/%{name}


%files -f .mfiles
%doc README.md

%files javadoc
%{_datadir}/javadoc/%{name}/*

%changelog
* Fri Aug 25 2023 chenchen <chen_aka_jan@163.com> - 1.0.1-1
- Upgrade to version 1.0.1

* Sat Jul 25 2020 leiju <leiju4@huawei.com> - 0.9.1-1
- Package init
