<?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>

	<groupId>de.f0rce</groupId>
	<artifactId>ace</artifactId>
	<version>5.0.1</version>
	<name>ace</name>
	<description>Lit Wrap around the Ace Editor (https://ace.c9.io/) for Vaadin 14 and Vaadin 23</description>

	<properties>
		<vaadin.version>25.0.4</vaadin.version>
		<maven.compiler.source>21</maven.compiler.source>
		<maven.compiler.target>21</maven.compiler.target>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
	</properties>
	<organization>
		<name>David "F0rce" Dodlek</name>
	</organization>
	<licenses>
		<license>
			<name>MIT</name>
			<url>https://opensource.org/licenses/MIT</url>
			<distribution>repo</distribution>
		</license>
	</licenses>
	<dependencyManagement>
		<dependencies>
			<dependency>
				<groupId>com.vaadin</groupId>
				<artifactId>vaadin-bom</artifactId>
				<type>pom</type>
				<scope>import</scope>
				<version>${vaadin.version}</version>
			</dependency>
		</dependencies>
	</dependencyManagement>

	<repositories>
		<repository>
			<id>central</id>
			<url>https://repo.maven.apache.org/maven2</url>
			<snapshots>
				<enabled>false</enabled>
			</snapshots>
		</repository>
		<repository>
			<id>Vaadin Directory</id>
			<url>https://maven.vaadin.com/vaadin-addons</url>
		</repository>
		<!-- Repository needed for prerelease versions of Vaadin -->
		<repository>
			<id>Vaadin prereleases</id>
			<url>https://maven.vaadin.com/vaadin-prereleases</url>
		</repository>
	</repositories>

	<pluginRepositories>
		<pluginRepository>
			<id>central</id>
			<url>https://repo.maven.apache.org/maven2</url>
			<snapshots>
				<enabled>false</enabled>
			</snapshots>
		</pluginRepository>
		<!-- Repository needed for prerelease versions of Vaadin -->
		<pluginRepository>
			<id>Vaadin prereleases</id>
			<url>https://maven.vaadin.com/vaadin-prereleases</url>
		</pluginRepository>
	</pluginRepositories>

	<dependencies>
		<dependency>
			<groupId>com.vaadin</groupId>
			<!-- Replace artifactId with vaadin-core to use only free components -->
			<artifactId>vaadin-core</artifactId>
		</dependency>
		<dependency>
			<groupId>com.vaadin</groupId>
			<artifactId>vaadin-dev</artifactId>
			<optional>true</optional>
		</dependency>
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-simple</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>com.vaadin</groupId>
			<artifactId>vaadin-testbench</artifactId>
			<scope>test</scope>
		</dependency>

		<dependency>
			<groupId>io.github.bonigarcia</groupId>
			<artifactId>webdrivermanager</artifactId>
			<version>6.3.3</version>
			<scope>test</scope>
		</dependency>
	</dependencies>

	<build>
		<defaultGoal>jetty:run</defaultGoal>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-jar-plugin</artifactId>
				<version>3.1.0</version>
				<configuration>
					<archive>
						<index>true</index>
						<manifest>
							<addClasspath>false</addClasspath>
							<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
						</manifest>
						<manifestEntries>
							<Vaadin-Package-Version>1</Vaadin-Package-Version>
						</manifestEntries>
					</archive>
					<!-- Generated file that shouldn't be included in add-ons -->
					<excludes>
						<exclude>META-INF/VAADIN/config/flow-build-info.json</exclude>
						<exclude>META-INF/VAADIN/webapp/**/*</exclude>
					</excludes>
				</configuration>
			</plugin>
			<plugin>
				<groupId>com.vaadin</groupId>
				<artifactId>vaadin-maven-plugin</artifactId>
				<version>${vaadin.version}</version>
				<executions>
					<execution>
						<goals>
							<goal>prepare-frontend</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>org.eclipse.jetty.ee10</groupId>
				<artifactId>jetty-ee10-maven-plugin</artifactId>
				<version>12.0.15</version>
				<configuration>
					<scan>-1</scan>
					<!-- Use test scope because the UI/test classes are in
                        the test package. -->
					<useTestScope>true</useTestScope>
					<supportedPackagings>
						<supportedPackaging>jar</supportedPackaging>
					</supportedPackagings>
					<webApp>
						<resourceBases>
							<resourceBase>src/main/resources/META-INF/resources</resourceBase>
						</resourceBases>
					</webApp>
				</configuration>				
			</plugin>
		</plugins>
	</build>

	<profiles>
		<profile>
			<id>directory</id>
			<build>
				<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-assembly-plugin</artifactId>
						<version>3.3.0</version>
						<configuration>
							<appendAssemblyId>false</appendAssemblyId>
							<descriptors>
								<descriptor>assembly/assembly.xml</descriptor>
							</descriptors>
						</configuration>
						<executions>
							<execution>
								<goals>
									<goal>single</goal>
								</goals>
								<phase>install</phase>
							</execution>
						</executions>
					</plugin>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-source-plugin</artifactId>
						<version>3.2.1</version>
						<executions>
							<execution>
								<id>attach-sources</id>
								<phase>verify</phase>
								<goals>
									<goal>jar-no-fork</goal>
								</goals>
							</execution>
						</executions>
					</plugin>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-javadoc-plugin</artifactId>
						<version>3.3.1</version>
						<executions>
							<execution>
								<id>attach-javadocs</id>
								<phase>verify</phase>
								<goals>
									<goal>jar</goal>
								</goals>
							</execution>
						</executions>
						<configuration>
							<quiet>true</quiet>
							<doclint>none</doclint>
						</configuration>
					</plugin>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-jar-plugin</artifactId>
						<version>3.2.2</version>
						<configuration>
							<!-- Generated file that shouldn't be included in add-ons -->
							<excludes>
								<exclude>META-INF/VAADIN/config/flow-build-info.json</exclude>
								<exclude>META-INF/VAADIN/webapp/**/*</exclude>
							</excludes>
						</configuration>
					</plugin>
				</plugins>
			</build>
		</profile>

		<!-- Run (demo) in production mode-->
		<profile>
			<id>production</id>
			<properties>
				<vaadin.productionMode>true</vaadin.productionMode>
			</properties>
			<dependencies>
				<dependency>
					<groupId>com.vaadin</groupId>
					<artifactId>flow-server-production-mode</artifactId>
				</dependency>
			</dependencies>

			<build>
				<plugins>
					<plugin>
						<groupId>com.vaadin</groupId>
						<artifactId>vaadin-maven-plugin</artifactId>
						<executions>
							<execution>
								<goals>
									<goal>build-frontend</goal>
								</goals>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>

		<profile>
			<id>it</id>
			<build>
				<plugins>
					<plugin>
						<groupId>org.eclipse.jetty.ee10</groupId>
						<artifactId>jetty-ee10-maven-plugin</artifactId>
						<configuration>
							<scan>0</scan>
							<stopPort>8081</stopPort>
							<useTestScope>true</useTestScope>
							<supportedPackagings>
								<supportedPackaging>jar</supportedPackaging>
							</supportedPackagings>
							<stopWait>15</stopWait>
							<stopKey>${project.artifactId}</stopKey>
						</configuration>
						<executions>
							<execution>
								<id>start-jetty</id>
								<phase>pre-integration-test</phase>
								<goals>
									<goal>start</goal>
								</goals>
							</execution>
							<execution>
								<id>stop-jetty</id>
								<phase>post-integration-test</phase>
								<goals>
									<goal>stop</goal>
								</goals>
							</execution>
						</executions>
					</plugin>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-failsafe-plugin</artifactId>
						<version>3.0.0-M5</version>
						<executions>
							<execution>
								<goals>
									<goal>integration-test</goal>
									<goal>verify</goal>
								</goals>
							</execution>
						</executions>
						<configuration>
							<trimStackTrace>false</trimStackTrace>
							<enableAssertions>true</enableAssertions>
						</configuration>
					</plugin>
				</plugins>
			</build>
		</profile>
	</profiles>
</project>