<?xml version="1.0" encoding="UTF-8"?>
<!--

    Copyright 2021 OPS4J.

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

	<modelVersion>4.0.0</modelVersion>

	<parent>
		<groupId>org.ops4j.pax</groupId>
		<artifactId>web</artifactId>
		<version>8.0.29</version>
		<relativePath>../pom.xml</relativePath>
	</parent>

	<groupId>org.ops4j.pax.web</groupId>
	<artifactId>pax-web-spi</artifactId>
	<packaging>bundle</packaging>

	<name>OPS4J Pax Web - Service SPI (internal)</name>

	<build>
		<plugins>
			<plugin>
				<artifactId>maven-dependency-plugin</artifactId>
				<executions>
					<execution>
						<id>unpack-tomcat</id>
						<phase>generate-resources</phase>
						<goals>
							<goal>unpack</goal>
						</goals>
						<configuration>
							<artifactItems>
								<artifactItem>
									<groupId>org.apache.tomcat</groupId>
									<artifactId>tomcat</artifactId>
									<type>zip</type>
								</artifactItem>
							</artifactItems>
							<outputDirectory>${project.build.directory}/unpack-deps/tomcat</outputDirectory>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<artifactId>maven-antrun-plugin</artifactId>
				<executions>
					<execution>
						<!--
							copy Tomcat's web.xml with huge list of MIME mappings
							This web.xml will not only be used by pax-web-tomcat when creating Tomcat contexts,
							but also by pax-web-extender-war to get a "default" web.xml
						-->
						<id>copy-selected-resources</id>
						<phase>process-resources</phase>
						<goals>
							<goal>run</goal>
						</goals>
						<configuration>
							<target>
								<copy file="${project.build.directory}/unpack-deps/tomcat/apache-tomcat-${dependency.org.apache.tomcat}/conf/web.xml" tofile="${project.build.outputDirectory}/org/ops4j/pax/web/service/spi/model/default-web.xml" />
							</target>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>org.apache.felix</groupId>
				<artifactId>maven-bundle-plugin</artifactId>
				<extensions>true</extensions>
				<configuration>
					<instructions>
						<Import-Package>
							<!-- ranges indicate Servlet API 3.1+ (JavaEE 7+) -->
							javax.servlet;version="[3.1,5)",
							javax.servlet.annotation;version="[3.1,5)",
							javax.servlet.descriptor;version="[3.1,5)",
							javax.servlet.http;version="[3.1,5)",

							javax.websocket;version="[1.1,2)";resolution:=optional,
							javax.websocket.server;version="[1.1,2)";resolution:=optional,

							<!-- ranges indicate we can work with OSGi Core R6+ -->
							org.osgi.dto;version="[1.0,2)",
							org.osgi.framework;version="[1.8,2)",
							org.osgi.framework.dto;version="[1.0,2)",
							org.osgi.framework.wiring;version="[1.2,2)",
							org.osgi.util.tracker;version="[1.5,2)",

							<!-- OSGi cmpn -->
							org.osgi.service.http;version="[1.2,2)",
							org.osgi.service.http.context;version="[1.1,2)",
							org.osgi.service.http.whiteboard;version="[1.1,2)",
							org.osgi.service.http.runtime;version="[1.1,2)",
							org.osgi.service.http.runtime.dto;version="[1.1,2)",

							<!-- from pax-web-api -->
							org.ops4j.pax.web.service;version="${pax-web.osgi.version}",
							org.ops4j.pax.web.service.views;version="${pax-web.osgi.version}",
							org.ops4j.pax.web.utils;version="${pax-web.osgi.version}",

							<!-- from pax-logging-api -->
							org.slf4j;version="[1.7,2)"
						</Import-Package>
						<Private-Package>
							<!-- supporting libraries -->
							org.apache.commons.io,
							org.apache.commons.collections4,
							org.apache.commons.collections4.iterators,
							org.apache.commons.collections4.map,
							org.apache.felix.utils.properties
						</Private-Package>
						<Export-Package>
							<!-- pax-web-spi -->
							org.ops4j.pax.web.service.spi;version="${pax-web.osgi.version}",
							org.ops4j.pax.web.service.spi.config;version="${pax-web.osgi.version}",
							org.ops4j.pax.web.service.spi.context;version="${pax-web.osgi.version}",
							org.ops4j.pax.web.service.spi.model;version="${pax-web.osgi.version}",
							org.ops4j.pax.web.service.spi.model.elements;version="${pax-web.osgi.version}",
							org.ops4j.pax.web.service.spi.model.events;version="${pax-web.osgi.version}",
							org.ops4j.pax.web.service.spi.model.info;version="${pax-web.osgi.version}",
							org.ops4j.pax.web.service.spi.model.views;version="${pax-web.osgi.version}",
							org.ops4j.pax.web.service.spi.servlet;version="${pax-web.osgi.version}",
							org.ops4j.pax.web.service.spi.servlet.dynamic;version="${pax-web.osgi.version}",
							org.ops4j.pax.web.service.spi.task;version="${pax-web.osgi.version}",
							org.ops4j.pax.web.service.spi.util;version="${pax-web.osgi.version}",
							org.ops4j.pax.web.service.spi.whiteboard;version="${pax-web.osgi.version}"
						</Export-Package>
					</instructions>
				</configuration>
			</plugin>
		</plugins>
	</build>

	<dependencies>

		<!-- pax-web own artifacts -->

		<dependency>
			<groupId>org.ops4j.pax.web</groupId>
			<artifactId>pax-web-api</artifactId>
		</dependency>

		<!-- OSGi -->

		<dependency>
			<groupId>org.osgi</groupId>
			<artifactId>osgi.core</artifactId>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>org.osgi</groupId>
			<artifactId>osgi.cmpn</artifactId>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>org.osgi</groupId>
			<artifactId>osgi.annotation</artifactId>
			<scope>provided</scope>
		</dependency>

		<dependency>
			<groupId>org.apache.felix</groupId>
			<artifactId>org.apache.felix.utils</artifactId>
		</dependency>

		<!-- JavaEE -->

		<dependency>
			<groupId>jakarta.servlet</groupId>
			<artifactId>jakarta.servlet-api</artifactId>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>jakarta.websocket</groupId>
			<artifactId>jakarta.websocket-api</artifactId>
			<scope>provided</scope>
			<optional>true</optional>
		</dependency>

		<!-- Logging -->

		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-api</artifactId>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>org.apache.logging.log4j</groupId>
			<artifactId>log4j-slf4j-impl</artifactId>
			<scope>test</scope>
		</dependency>

		<!-- Tomcat -->

		<dependency>
			<!-- This dependency is needed, so we can package Tomcat's well-maintained conf/web.xml -->
			<groupId>org.apache.tomcat</groupId>
			<artifactId>tomcat</artifactId>
			<type>zip</type>
			<scope>provided</scope>
		</dependency>

		<!-- Other -->

		<dependency>
			<groupId>org.apache.commons</groupId>
			<artifactId>commons-collections4</artifactId>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>commons-io</groupId>
			<artifactId>commons-io</artifactId>
			<scope>provided</scope>
		</dependency>

		<!-- Testing -->

		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.mockito</groupId>
			<artifactId>mockito-core</artifactId>
			<scope>test</scope>
		</dependency>

	</dependencies>

</project>
