Name:          unit-api
Version:       2.2
Release:       1
Summary:       JSR 363 - Units of Measurement API
License:       BSD
URL:           http://unitsofmeasurement.github.io/
Source0:       https://github.com/unitsofmeasurement/unit-api/archive/%{version}/unit-api-%{version}.tar.gz

BuildRequires: maven-local mvn(junit:junit) mvn(org.apache.felix:maven-bundle-plugin) mvn(org.sonatype.oss:oss-parent:pom:)
BuildRequires: mvn(tech.uom:uom-parent:pom:) mvn(org.apache.maven.plugins:maven-install-plugin) mvn(org.apache.maven.plugins:maven-antrun-plugin)
BuildRequires: mvn(org.junit.jupiter:junit-jupiter-api) mvn(javax.inject:javax.inject) mvn(org.apache.maven.surefire:surefire-junit-platform)
BuildRequires: java-11-openjdk-devel 
Requires:      java-11-openjdk	
BuildArch:     noarch

%description
The Unit of Measurement API provides a set of java language progranmming interfaces for handling units
and quantities.The interfaces provides a layer which separates client code,that would call the API,
from library code, which implements the API.

%package       help
Summary:       Javadoc for unit-api
Provides:      unit-api-javadoc = %{version}-%{release}
Obsoletes:     unit-api-javadoc < %{version}-%{release}

%description   help
This package contains javadoc for unit-api.

%prep
%autosetup -n unit-api-%{version} -p1
find . -name "*.class" -print -delete
find . -name "*.jar" -print -delete

sed -i 's/jakarta.inject/javax.inject/' src/test/java/javax/measure/spi/ServiceProviderTest.java
%pom_remove_plugin :coveralls-maven-plugin
%pom_remove_plugin :formatter-maven-plugin
%pom_remove_plugin :jacoco-maven-plugin
%pom_remove_plugin :license-maven-plugin
%pom_remove_plugin :maven-javadoc-plugin
%pom_remove_plugin :maven-pmd-plugin
%pom_remove_plugin :maven-site-plugin
%pom_remove_plugin :maven-source-plugin
%pom_remove_dep :jakarta.inject-api
%pom_add_dep javax.inject:javax.inject

%pom_remove_plugin :maven-jar-plugin
%pom_add_plugin org.apache.maven.plugins:maven-jar-plugin:'${maven.jar.version}' . "
<executions>
   <execution>
      <goals>
         <goal>test-jar</goal>
      </goals>
   </execution>
</executions>"

%mvn_file  : unit-api
%mvn_file :unit-api:tests: unit-api-tests
%mvn_package :unit-api:tests: unit-api

%build
java11_version=`rpm -qa | grep java-11-openjdk-11`
export JAVA_HOME=/usr/lib/jvm/$java11_version
%mvn_build

%install
%mvn_install

%files -f .mfiles
%license LICENSE

%files help -f .mfiles-javadoc
%doc README.md

%changelog
* Fri Aug 25 2023 wangkai <13474090681@163.com> - 2.2-1
- Update to 2.2

* Wed Apr 15 2020 zhangtao <zhangtao221@huawei.com> - 1.0-6
- Package init
