<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>
	<artifactId>webswing-server-launcher</artifactId>
	<parent>
		<artifactId>webswing-server</artifactId>
		<groupId>org.webswing</groupId>
		<version>20.2.5</version>
		<relativePath>..</relativePath>
	</parent>
	<dependencies>
		<dependency>
			<groupId>org.webswing</groupId>
			<artifactId>webswing-app-toolkit</artifactId>
			<version>${project.version}</version>
		</dependency>
		<dependency>
			<groupId>commons-cli</groupId>
			<artifactId>commons-cli</artifactId>
			<version>1.2</version>
		</dependency>
		<dependency>
			<groupId>org.eclipse.jetty</groupId>
			<artifactId>jetty-webapp</artifactId>
			<version>${jetty.version}</version>
		</dependency>
        <dependency>
	        <groupId>org.eclipse.jetty</groupId>
	        <artifactId>jetty-annotations</artifactId>
	        <version>${jetty.version}</version>
	    </dependency>
		<dependency>
            <groupId>org.eclipse.jetty.websocket</groupId>
            <artifactId>javax-websocket-server-impl</artifactId>
            <version>${jetty.version}</version>
        </dependency>
		<dependency>
			<groupId>org.webswing</groupId>
			<artifactId>modpatch-java-desktop</artifactId>
			<version>${project.parent.version}</version>
		</dependency>
		<dependency>
			<groupId>org.webswing</groupId>
			<artifactId>modpatch-jdk-jsobject</artifactId>
			<version>${project.parent.version}</version>
		</dependency>
	</dependencies>
	<build>
		<finalName>webswing-server-launcher</finalName>
		<plugins>
			<plugin>
				<artifactId>maven-compiler-plugin</artifactId>
				<configuration>
					<source>1.8</source>
					<target>1.8</target>
					<compilerArguments>
						<bootclasspath>${basedir}/../../lib/rt-1.8.jar</bootclasspath>
					</compilerArguments>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-dependency-plugin</artifactId>
				<executions>
					<execution>
						<id>copy-dependencies</id>
						<phase>prepare-package</phase>
						<goals>
							<goal>copy-dependencies</goal>
						</goals>
						<configuration>
							<outputDirectory>${project.build.directory}/WEB-INF/server-lib</outputDirectory>
							<includeScope>runtime</includeScope>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-jar-plugin</artifactId>
				<configuration>
					<outputDirectory>${project.build.directory}/WEB-INF/server-lib</outputDirectory>
				</configuration>
			</plugin>
		</plugins>
	</build>
    <profiles>
        <!-- =========================================SERVERLESS BUILD PROFILE================================== -->
        <profile>
            <id>serverless</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-dependency-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>copy-dependencies</id>
                                <phase>prepare-package</phase>
                                <goals>
                                    <goal>copy-dependencies</goal>
                                </goals>
                                <configuration>
                                    <outputDirectory>${project.build.directory}/serverless</outputDirectory>
                                    <includeScope>runtime</includeScope>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-jar-plugin</artifactId>
                        <configuration>
                            <outputDirectory>${project.build.directory}/serverless</outputDirectory>
                        </configuration>
                    </plugin>
                    <plugin>
                        <artifactId>maven-antrun-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>serverless</id>
                                <phase>package</phase>
                                <configuration>
                                    <target>
                                        <echo file="${project.build.directory}/WEB-INF/server-lib/README.txt">This is a serverless Webswing build. No embedded server is included. Deploy to supported Servlet container. (ie. Tomcat)</echo>
                                    </target>
                                </configuration>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
