Name:		apache-ivy
Version:	2.4.0
Release:	17
Summary:	Java-based dependency manager
License:	ASL 2.0
URL:		https://ant.apache.org/ivy/
Source0:	http://mirrors.tuna.tsinghua.edu.cn/apache//ant/ivy/%{version}/%{name}-%{version}-src.tar.gz

Patch0:         0001-Update-bouncycastle-to-1.52.patch
Patch1:         apache-ivy-global-settings.patch
BuildArch:      noarch
BuildRequires:	ant ant-contrib ant-testutil apache-commons-lang jakarta-commons-httpclient jsch 
BuildRequires:  jakarta-oro apache-commons-parent sonatype-oss-parent apache-parent ivy-local >= 4
BuildRequires:  jsch-agent-proxy-jsch jsch-agent-proxy-core jsch-agent-proxy-connector-factory
BuildRequires:  apache-commons-vfs bouncycastle bouncycastle-pg

Provides:       %{name}-javadoc = %{version}-%{release}
Obsoletes:      %{name}-javadoc < %{version}-%{release}

%description
Apache Ivy is a popular dependency manager focusing on flexibility and simplicity.

%package_help

%prep
%autosetup -n %{name}-%{version} -p1

sed -i 's:/etc/ivy/:%{_sysconfdir}/ivy/:' src/java/org/apache/ivy/ant/IvyAntSettings.java

%mvn_alias : jayasoft:ivy
%mvn_file : %{name}/ivy ivy

sed -i s/ant-trax/ant/ ivy.xml
sed -i /bouncycastle/s/jdk14/jdk16/ ivy.xml
sed -i "s/commons.vfs/&2/" src/java/org/apache/ivy/plugins/repository/vfs/*
sed -i /ivy:publish/s/local/xmvn/ build.xml

%build
%ant -Divy.mode=local -Dtarget.ivy.bundle.version=%{version} -Dtarget.ivy.bundle.version.qualifier= -Dtarget.ivy.version=%{version} jar javadoc publish-local

%install
%mvn_install -J build/doc/reports/api

mkdir -p %{buildroot}%{_sysconfdir}/ant.d
echo "apache-ivy/ivy" > %{buildroot}%{_sysconfdir}/ant.d/%{name}

%files
%defattr(-,root,root)
%license LICENSE
%{_sysconfdir}/ant.d/apache-ivy
%{_datadir}/java/*
%{_datadir}/ivy-xmls
%{_datadir}/javadoc/*
%{_datadir}/maven-poms/*
%{_datadir}/maven-metadata/*

%files          help
%defattr(-,root,root)
%doc README NOTICE

%changelog
* Tue Apr 7 2020 yanglijin <yanglijin@huawei.com> - 2.4.0-17
- fix build failed

* Thu Jan 16 2020 Jiangping Hu <hujp1985@foxmail.com> - 2.4.0-16
- Package init
