<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">

	<modelVersion>4.0.0</modelVersion>

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

	<groupId>org.ops4j.pax.web</groupId>
	<artifactId>pax-web-features</artifactId>
	<packaging>pom</packaging>

	<name>OPS4J Pax Web - Features</name>

	<description>
		Pax Web module creating a features xml file to deploy Pax Web components as features in Apache Karaf.
		To use this feature enter the following in your Karaf shell -
		feature:install mvn:org.ops4j.pax.web/features/${project.version}/xml/features
	</description>

	<build>
		<resources>
			<resource>
				<directory>src/main/resources</directory>
				<filtering>true</filtering>
			</resource>
		</resources>

		<plugins>

			<!-- Core plugins -->

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-resources-plugin</artifactId>
				<executions>
					<execution>
						<id>filter</id>
						<phase>generate-resources</phase>
						<goals>
							<goal>resources</goal>
						</goals>
					</execution>
				</executions>
			</plugin>

			<!-- Karaf plugins -->

			<plugin>
				<groupId>org.apache.karaf.tooling</groupId>
				<artifactId>karaf-maven-plugin</artifactId>
				<executions>
					<execution>
						<id>verify</id>
						<phase>process-resources</phase>
						<goals>
							<goal>verify</goal>
						</goals>
						<configuration>
							<descriptors>
								<descriptor>mvn:org.apache.karaf.features/specs/${dependency.org.apache.karaf}/xml/features</descriptor>
								<descriptor>mvn:org.apache.karaf.features/standard/${dependency.org.apache.karaf}/xml/features</descriptor>
								<descriptor>file:${project.build.directory}/classes/features.xml</descriptor>
							</descriptors>
							<blacklistedDescriptors>
								<!-- we don't want to transitively use any pax-web-features - only the one specified above using file:// -->
								<!-- mvn:${project.groupId}/${project.artifactId} is blacklisted implicitly -->
								<descriptor>mvn:org.ops4j.pax.web/pax-web-features</descriptor>
							</blacklistedDescriptors>
							<distribution>org.apache.karaf.features:framework</distribution>
							<javase>17</javase>
							<framework>
								<feature>framework</feature>
							</framework>
							<features>
								<feature>pax-web-specs</feature>
								<feature>pax-web-core</feature>
								<feature>pax-web-websockets</feature>
								<feature>pax-web-jetty</feature>
								<feature>pax-web-jetty-websockets</feature>
								<feature>pax-web-jetty-extras</feature>
								<feature>pax-web-jetty-http2</feature>
								<feature>pax-web-jetty-http2-extras</feature>
								<feature>pax-web-http-jetty</feature>
								<feature>pax-web-tomcat</feature>
								<feature>pax-web-tomcat-websockets</feature>
								<feature>pax-web-http-tomcat</feature>
								<feature>pax-web-undertow</feature>
								<feature>pax-web-undertow-websockets</feature>
								<feature>pax-web-http-undertow</feature>
								<feature>pax-web-jsp</feature>
								<feature>pax-web-whiteboard</feature>
								<feature>pax-web-war</feature>
								<feature>pax-web-karaf</feature>
							</features>
							<verifyTransitive>false</verifyTransitive>
							<ignoreMissingConditions>true</ignoreMissingConditions>
						</configuration>
					</execution>
				</executions>
			</plugin>

			<!-- MojoHaus plugins -->

			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>build-helper-maven-plugin</artifactId>
				<executions>
					<execution>
						<id>attach-artifacts</id>
						<phase>package</phase>
						<goals>
							<goal>attach-artifact</goal>
						</goals>
						<configuration>
							<artifacts>
								<artifact>
									<file>${project.build.outputDirectory}/features.xml</file>
									<type>xml</type>
									<classifier>features</classifier>
								</artifact>
								<artifact>
									<file>${project.build.outputDirectory}/jetty.xml</file>
									<type>xml</type>
									<classifier>config-jetty</classifier>
								</artifact>
								<artifact>
									<file>${project.build.outputDirectory}/jetty-web.xml</file>
									<type>xml</type>
									<classifier>context-jetty</classifier>
								</artifact>
								<artifact>
									<file>${project.build.outputDirectory}/tomcat-server.xml</file>
									<type>xml</type>
									<classifier>config-tomcat</classifier>
								</artifact>
								<artifact>
									<file>${project.build.outputDirectory}/tomcat-context.xml</file>
									<type>xml</type>
									<classifier>context-tomcat</classifier>
								</artifact>
								<artifact>
									<file>${project.build.outputDirectory}/undertow.xml</file>
									<type>xml</type>
									<classifier>config-undertow</classifier>
								</artifact>
							</artifacts>
						</configuration>
					</execution>
				</executions>
			</plugin>

		</plugins>
	</build>

	<dependencies>

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

		<dependency>
			<groupId>org.ops4j.pax.web</groupId>
			<artifactId>pax-web-api</artifactId>
		</dependency>
		<dependency>
			<groupId>org.ops4j.pax.web</groupId>
			<artifactId>pax-web-compatibility-annotation</artifactId>
		</dependency>
		<dependency>
			<groupId>org.ops4j.pax.web</groupId>
			<artifactId>pax-web-compatibility-el</artifactId>
		</dependency>
		<dependency>
			<groupId>org.ops4j.pax.web</groupId>
			<artifactId>pax-web-extender-war</artifactId>
		</dependency>
		<dependency>
			<groupId>org.ops4j.pax.web</groupId>
			<artifactId>pax-web-extender-whiteboard</artifactId>
		</dependency>
		<dependency>
			<groupId>org.ops4j.pax.web</groupId>
			<artifactId>pax-web-jetty</artifactId>
		</dependency>
		<dependency>
			<groupId>org.ops4j.pax.web</groupId>
			<artifactId>pax-web-jsp</artifactId>
		</dependency>
		<dependency>
			<groupId>org.ops4j.pax.web</groupId>
			<artifactId>pax-web-runtime</artifactId>
		</dependency>
		<dependency>
			<groupId>org.ops4j.pax.web</groupId>
			<artifactId>pax-web-spi</artifactId>
		</dependency>
		<dependency>
			<groupId>org.ops4j.pax.web</groupId>
			<artifactId>pax-web-tomcat</artifactId>
		</dependency>
		<dependency>
			<groupId>org.ops4j.pax.web</groupId>
			<artifactId>pax-web-tomcat-common</artifactId>
		</dependency>
		<dependency>
			<groupId>org.ops4j.pax.web</groupId>
			<artifactId>pax-web-tomcat-websocket</artifactId>
		</dependency>
		<dependency>
			<groupId>org.ops4j.pax.web</groupId>
			<artifactId>pax-web-undertow</artifactId>
		</dependency>
		<dependency>
			<groupId>org.ops4j.pax.web</groupId>
			<artifactId>pax-web-undertow-websocket</artifactId>
		</dependency>
		<dependency>
			<groupId>org.ops4j.pax.web</groupId>
			<artifactId>pax-web-websocket</artifactId>
		</dependency>

		<dependency>
			<groupId>org.apache.karaf.features</groupId>
			<artifactId>framework</artifactId>
			<type>kar</type>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>org.apache.karaf.features</groupId>
			<artifactId>standard</artifactId>
			<type>xml</type>
			<classifier>features</classifier>
			<scope>provided</scope>
		</dependency>

	</dependencies>

</project>
