Name:                jakarta-mail
Version:             1.6.7
Release:             1
Summary:             Jakarta Mail API
License:             EPL-2.0 or GPLv2 with exceptions
URL:                 https://github.com/eclipse-ee4j/mail
BuildArch:           noarch
Source0:             https://github.com/eclipse-ee4j/mail/archive/%{version}/mail-%{version}.tar.gz
BuildRequires:       maven-local java-11-openjdk-devel mvn(com.sun.activation:jakarta.activation)
BuildRequires:       mvn(junit:junit) mvn(org.apache.felix:maven-bundle-plugin)
BuildRequires:       mvn(org.apache.maven.plugins:maven-dependency-plugin)
BuildRequires:       mvn(org.apache.maven.plugins:maven-source-plugin)
BuildRequires:       mvn(org.codehaus.mojo:build-helper-maven-plugin)
Obsoletes:           javamail-javadoc < 1.5.2-16
%description
The Jakarta Mail API provides a platform-independent and
protocol-independent framework to build mail and messaging applications.

%prep
%setup -q -n mail-%{version}
%pom_remove_parent
%pom_remove_plugin :maven-enforcer-plugin
%pom_remove_plugin :osgiversion-maven-plugin
%pom_remove_plugin :directory-maven-plugin
%pom_disable_module android
%pom_xpath_remove "pom:project/pom:profiles"
find -name pom.xml -exec sed -i "s/\${mail\.osgiversion}/%{version}/g" {} +
sed -i "/-Werror/d" mail/pom.xml
%mvn_alias com.sun.mail:mailapi \
    javax.mail:mailapi
%mvn_alias com.sun.mail:jakarta.mail \
    com.sun.mail:javax.mail \
    javax.mail:mail \
    org.eclipse.jetty.orbit:javax.mail.glassfish
%mvn_alias jakarta.mail:jakarta.mail-api \
    javax.mail:javax.mail-api
%mvn_file com.sun.mail:jakarta.mail \
    %{name}/jakarta.mail \
    javamail/mail \
    javamail/javax.mail \
    javax.mail/javax.mail

%build
export LC_ALL=en_US.UTF-8
java11_version=`rpm -qa | grep java-11-openjdk-11`
export JAVA_HOME=/usr/lib/jvm/$java11_version
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
%mvn_build -j -f -- -Dmain.basedir=${PWD}

%install
%mvn_install

%files -f .mfiles
%license LICENSE.md NOTICE.md
%doc README.md

%changelog
* Mon Jun 6 2022 liyanan <liyanan32@huawei.com> - 1.6.7-1
- package init
