<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>
	<packaging>pom</packaging>
	<parent>
		<groupId>net.sf.tsl2nano</groupId>
		<artifactId>tsl2.nano.h5-package</artifactId>
		<version>2.4.9</version>
	</parent>
	<artifactId>tsl2.nano.h5.thymeleaf-pack</artifactId>
	<name>TSL2 Framework H5 Thymeleaf-Package</name>
	<properties>
		<module.parent>..</module.parent>
		<maven.compiler.source>1.8</maven.compiler.source>
		<maven.compiler.target>1.8</maven.compiler.target>
		<properties.quiet>true</properties.quiet>
	</properties>
	<!-- Warning: Inside Eclipse, the maven script may stop with error:
			...Artifact has not been packaged yet. When used on reactor artifact, unpack should be executed after packaging... -->
	<build>
		<resources>
			<resource>
				<directory>src/main/resources</directory>
			</resource>
		</resources>
		<plugins>
 			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-dependency-plugin</artifactId>
				<version>3.0.2</version>
				<executions>
					<execution>
						<id>unpack-nanoh5</id>
						<phase>prepare-package</phase>
						<goals>
							<goal>unpack-dependencies</goal>
						</goals>
						<configuration>
							<includeScope>runtime</includeScope>
							<includeArtifactIds>tsl2.nano.h5</includeArtifactIds>
							<outputDirectory>${project.build.directory}/classes</outputDirectory>
						</configuration>
					</execution>
					<execution>
						<id>copy-dependencies</id>
						<phase>generate-resources</phase>
						<goals>
							<goal>tree</goal>
							<goal>copy-dependencies</goal>
						</goals>
						<configuration>
							<includeScope>runtime</includeScope>
							<includeArtifactIds>thymeleaf, attoparser, ognl, unbescape</includeArtifactIds>
							<outputDirectory>${project.build.directory}/classes</outputDirectory>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-jar-plugin</artifactId>
				<configuration>
					<archive>
						<manifest>
							<addClasspath>true</addClasspath>
							<mainClass>de.tsl2.nano.h5.Loader</mainClass>
						</manifest>
						<manifestEntries>
							<groupId>${project.groupId}</groupId>
							<artifactId>${project.artifactId}</artifactId>
							<Application-Name>${project.name}</Application-Name>
							<Application-Class>${project.mainclass}</Application-Class>
							<Application-Source>${application.source}</Application-Source>
							<Application-redirect>/download</Application-redirect>
							<Permissions>all-permissions</Permissions>
						</manifestEntries>
					</archive>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
	            <artifactId>maven-antrun-plugin</artifactId>
	            <executions>
	                <execution>
	                    <id>start-nanoh5-jar</id>
	                    <phase>pre-integration-test</phase>
	                    <goals>
	                        <goal>run</goal>
	                    </goals>
	                    <inherited>true</inherited>
	                    <configuration>
	                    	<failOnError>true</failOnError>
	                    	<skip>${skipTests}</skip>
	                        <target unless="skipIntegrationTest">
								<echo>STARTING ${project.build.finalName} on pre-integration-test</echo>
								<mkdir dir="${project.build.directory}/pre-integration-test" />
	                            <java jar="${project.build.directory}/${project.build.finalName}.jar"
	                            	  dir="${project.build.directory}/pre-integration-test"
	                                  fork="true"
									  spawn="true"
									  >
	                                <sysproperty key="app.server.running" value="true" />
	                                <sysproperty key="app.database.internal.server.run" value="true" />
	                                <sysproperty key="websocket.use" value="true" />
	                                <sysproperty key="tsl2nano.offline" value="false" />
	                                <sysproperty key="app.show.startpage" value="false" />
	                                <!-- <arg value="-xyz" /> <arg value="123" /> -->
	                            </java>
								<sleep seconds="10" />
								<echo>RESUMING ${project.build.finalName} integration-test</echo>
	                        </target>
	                    </configuration>
	                </execution>
	            </executions>
	        </plugin>
		</plugins>
	</build>
	<dependencies>
		<dependency>
			<groupId>net.sf.tsl2nano</groupId>
			<artifactId>tsl2.nano.h5.thymeleaf</artifactId>
			<version>${project.version}</version>
			<exclusions>
				<exclusion> <!-- on some reps, the japserreports is not available -->
					<groupId>net.js.jasperreports</groupId>
					<artifactId>jasperreports</artifactId>
				</exclusion>
			</exclusions>		
		</dependency>
		<dependency>
			<groupId>com.h2database</groupId>
			<artifactId>h2</artifactId>
			<version>1.4.199</version>
			<scope>test</scope>
		</dependency>
	</dependencies>
</project>