<?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">
	<parent>
		<artifactId>g9-runtime</artifactId>
		<groupId>no.esito</groupId>
		<version>2.7.0</version>
	</parent>
	<modelVersion>4.0.0</modelVersion>
	<packaging>jar</packaging>
	<artifactId>g9-runtime-dist</artifactId>
	<properties>
		<dest.jarfolder>${project.build.directory}/classes/jar</dest.jarfolder>
		<dest.javascriptfolder>${project.build.directory}/classes/javascript</dest.javascriptfolder>
		<dest.descriptorfolder>${dest.jarfolder}/mvn</dest.descriptorfolder>
	</properties>
	<build>
	<resources>
		<resource>
			<directory>src/main/resources/mvn</directory>
			<excludes>
				<exclude>**/*</exclude>
			</excludes>
		</resource>
	</resources>	
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-dependency-plugin</artifactId>
				<executions>
					<!--*******************************************-->
					<!--Copy javadoc for dependencies              -->
					<!--*******************************************-->
					<execution>
						<id>get-javadoc</id>
						<phase>prepare-package</phase>
						<goals>
							<goal>copy-dependencies</goal>
						</goals>
						<configuration>
							<classifier>javadoc</classifier>
						</configuration>
					</execution>
					<!--*******************************************-->
					<!--Copy sources for dependencies              -->
					<!--*******************************************-->
					<execution>
						<id>get-sources</id>
						<phase>prepare-package</phase>
						<goals>
							<goal>copy-dependencies</goal>
						</goals>
						<configuration>
							<classifier>sources</classifier>
						</configuration>
					</execution>
					<!--*******************************************-->
					<!--Copy jars and poms for dependencies        -->
					<!--*******************************************-->
					<execution>
						<phase>prepare-package</phase>
						<id>get-dependencies</id>
						<goals>
							<goal>copy-dependencies</goal>
						</goals>
						<configuration>
							<copyPom>true</copyPom>
						</configuration>
					</execution>
				</executions>
				<configuration>
					<useRepositoryLayout>true</useRepositoryLayout>
					<includeGroupIds>no.esito</includeGroupIds>
					<outputDirectory>${project.build.directory}/g9-runtime-artifacts</outputDirectory>
					<failOnMissingClassifierArtifact>false</failOnMissingClassifierArtifact>
				</configuration>
			</plugin>
			<plugin>
				<artifactId>maven-antrun-plugin</artifactId>
				<version>1.7</version>
				<executions>
					<execution>
						<phase>prepare-package</phase>
						<configuration>
							<target>
								<!--*******************************************-->
								<!--copy and filter the scripts                -->
								<!--*******************************************-->
								<copy toDir="${dest.jarfolder}" filtering="true" overwrite="true">
									<fileset dir="${project.basedir}/src/main/resources"/>
									<filterset>
										<filter token="g9.version" value="${project.version}"/>
									</filterset>
								</copy>

								<!--*******************************************-->
								<!--Copy the jar files                         -->
								<!--*******************************************-->
								<move toDir="${dest.jarfolder}"
									  flatten="true"
									  includeEmptyDirs="false">
									<fileset dir="${project.build.directory}/g9-runtime-artifacts">
										<include name="**/*.jar"/>
									</fileset>
								</move>

								<!--*******************************************-->
								<!--Copy the poms to the mvn directory         -->
								<!--*******************************************-->
								<move toDir="${dest.descriptorfolder}"
									  flatten="true"
									  includeEmptyDirs="false">
									<fileset dir="${project.build.directory}/g9-runtime-artifacts">
										<include name="**/*.pom"/>
									</fileset>
								</move>

								<!--*******************************************-->
								<!--Unpack the jvine.runtime.js to javascript/ -->
								<!--*******************************************-->
								<copy todir="${dest.javascriptfolder}" preservelastmodified="true" flatten="true">
									<zipfileset src="${dest.jarfolder}/g9-icefaces2-${project.version}.jar">
										<patternset>
											<include name="META-INF/resources/js/jvine.runtime.js"/>
										</patternset>
									</zipfileset>
								</copy>

								<!--*******************************************-->
								<!--Create the final zip                       -->
								<!--*******************************************-->
								<jar destfile="${project.build.directory}/${project.artifactId}-${project.version}.jar">
									<fileset dir="${project.build.directory}/classes">
									</fileset>
								</jar>
							</target>
						</configuration>
						<goals>
							<goal>run</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>
	<dependencies>
		<dependency>
			<groupId>no.esito</groupId>
			<artifactId>g9-annotation</artifactId>
		</dependency>
		<dependency>
			<groupId>no.esito</groupId>
			<artifactId>g9-common</artifactId>
		</dependency>
		<dependency>
			<groupId>no.esito</groupId>
			<artifactId>g9-jgrape</artifactId>
		</dependency>
		<dependency>
			<groupId>no.esito</groupId>
			<artifactId>g9-jvine</artifactId>
		</dependency>
		<dependency>
			<groupId>no.esito</groupId>
			<artifactId>g9-icefaces2</artifactId>
		</dependency>
		<dependency>
			<groupId>no.esito</groupId>
			<artifactId>g9-jouteur</artifactId>
		</dependency>
		<dependency>
			<groupId>no.esito</groupId>
			<artifactId>g9-swing</artifactId>
		</dependency>
		<dependency>
			<groupId>no.esito</groupId>
			<artifactId>g9-tx-ejb3</artifactId>
		</dependency>
		<dependency>
			<groupId>no.esito</groupId>
			<artifactId>g9-jgrape-ejb3</artifactId>
		</dependency>
		<dependency>
			<groupId>no.esito</groupId>
			<artifactId>g9-runtime</artifactId>
			<type>pom</type>
			<version>${project.version}</version>
		</dependency>
	</dependencies>
</project>
