#
# spec file for package jetty
#
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2000-2007, JPackage Project
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%global base_name jetty
%global addver .v20190610
Name: %{base_name}-minimal
Version: 9.4.19
Release: 0
Summary: Java Webserver and Servlet Container
License: Apache-2.0 OR EPL-1.0
URL: https://www.eclipse.org/jetty/
Source0: https://github.com/eclipse/%{base_name}.project/archive/%{base_name}-%{version}%{addver}.tar.gz
Patch0: jetty-annotations-asm6.patch
BuildRequires: fdupes
BuildRequires: maven-local
BuildRequires: mvn(javax.servlet:javax.servlet-api)
BuildRequires: mvn(org.apache.felix:maven-bundle-plugin)
BuildRequires: mvn(org.apache.maven.plugins:maven-shade-plugin)
BuildRequires: mvn(org.codehaus.mojo:build-helper-maven-plugin)
BuildRequires: mvn(javax.transaction:javax.transaction-api)
BuildRequires: mvn(javax.annotation:javax.annotation-api)
BuildRequires: mvn(org.slf4j:slf4j-api)
BuildRequires: mvn(org.ow2.asm:asm)
BuildRequires: mvn(org.ow2.asm:asm-commons)
BuildRequires: mvn(org.apache.tomcat:tomcat-jasper)
BuildRequires: mvn(org.apache.tomcat:tomcat-util-scan)
BuildRequires: mvn(org.eclipse.jetty.toolchain:jetty-schemas)
BuildArch: noarch
%description
%global desc \
Jetty is a 100% Java HTTP Server and Servlet Container. This means that you\
do not need to configure and run a separate web server (like Apache) in order\
to use Java, servlets and JSPs to generate dynamic content. Jetty is a fully\
featured web server for static and dynamic content. Unlike separate\
server/container solutions, this means that your web server and web\
application run in the same process, without interconnection overheads\
and complications. Furthermore, as a pure java component, Jetty can be simply\
included in your application for demonstration, distribution or deployment.\
Jetty is available on all Java supported platforms.
%global extdesc %{desc}\
\
This package contains
%{desc}
%package -n %{base_name}-annotations
Summary: annotations module for Jetty
License: Apache-2.0 OR EPL-1.0
%description -n %{base_name}-annotations
%{extdesc} %{summary}.
%package -n %{base_name}-client
Summary: client module for Jetty
License: Apache-2.0 OR EPL-1.0
%description -n %{base_name}-client
%{extdesc} %{summary}.
%package -n %{base_name}-continuation
Summary: continuation module for Jetty
License: Apache-2.0 OR EPL-1.0
%description -n %{base_name}-continuation
%{extdesc} %{summary}.
%package -n %{base_name}-http
Summary: http module for Jetty
License: Apache-2.0 OR EPL-1.0
%description -n %{base_name}-http
%{extdesc} %{summary}.
%package -n %{base_name}-http-spi
Summary: http-spi module for Jetty
License: Apache-2.0 OR EPL-1.0
%description -n %{base_name}-http-spi
%{extdesc} %{summary}.
%package -n %{base_name}-io
Summary: io module for Jetty
License: Apache-2.0 OR EPL-1.0
%description -n %{base_name}-io
%{extdesc} %{summary}.
%package -n %{base_name}-jaas
Summary: jaas module for Jetty
License: Apache-2.0 OR EPL-1.0
%description -n %{base_name}-jaas
%{extdesc} %{summary}.
%package -n %{base_name}-jndi
Summary: jndi module for Jetty
License: Apache-2.0 OR EPL-1.0
%description -n %{base_name}-jndi
%{extdesc} %{summary}.
%package -n %{base_name}-jsp
Summary: jsp module for Jetty
License: Apache-2.0 OR EPL-1.0
Requires: glassfish-el
%description -n %{base_name}-jsp
%{extdesc} %{summary}.
%package -n %{base_name}-security
Summary: security module for Jetty
License: Apache-2.0 OR EPL-1.0
%description -n %{base_name}-security
%{extdesc} %{summary}.
%package -n %{base_name}-server
Summary: server module for Jetty
License: Apache-2.0 OR EPL-1.0
%description -n %{base_name}-server
%{extdesc} %{summary}.
%package -n %{base_name}-servlet
Summary: servlet module for Jetty
License: Apache-2.0 OR EPL-1.0
%description -n %{base_name}-servlet
%{extdesc} %{summary}.
%package -n %{base_name}-util
Summary: util module for Jetty
License: Apache-2.0 OR EPL-1.0
%description -n %{base_name}-util
%{extdesc} %{summary}.
%package -n %{base_name}-webapp
Summary: webapp module for Jetty
License: Apache-2.0 OR EPL-1.0
%description -n %{base_name}-webapp
%{extdesc} %{summary}.
%package -n %{base_name}-jmx
Summary: jmx module for Jetty
License: Apache-2.0 OR EPL-1.0
%description -n %{base_name}-jmx
%{extdesc} %{summary}.
%package -n %{base_name}-xml
Summary: xml module for Jetty
License: Apache-2.0 OR EPL-1.0
%description -n %{base_name}-xml
%{extdesc} %{summary}.
%package -n %{base_name}-plus
Summary: plus module for Jetty
License: Apache-2.0 OR EPL-1.0
%description -n %{base_name}-plus
%{extdesc} %{summary}.
%package -n %{base_name}-proxy
Summary: proxy module for Jetty
License: Apache-2.0 OR EPL-1.0
%description -n %{base_name}-proxy
%{extdesc} %{summary}.
%package javadoc
Summary: Javadoc for %{name}
License: Apache-2.0 OR EPL-1.0
%description javadoc
%{summary}.
%prep
%setup -q -n %{base_name}.project-%{base_name}-%{version}%{addver}
%patch0 -p1
find . -name "*.?ar" -exec rm {} \;
find . -name "*.class" -exec rm {} \;
# Plugins irrelevant or harmful to building the package
%pom_remove_plugin -r :findbugs-maven-plugin
%pom_remove_plugin -r :maven-enforcer-plugin
%pom_remove_plugin -r :clirr-maven-plugin
%pom_remove_plugin -r :maven-eclipse-plugin
%pom_remove_plugin -r :maven-pmd-plugin
%pom_remove_plugin -r :license-maven-plugin
%pom_remove_plugin -r :maven-site-plugin
%pom_remove_plugin -r :maven-source-plugin
%pom_remove_plugin -r :maven-deploy-plugin
%pom_remove_plugin -r :jacoco-maven-plugin
%pom_remove_plugin -r :maven-release-plugin
%pom_remove_plugin -r :buildnumber-maven-plugin
%pom_remove_plugin -r :h2spec-maven-plugin
# Unnecessary pom flattening can be skipped
%pom_remove_plugin -r :flatten-maven-plugin jetty-bom
%pom_disable_module aggregates/jetty-all
# Use proper groupId for apache ant
%pom_xpath_replace "pom:groupId[text()='ant']" "org.apache.ant" jetty-ant/pom.xml
%pom_remove_dep "com.sun.net.httpserver:http" jetty-http-spi
%pom_change_dep -r org.mortbay.jasper:apache-jsp org.apache.tomcat:tomcat-jasper
%pom_add_dep 'org.junit.jupiter:junit-jupiter-engine:${junit.version}' tests/test-sessions/test-sessions-common
# Old version of jetty not available for tests, so use this version
%pom_change_dep 'org.eclipse.jetty:jetty-util' 'org.eclipse.jetty:jetty-util:${project.version}' tests/test-webapps/test-servlet-spec/test-spec-webapp
# provided by glassfish-jsp-api that has newer version
%pom_change_dep -r javax.servlet.jsp:jsp-api javax.servlet.jsp:javax.servlet.jsp-api
# txt artifact - not installable
%pom_remove_plugin ":jetty-version-maven-plugin"
%pom_xpath_remove "pom:artifactItem[pom:classifier='version']" jetty-home
# Disable building source release
%pom_xpath_remove 'pom:execution[pom:id="sources"]' jetty-home
# Unwanted JS in javadoc
sed -i '/^\s*\*.*