<?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/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>

	<parent>
		<groupId>org.cogchar</groupId>
		<artifactId>org.cogchar.modules.main</artifactId>
		<version>1.0.6.2</version>
		<relativePath>../org.cogchar.modules.main/pom.xml</relativePath>
	</parent>	
	
    <artifactId>org.cogchar.bundle.bind.lift</artifactId>
	

	<!--
			When we use "bundle" packaging, then we get a ".jar" file which is easily loaded as a bundle.	
			PAX services are able to find the webapp within this bundle.
	-->
	
	<packaging>bundle</packaging>

	
	<name>${project.artifactId} - Webapp in OSGi bundle</name>

	<!-- Set the baseURL for http access via OSGi -->
	<properties>
		<web.contextPath>test_lifter</web.contextPath>
	</properties>
        
        
	<dependencies>
		<dependency>
			<groupId>org.apache.felix</groupId>
			<artifactId>org.osgi.core</artifactId>
			<version>1.4.0</version>
			<scope>provided</scope>
		</dependency>          


		<!--  Main lift Jar -->
		<dependency>
			<groupId>net.liftweb</groupId>
			<artifactId>lift-webkit_2.8.1</artifactId>
			<version>2.3</version>
			<exclusions>
				<exclusion>
					<artifactId>scala-library</artifactId>
					<groupId>org.scala-lang</groupId>
				</exclusion>
			</exclusions>
		</dependency>

		<!-- TODO : Recheck source of this dep  -->
		<dependency>
			<groupId>net.liftweb</groupId>
			<artifactId>lift-actor_2.8.1</artifactId>
			<version>2.3</version>
			<exclusions>
				<exclusion>
					<artifactId>scala-library</artifactId>
					<groupId>org.scala-lang</groupId>
				</exclusion>
			</exclusions>
		</dependency>

		<!--	Lift 2.3 (which is not OSGi-fied, while 2.4 is but has some ugly deps)
				wants these classes;  We could mark the imports as optional to avoid this dep.
		-->
		<dependency>
			<groupId>net.liftweb</groupId>
			<artifactId>lift-testkit_2.8.1</artifactId>
			<version>2.3</version>
			<exclusions>
				<exclusion>
					<artifactId>commons-codec</artifactId>
					<groupId>commons-codec</groupId>
				</exclusion>
				<exclusion>
					<artifactId>commons-httpclient</artifactId>
					<groupId>commons-httpclient</groupId>
				</exclusion>
				<exclusion>
					<artifactId>scala-library</artifactId>
					<groupId>org.scala-lang</groupId>
				</exclusion>
			</exclusions>
		</dependency>
			
		<dependency>
			<!-- OSGi bundle version of Scala 2.8.1 library -->
			<artifactId>scala-library</artifactId>
			<groupId>com.weiglewilczek.scala-lang-osgi</groupId>
			<type>jar</type>
			<version>2.8.1</version>
		</dependency>

<!-- javax.servlet may be included in pax web, not sure if this is still needed -->
		<dependency>
			<groupId>javax.servlet</groupId>
			<artifactId>servlet-api</artifactId>
			<version>2.5</version>
			<scope>provided</scope>
		</dependency>
          
		<dependency>
			<!-- Used by lift-json -->	
			<groupId>org.apache.servicemix.bundles</groupId>
			<artifactId>org.apache.servicemix.bundles.paranamer</artifactId>
			<version>2.4_1</version>
		</dependency>
                
		<dependency>
			<groupId>org.apache.servicemix.bundles</groupId>
			<artifactId>org.apache.servicemix.bundles.javax-inject</artifactId>
			<version>1_2</version>
		</dependency>
		<dependency>
			<groupId>org.apache.servicemix.bundles</groupId>
			<artifactId>org.apache.servicemix.bundles.commons-httpclient</artifactId>
			<version>3.1_7</version>
		</dependency>
		<dependency>
			<groupId>org.apache.directory.studio</groupId>
			<artifactId>org.apache.commons.io</artifactId>
			<version>2.1</version>
			<exclusions>
				<exclusion>
					<artifactId>commons-io</artifactId>
					<groupId>commons-io</groupId>
				</exclusion>
			</exclusions>
		</dependency>		

		<dependency>
			<groupId>org.apache.servicemix.bundles</groupId>
			<artifactId>org.apache.servicemix.bundles.xmlpull</artifactId>
			<version>1.1.3.1_2</version>
		</dependency>
		<dependency>
			<groupId>org.apache.servicemix.bundles</groupId>
			<artifactId>org.apache.servicemix.bundles.xpp3</artifactId>
			<version>1.1.4c_6</version>
		</dependency>	
		
		<dependency>
			<groupId>org.cogchar</groupId>
			<artifactId>org.cogchar.bundle.core</artifactId>
			<version>${project.version}</version>
		</dependency>

		<dependency>
            <groupId>org.cogchar</groupId>
			<artifactId>org.cogchar.lib.outer.client</artifactId>
			<version>${project.version}</version>
		</dependency>
		
		<dependency>
			<groupId>org.robokind</groupId>
			<artifactId>org.robokind.api.common</artifactId>
			<version>${robokind.version}</version>
		</dependency>
		
	</dependencies>


	<build>
		

		<resources>
			<resource>
				<directory>${project.basedir}/src/main/webapp</directory>
			</resource>
		</resources>
		
		<plugins>    
            
			<plugin>
        <!-- Reconfigured based on http://leshazlewood.com/2010/09/08/osgi-maven-pax-and-web-applications/  -->
				<groupId>org.apache.felix</groupId>
				<artifactId>maven-bundle-plugin</artifactId>
				<version>2.2.0</version>
				<extensions>true</extensions>
				<configuration>
					<instructions>

			<!--	"Webapp-Context"  is PAX-specific and deprecated since PAX 1.0.0.
								<Webapp-Context>${web.contextPath}</Webapp-Context>
								Web-ContextPath is from the OSGi spec.
								With no Web-ContextPath, PAX assigns a default context path like:
								http://localhost:8080/org.cogchar.org.cogchar.lifter/
			-->

						<Web-ContextPath>${web.contextPath}</Web-ContextPath>
						<Export-Package>org.cogchar.lifter.*, org.cogchar.bind.lift.*, bootstrap.*, props, net.liftweb.*, toserve.*,  nu.validator.*</Export-Package>
						<Private-Package>com.thoughtworks.xstream.*, org.cogchar.outer.client.*, com.bea.xml.stream.*</Private-Package>
						<Import-Package>!com.bea.xml.*, !net.sf.cglib.*, !org.codehaus.jettison.*, !org.kxml2.*, !nu.xom.*,!org.mozilla.*,!org.specs.*,!ch.qos.logback.*, sun.*;resolution:='optional', *</Import-Package>

					</instructions>

				</configuration>
			</plugin>

							
			<plugin>
				<groupId>org.scala-tools</groupId>
				<artifactId>maven-scala-plugin</artifactId>
				<version>2.14.3</version>
				<configuration>
					<charset>${project.build.sourceEncoding}</charset>
					<jvmArgs>
						<jvmArg>-XX:+TieredCompilation</jvmArg>
						<jvmArg>-Xmx1024m</jvmArg>
						<jvmArg>-DpackageLinkDefs=file://${project.build.directory}/packageLinkDefs.properties</jvmArg>
					</jvmArgs>
				</configuration>
				<executions>
					<execution>
						<goals>
							<goal>compile</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-resources-plugin</artifactId>
				<version>2.4.2</version>
				<executions>
					<execution>
						<id>default-copy-resources</id>
						<phase>process-resources</phase>
						<goals>
							<goal>copy-resources</goal>
						</goals>
						<configuration>
							<overwrite>true</overwrite>
							<outputDirectory>${project.build.directory}</outputDirectory>
							<resources>
								<resource>
									<directory>${project.basedir}/src</directory>
									<includes>
										<include>packageLinkDefs.properties</include>
									</includes>
									<filtering>true</filtering>
								</resource>
							</resources>
						</configuration>
					</execution>
				</executions>
			</plugin>
		</plugins>
		<pluginManagement>
			<plugins>
				<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
				<plugin>
					<groupId>org.eclipse.m2e</groupId>
					<artifactId>lifecycle-mapping</artifactId>
					<version>1.0.0</version>
					<configuration>
						<lifecycleMappingMetadata>
							<pluginExecutions>
								<pluginExecution>
									<pluginExecutionFilter>
										<groupId>
											org.scala-tools
										</groupId>
										<artifactId>
											maven-scala-plugin
										</artifactId>
										<versionRange>
											[2.14.3,)
										</versionRange>
										<goals>
											<goal>compile</goal>
										</goals>
									</pluginExecutionFilter>
									<action>
										<ignore />
									</action>
								</pluginExecution>
							</pluginExecutions>
						</lifecycleMappingMetadata>
					</configuration>
				</plugin>
			</plugins>
		</pluginManagement>
	</build>

</project>
