Name:          jdom2
Version:       2.0.6
Release:       13
Summary:       Classes representing the components of an XML document
License:       Saxpath
URL:           http://www.jdom.org/
BuildArch:     noarch
Source0:       https://github.com/hunterhacker/jdom/archive/JDOM-2.0.6.tar.gz
Source1:       jdom-contrib-template.pom
Source2:       jdom-junit-template.pom
Source3:       bnd.properties
Patch0001:     0001-Adapt-build.patch
BuildRequires: javapackages-local ant ant-junit isorelax jaxen xalan-j2 xerces-j2 xml-commons-apis log4j12 aqute-bnd

%description
JDOM is an in-memory representation of an XML document. XML consists of
elements (which have attributes), text data, 'entity' references, processing
instructions, and comments. XML documents can also have a DocType declaration,
Comments, and Processing Instructions before the root element.

%package          help
Summary:          This package contains help documents
Requires:         %{name} = %{version}-%{release}
Provides:         jdom2-javadoc = %{version}-%{release}
Obsoletes:        jdom2-javadoc < %{version}-%{release}

%description      help
Files for help with jdom2.

%prep
%autosetup -n jdom-JDOM-%{version} -p1
#find -name 'lib' -exec rm -rf {} \;
rm -rf ./contrib/lib ./lib
find -name '*.jar' -delete
find -name '*.class' -delete
install -D %{SOURCE1} maven/contrib.pom
install -D %{SOURCE2} maven/junit.pom
sed -i.coverage "s|coverage, jars|jars|" build.xml
install -d lib
build-jar-repository lib xerces-j2 xml-commons-apis jaxen junit isorelax xalan-j2 xalan-j2-serializer

%build
ant -Dversion=%{version} -Dj2se.apidoc=%{_javadocdir}/java maven
bnd wrap --output build/package/jdom-%{version}.bar --properties %{SOURCE3} --version %{version} build/package/jdom-%{version}.jar
mv build/package/jdom-%{version}.bar build/package/jdom-%{version}.jar

%install
%mvn_artifact build/maven/core/%{name}-%{version}.pom build/package/jdom-%{version}.jar
%mvn_artifact build/maven/core/%{name}-%{version}-contrib.pom build/package/jdom-%{version}-contrib.jar
%mvn_artifact build/maven/core/%{name}-%{version}-junit.pom build/package/jdom-%{version}-junit.jar
%mvn_install -J build/apidocs

%files -f .mfiles
%doc LICENSE.txt

%files help -f .mfiles-javadoc
%doc CHANGES.txt COMMITTERS.txt README.txt TODO.txt

%changelog
* Thu Dec 12 2019 gulining<gulining1@huawei.com> - 2.0.6-13
- Pakcage init
