<?xml version="1.0" encoding="UTF-8"?>
<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>com.liferay.faces</groupId>
		<artifactId>com.liferay.faces.bridge.impl.parent</artifactId>
		<version>4.2.0</version>
		<relativePath>../pom.xml</relativePath>
	</parent>
	<artifactId>com.liferay.faces.bridge.impl</artifactId>
	<name>Liferay Faces Bridge Implementation</name>
	<description>Implementation of the API for Liferay Faces Bridge</description>

	<build>
		<plugins>
			<plugin>
				<groupId>biz.aQute.bnd</groupId>
				<artifactId>bnd-baseline-maven-plugin</artifactId>
				<version>${bnd.version}</version>
				<configuration>
					<base>
						<groupId>${project.groupId}</groupId>
						<artifactId>${project.artifactId}</artifactId>
						<version>(,4.1.2]</version>
					</base>
					<includeDistributionManagement>false</includeDistributionManagement>
				</configuration>
				<executions>
					<execution>
						<id>baseline</id>
						<goals>
							<goal>baseline</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>biz.aQute.bnd</groupId>
				<artifactId>bnd-maven-plugin</artifactId>
				<version>${bnd.version}</version>
				<configuration>
					<bnd>
						<![CDATA[
							# Consult individual package-info.java files to determine Export-Packages and versions.
							-exportcontents: ${packages;VERSIONED}
							Export-Package:\
								com.liferay.faces.bridge.application.internal,\
								com.liferay.faces.bridge.application.view.internal,\
								com.liferay.faces.bridge.bean.internal,\
								com.liferay.faces.bridge.client.internal,\
								com.liferay.faces.bridge.component.behavior.internal,\
								com.liferay.faces.bridge.component.html.internal,\
								com.liferay.faces.bridge.component.inputfile.internal,\
								com.liferay.faces.bridge.component.internal,\
								com.liferay.faces.bridge.component.visit.internal,\
								com.liferay.faces.bridge.context.internal,\
								com.liferay.faces.bridge.context.map.internal,\
								com.liferay.faces.bridge.el.internal,\
								com.liferay.faces.bridge.event.internal,\
								com.liferay.faces.bridge.filter.internal,\
								com.liferay.faces.bridge.helper.internal,\
								com.liferay.faces.bridge.i18n.internal,\
								com.liferay.faces.bridge.internal,\
								com.liferay.faces.bridge.renderkit.html_basic.internal,\
								com.liferay.faces.bridge.scope.internal
							# javax.el is automatically imported with the following versions:
							# javax.el;version="[2.2.0,3.0.0)", but versions 3.0.0+ are also valid.
							# javax.enterprise.context is automatically imported with the following versions:
							# javax.enterprise.context;version="[1.1.0,2.0.0)" because of the CDI 1.2 API
							# compile-time dependency. Need to compile against 1.2 since the CDI 2.0 API is
							# compiled with JDK8. Need to require 2.0+ at run-time for Portlet 3.0
							# Java EE 7 compatibility.
							Import-Package: \
								javax.el;version="[2.2.0,4.0.0)",\
								javax.enterprise.context;version="[2.0.0,3.0.0)",\
								javax.enterprise.event;version="[2.0.0,3.0.0)",\
								javax.enterprise.inject.spi;version="[2.0.0,3.0.0)",\
								com.liferay.faces.util.*;version="[3.4.0,4.0.0)",\
								com.liferay.faces.bridge.*;version="[4.2.0,4.3.0)",\
								com.liferay.faces.portlet.*;version="[4.2.0,4.3.0)",\
								javax.portlet;version="[2.0.0,4.0.0)",\
								javax.portlet.faces.*;version="[4.2.0,4.3.0)",\
								org.icefaces.ace.component.fileentry.*;resolution:=optional,\
								*
							Require-Capability: osgi.extender; filter:="(osgi.extender=osgi.serviceloader.registrar)"
							Provide-Capability: \
								osgi.serviceloader;osgi.serviceloader=javax.portlet.faces.Bridge,\
								osgi.serviceloader;osgi.serviceloader=com.liferay.faces.bridge.BridgeFactoryFinder,\
								osgi.extender;osgi.extender="jsp.taglib";uri="http://liferay.com/faces/bridge";\
								version:Version="1.0.0"
						]]>
					</bnd>
				</configuration>
				<executions>
					<execution>
						<goals>
							<goal>bnd-process</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-jar-plugin</artifactId>
				<version>2.4</version>
				<configuration>
					<useDefaultManifestFile>true</useDefaultManifestFile>
					<archive>
						<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
						<manifestEntries>
							<Built-By>Release Manager</Built-By>
							<Implementation-Title>${project.name}</Implementation-Title>
							<Implementation-Version>${full.version}</Implementation-Version>
							<Implementation-Vendor-Id>com.liferay</Implementation-Vendor-Id>
							<Implementation-Vendor>${project.organization.name}</Implementation-Vendor>
						</manifestEntries>
					</archive>
				</configuration>
			</plugin>
		</plugins>
	</build>

	<dependencies>
		<!-- BEGIN: Only required for bridge:inputFile -->
		<dependency>
			<groupId>commons-fileupload</groupId>
			<artifactId>commons-fileupload</artifactId>
			<optional>true</optional>
		</dependency>
		<dependency>
			<groupId>commons-io</groupId>
			<artifactId>commons-io</artifactId>
			<optional>true</optional>
		</dependency>
		<!-- END: Only required for bridge:inputFile -->
		<dependency>
			<groupId>com.liferay.faces</groupId>
			<artifactId>com.liferay.faces.bridge.api</artifactId>
			<scope>compile</scope>
		</dependency>
		<dependency>
			<groupId>com.liferay.faces</groupId>
			<artifactId>com.liferay.faces.util</artifactId>
			<scope>compile</scope>
		</dependency>
		<dependency>
			<groupId>javax.el</groupId>
			<artifactId>javax.el-api</artifactId>
		</dependency>
		<dependency>
			<groupId>javax.enterprise</groupId>
			<artifactId>cdi-api</artifactId>
			<optional>true</optional>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>javax.faces</groupId>
			<artifactId>javax.faces-api</artifactId>
		</dependency>
		<dependency>
			<groupId>javax.portlet</groupId>
			<artifactId>portlet-api</artifactId>
		</dependency>
		<dependency>
			<groupId>javax.servlet</groupId>
			<artifactId>javax.servlet-api</artifactId>
		</dependency>
		<dependency>
			<groupId>javax.servlet.jsp</groupId>
			<artifactId>javax.servlet.jsp-api</artifactId>
		</dependency>
		<dependency>
			<groupId>org.icefaces</groupId>
			<artifactId>icefaces-ace</artifactId>
			<scope>provided</scope>
			<optional>true</optional>
		</dependency>
		<dependency>
			<groupId>org.osgi</groupId>
			<artifactId>osgi.annotation</artifactId>
		</dependency>
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<scope>test</scope>
		</dependency>
	</dependencies>

	<profiles>
		<profile>
			<!--
				Note: When the generating the bridge components, the API classes will be output into
				target/liferay-faces-bridge-api.
			-->
			<id>generate-components</id>
			<properties>
				<copyright.year>${maven.build.timestamp}</copyright.year>
				<maven.build.timestamp.format>yyyy</maven.build.timestamp.format>
				<!--
					To generate the portlet components run:

						mvn generate-sources -P generate-components -Dshort.namespace=portlet
				-->
				<short.namespace>bridge</short.namespace>
			</properties>
			<build>
				<plugins>
					<plugin>
						<artifactId>maven-resources-plugin</artifactId>
						<version>2.7</version>
						<executions>
							<execution>
								<id>copy-resources</id>
								<goals>
									<goal>copy-resources</goal>
								</goals>
								<phase>initialize</phase>
								<configuration>
									<outputDirectory>${project.build.directory}</outputDirectory>
									<resources>
										<resource>
											<directory>${project.basedir}</directory>
											<includes>
												<include>${short.namespace}-tags.xml</include>
											</includes>
											<filtering>true</filtering>
										</resource>
									</resources>
								</configuration>
							</execution>
						</executions>
					</plugin>
					<plugin>
						<groupId>org.codehaus.mojo</groupId>
						<artifactId>exec-maven-plugin</artifactId>
						<version>1.2.1</version>
						<executions>
							<execution>
								<goals>
									<goal>java</goal>
								</goals>
								<phase>generate-sources</phase>
								<configuration>
									<includeProjectDependencies>false</includeProjectDependencies>
									<includePluginDependencies>true</includePluginDependencies>
									<mainClass>com.liferay.faces.generator.Generator</mainClass>
									<arguments>
										<argument>${project.build.directory}/${short.namespace}-tags.xml</argument>
									</arguments>
									<executableDependency>
										<groupId>com.liferay.faces</groupId>
										<artifactId>com.liferay.faces.generator</artifactId>
									</executableDependency>
								</configuration>
							</execution>
						</executions>
						<dependencies>
							<dependency>
								<groupId>com.liferay.faces</groupId>
								<artifactId>com.liferay.faces.generator</artifactId>
								<version>1.1.1</version>
							</dependency>
						</dependencies>
					</plugin>
				</plugins>
			</build>
		</profile>
		<profile>
			<id>generate-docs</id>
			<build>
				<plugins>
					<plugin>
						<groupId>org.codehaus.mojo</groupId>
						<artifactId>exec-maven-plugin</artifactId>
						<version>1.5.0</version>
						<executions>
							<execution>
								<goals>
									<goal>java</goal>
								</goals>
								<phase>generate-resources</phase>
								<configuration>
									<includePluginDependencies>true</includePluginDependencies>
									<mainClass>org.omnifaces.vdldoc.Main</mainClass>
									<arguments>
										<argument>-windowtitle</argument>
										<argument>Liferay Faces Bridge View Description Language Documentation (VDLDoc)</argument>
										<argument>-doctitle</argument>
										<argument>Liferay Faces Bridge View Description Language Documentation (VDLDoc)</argument>
										<argument>-d</argument>
										<argument>${project.build.directory}/vdldoc/bridge-api/${project.artifact.selectedVersion.majorVersion}.${project.artifact.selectedVersion.minorVersion}</argument>
										<argument>${project.basedir}/src/main/resources/META-INF/bridge.taglib.xml</argument>
										<argument>${project.basedir}/src/main/resources/META-INF/portlet.taglib.xml</argument>
									</arguments>
									<executableDependency>
										<groupId>org.omnifaces</groupId>
										<artifactId>vdldoc</artifactId>
									</executableDependency>
								</configuration>
							</execution>
						</executions>
						<dependencies>
							<dependency>
								<groupId>org.omnifaces</groupId>
								<artifactId>vdldoc</artifactId>
								<version>2.1</version>
							</dependency>
						</dependencies>
					</plugin>
				</plugins>
			</build>
		</profile>
	</profiles>

</project>
