<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>


	<artifactId>convex-integration</artifactId>
	<name>Convex Integration</name>
	<description>
		Module intented primarily to implement integration testing across
		different Convex artifacts
	</description>

	<parent>
		<groupId>world.convex</groupId>
		<artifactId>convex</artifactId>
		<version>0.8.5</version>
	</parent>

	<build>
		<plugins>
		    <plugin>
	            <groupId>org.apache.maven.plugins</groupId>
	            <artifactId>maven-surefire-plugin</artifactId>
	            <configuration>
	                <!-- Run only unit tests, exclude slow / environment dependentintegration tests -->
	                <excludes>
	                    <exclude>**/*IT.java</exclude>
	                </excludes>
	            </configuration>
	        </plugin>
		
			<plugin>
				<artifactId>maven-assembly-plugin</artifactId>
				<version>3.7.1</version>
				<configuration>
					<archive>
						<manifest>
							<mainClass>convex.main.Main</mainClass>
							<!-- Used to add Maven implementation version  -->
							<addDefaultImplementationEntries>
								true
							</addDefaultImplementationEntries>
						</manifest>
					</archive>
					<descriptorRefs>
						<descriptorRef>jar-with-dependencies</descriptorRef>
					</descriptorRefs>
					<outputDirectory>${project.build.directory}</outputDirectory>
					
					<!-- This creates full convex.jar. We don't want it attached, just built -->
					<attach>false</attach>
					<appendAssemblyId>false</appendAssemblyId>
					<finalName>convex</finalName>
				</configuration>
				<executions>
					<execution>
						<id>create-archive</id>
						<!-- Use install phase so it doesn't go in deployed Maven artifacts'  -->
						<phase>install</phase>
						<goals>
							<goal>single</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>
	
	<profiles>
    <profile>
        <id>integration-tests</id>

        <build>
            <plugins>
                <!-- Failsafe runs the heavy live integration tests -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-failsafe-plugin</artifactId>
                    <version>3.5.4</version>
                    <executions>
                        <execution>
                            <goals>
                                <goal>integration-test</goal>
                                <goal>verify</goal>
                            </goals>
                            <configuration>

                                <!-- Live environment -->
                                <systemPropertyVariables>
                                    <convex.peer.url>https://peer.convex.live</convex.peer.url>
                                    <spring.profiles.active>live</spring.profiles.active>
                                </systemPropertyVariables>

                                <!-- Optional: run in parallel, fail fast, etc. -->
                                <parallel>classes</parallel>
                                <threadCount>4</threadCount>
                                <failIfNoTests>true</failIfNoTests>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>

                <!-- Optional: completely skip surefire when running integration tests -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <configuration>
                        <skip>true</skip>
                    </configuration>
                </plugin>
            </plugins>
        </build>
    </profile>
</profiles>

	<dependencies>
		<dependency>
			<groupId>world.convex</groupId>
			<artifactId>convex-peer</artifactId>
			<version>${convex.version}</version>
		</dependency>
		<dependency>
			<groupId>world.convex</groupId>
			<artifactId>convex-core</artifactId>
			<version>${convex.version}</version>
		</dependency>
		<dependency>
			<groupId>world.convex</groupId>
			<artifactId>convex-restapi</artifactId>
			<version>${convex.version}</version>
		</dependency>

		<dependency>
			<groupId>world.convex</groupId>
			<artifactId>convex-java</artifactId>
			<version>${convex.version}</version>
		</dependency>
		<dependency>
			<groupId>world.convex</groupId>
			<artifactId>convex-cli</artifactId>
			<version>${convex.version}</version>
		</dependency>
		<dependency>
			<groupId>world.convex</groupId>
			<artifactId>convex-gui</artifactId>
			<version>${convex.version}</version>
		</dependency>
		<dependency>
			<groupId>ch.qos.logback</groupId>
			<artifactId>logback-core</artifactId>
			<version>${logback.version}</version>
			<!-- optional becuase not needed by projects depending on this -->
			<optional>true</optional>
		</dependency>
		<dependency>
			<groupId>ch.qos.logback</groupId>
			<artifactId>logback-classic</artifactId>
			<version>${logback.version}</version>
			<!-- optional becuase not needed by projects depending on this -->
			<optional>true</optional>
		</dependency>

		<!-- TEST DEPENDENCIES -->
		<dependency>
			<groupId>org.junit.jupiter</groupId>
			<artifactId>junit-jupiter-engine</artifactId>
			<version>${junit.version}</version>
			<scope>test</scope>
		</dependency>

	</dependencies>
</project>