<?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.web.samples</groupId>
		<artifactId>samples-jsf</artifactId>
		<version>8.0.36</version>
		<relativePath>../pom.xml</relativePath>
	</parent>

	<groupId>org.ops4j.pax.web.samples</groupId>
	<artifactId>war-jsf23-cdi</artifactId>
	<packaging>war</packaging>

	<name>OPS4J Pax Web JSF Samples - wired JSF 2.3/CDI 1.2</name>

	<build>
		<plugins>
			<plugin>
				<groupId>org.apache.felix</groupId>
				<artifactId>maven-bundle-plugin</artifactId>
				<extensions>true</extensions>
				<configuration>
					<supportedProjectTypes>
						<supportedProjectType>jar</supportedProjectType>
						<supportedProjectType>war</supportedProjectType>
						<supportedProjectType>bundle</supportedProjectType>
					</supportedProjectTypes>
					<instructions>
						<Import-Package>
							javax.enterprise.context,
							javax.inject,
							javax.servlet.*;version="[3.1,5)",
							javax.faces.annotation,
							javax.faces.bean,
							javax.faces.view,
							javax.faces.webapp,
							org.osgi.service.url,
							org.osgi.service.cdi.annotations,
							org.ops4j.pax.web.service.spi
						</Import-Package>
						<Require-Bundle>
							org.apache.myfaces.core.impl
						</Require-Bundle>
						<Private-Package>
							org.ops4j.pax.web.samples.warjsf23cdi
						</Private-Package>
						<_wab>${project.build.directory}/${project.build.finalName}</_wab>
						<Web-ContextPath>/war-jsf23-cdi</Web-ContextPath>
<!--						<DynamicImport-Package>-->
<!--							org.apache.myfaces.*,-->
<!--							org.jboss.weld.*,-->
<!--							org.ops4j.pax.web.*,-->
<!--							org.apache.myfaces.cdi,-->
<!--							org.apache.myfaces.cdi.*,-->
<!--							org.apache.myfaces.flow.cdi,-->
<!--							org.apache.myfaces.flow.cdi.*-->
<!--						</DynamicImport-Package>-->
						<Export-Package />
						<Require-Capability>
							<!--
								When using Weld (desirably through aries-cdi), we have to ensure the requirements
								from https://docs.jboss.org/weld/reference/latest-3.1/en-US/html_single/#_servlet
								are met.
							-->
							<!--
								org.apache.aries.cdi.extension.servlet.weld.WeldServletExtension CDI extension
								which registers (wrapped)
								org.jboss.weld.module.web.servlet.WeldInitialListener ServletContextListener
							-->
							osgi.cdi.extension;filter:="(osgi.cdi.extension=aries.cdi.http)",
							<!--
								org.apache.aries.cdi.extension.el.jsp.ELJSPExtension CDI extension
								which registers anonymous ServletContextListener
								which calls:
								 - javax.servlet.jsp.JspApplicationContext.addELResolver(javax.enterprise.inject.spi.BeanManager.getELResolver())
								 - javax.servlet.jsp.JspApplicationContext.addELContextListener(new org.jboss.weld.module.web.el.WeldELContextListener())
							-->
							osgi.cdi.extension;filter:="(osgi.cdi.extension=aries.cdi.el.jsp)"
						</Require-Capability>
						<!-- with -cdiannotations instruction, we don't have to list the beans manually -->
<!--						<Require-Capability><![CDATA[-->
<!--							osgi.extender;filter:="(&(osgi.extender=osgi.cdi)(version>=1.0.0)(!(version>=2.0.0)))";-->
<!--								beans:List<String>="-->
<!--									org.ops4j.pax.web.samples.warjsf23cdi.Hello",-->
<!--							osgi.cdi.extension;filter:="(osgi.cdi.extension=aries.cdi.http)"-->
<!--						]]></Require-Capability>-->
						<Embed-Directory>WEB-INF/lib</Embed-Directory>
						<Embed-Dependency>*;scope=compile</Embed-Dependency>
						<_cdiannotations>*;discover=annotated</_cdiannotations>
					</instructions>
				</configuration>
			</plugin>
		</plugins>
	</build>

	<dependencies>

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

		<dependency>
			<groupId>org.ops4j.pax.web</groupId>
			<artifactId>pax-web-spi</artifactId>
			<scope>provided</scope>
		</dependency>

		<!-- OSGi -->

		<dependency>
			<groupId>org.osgi</groupId>
			<artifactId>osgi.core</artifactId>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>org.osgi</groupId>
			<artifactId>org.osgi.service.cdi</artifactId>
			<scope>provided</scope>
		</dependency>

		<!-- JavaEE -->

		<dependency>
			<groupId>jakarta.servlet</groupId>
			<artifactId>jakarta.servlet-api</artifactId>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>jakarta.enterprise</groupId>
			<artifactId>jakarta.enterprise.cdi-api</artifactId>
			<scope>provided</scope>
		</dependency>

		<dependency>
			<groupId>org.apache.myfaces.core</groupId>
			<artifactId>myfaces-api</artifactId>
			<scope>provided</scope>
		</dependency>

		<!-- SMX -->

		<dependency>
			<groupId>org.apache.servicemix.bundles</groupId>
			<artifactId>org.apache.servicemix.bundles.javax-inject</artifactId>
			<scope>provided</scope>
		</dependency>

	</dependencies>

</project>
