<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>ru.entaxy.esb</groupId>
    <artifactId>ui</artifactId>
    <version>1.10.1</version>
  </parent>
  <groupId>ru.entaxy.esb.ui</groupId>
  <artifactId>h2-console</artifactId>
  <packaging>war</packaging>
  <name>H2 :: CONSOLE</name>
  <description>H2 :: CONSOLE</description>

	<properties>
		<bundle.osgi.dynamicimport.pkg>*</bundle.osgi.dynamicimport.pkg>
		<bundle.osgi.import.pkg>
  		javax.crypto,
		javax.crypto.spec,
		javax.management,
		javax.naming;resolution:=optional,
		javax.naming.directory;resolution:=optional,
		javax.naming.spi;resolution:=optional,
		javax.net,
		javax.net.ssl,
		javax.script;resolution:=optional,
		javax.security.auth.callback;resolution:=optional,
		javax.security.auth.login;resolution:=optional,
		javax.servlet;resolution:=optional,
		javax.servlet.http;resolution:=optional,
		javax.sql,
		javax.tools;resolution:=optional,
		javax.transaction.xa;resolution:=optional,
		javax.xml.parsers;resolution:=optional,
		javax.xml.stream;resolution:=optional,
		javax.xml.transform;resolution:=optional,
		javax.xml.transform.dom;resolution:=optional,
		javax.xml.transform.sax;resolution:=optional,
		javax.xml.transform.stax;resolution:=optional,
		javax.xml.transform.stream;resolution:=optional,
		org.w3c.dom;resolution:=optional,
		org.xml.sax;resolution:=optional,
		org.xml.sax.helpers;resolution:=optional,
		org.apache.lucene.analysis;version="[5.5.5,8.0.0)";resolution:=optional,
		org.apache.lucene.analysis.standard;version="[5.5.5,8.0.0)";resolution:=optional,
		org.apache.lucene.document;version="[5.5.5,8.0.0)";resolution:=optional,
		org.apache.lucene.index;version="[5.5.5,8.0.0)";resolution:=optional,
		org.apache.lucene.queryparser;version="[5.5.5,8.0.0)";resolution:=optional,
		org.apache.lucene.search;version="[5.5.5,8.0.0)";resolution:=optional,
		org.apache.lucene.store;version="[5.5.5,8.0.0)";resolution:=optional,
		org.apache.lucene.util;version="[5.5.5,8.0.0)";resolution:=optional,
		org.locationtech.jts.geom;version="1.15.0";resolution:=optional,
		org.locationtech.jts.io;version="1.15.0";resolution:=optional,
		org.osgi.framework;version="1.5",
		org.osgi.service.jdbc;version="1.0";resolution:=optional,
		org.slf4j;version="[1.6.0,1.7.0)";resolution:=optional
		</bundle.osgi.import.pkg>
		<webapp-outdir>${project.build.directory}/manifest</webapp-outdir>
	</properties>
  
  <dependencies>
  	<!-- dependency>
	  <groupId>com.h2database</groupId>
	  <artifactId>h2</artifactId>
	  <version>1.4.199-ENTAXY</version>
  	</dependency-->
  </dependencies>
  
  <build>
  	<plugins>
  	
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <executions>
                    <execution>
                        <id>bundle-manifest</id>
                        <phase>process-classes</phase>
                        <goals>
                            <goal>manifest</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <manifestLocation>${webapp-outdir}/META-INF</manifestLocation>
                    <supportedProjectTypes>
                        <supportedProjectType>jar</supportedProjectType>
                        <supportedProjectType>bundle</supportedProjectType>
                        <supportedProjectType>war</supportedProjectType>
                    </supportedProjectTypes>
                    <instructions>
                        <Webapp-Context>/h2console</Webapp-Context>
                        <Web-ContextPath>/h2console</Web-ContextPath>

                        <Embed-Directory>WEB-INF/lib</Embed-Directory>
                        <Embed-Dependency>*;scope=compile|runtime</Embed-Dependency>
                        <Embed-Transitive>true</Embed-Transitive>

                        <!-- Export-Package>${osgi.export}</Export-Package -->
                        <!-- Import-Package>
                        	javax.management;resolution:=optional,
                        	org.slf4j;resolution:=optional;version="[1.7,2)",
                        	javax.servlet;version="[3.1,4)"
						</Import-Package -->
                        <!-- DynamicImport-Package>${osgi.dynamic}</DynamicImport-Package -->
                        <!-- Private-Package></Private-Package -->

                        <Bundle-ClassPath>.,WEB-INF/classes</Bundle-ClassPath>

                        <Bundle-Name>${project.name}</Bundle-Name>
                        <Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
                        <Implementation-Title>Entaxy</Implementation-Title>
                        <Implementation-Version>${project.version}</Implementation-Version>
                    </instructions>
                </configuration>
            </plugin>

            <!-- We define the maven-war-plugin here and make sure it uses
              the manifest file generated by the maven-bundle-plugin.  We
              also ensure it picks up our filtered web.xml and not the one
              in src/main/resources -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <configuration>
                    <outputFileNameMapping>@{artifactId}@-@{baseVersion}@@{dashClassifier?}@.@{extension}@</outputFileNameMapping>
                    <packagingExcludes>**/classes/OSGI-INF/**</packagingExcludes>
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                    <archive>
                        <manifestFile>${webapp-outdir}/META-INF/MANIFEST.MF</manifestFile>
                    </archive>
                    <webResources>
                        <resource>
                            <filtering>true</filtering>
                            <directory>src/main/resources</directory>
                            <includes>
                                <include>**/*.*</include>
                            </includes>
                            <excludes>
                                <exclude>log4j.properties</exclude>
                            </excludes>
                        </resource>
                        
                        <!-- 
                        	@TODO decide what to do in cases
                        	when src/main/webapp is absent
                        	after maven-war-plugin configuration 
                        	will be moved to the upper level
                        -->
                        <!-- resource>
                            <filtering>true</filtering>
                            <directory>src/main/webapp</directory>
                            <includes>
                                <include>**/*.*</include>
                            </includes>
                            <excludes>
                                <exclude>log4j.properties</exclude>
                            </excludes>
                        </resource -->
                    </webResources>
                </configuration>
            </plugin>
  	
  	
  	</plugins>
  </build>
  
</project>
