<?xml version="1.0" encoding="UTF-8"?>
<!--
  #%L
  Cosmos
  %%
  Copyright (C) 2012 - 2018 Andreas Veithen
  %%
  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at
  
       http://www.apache.org/licenses/LICENSE-2.0
  
  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
  #L%
  -->
<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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>com.github.veithen.cosmos</groupId>
        <artifactId>cosmos</artifactId>
        <version>0.3</version>
    </parent>

    <artifactId>p2-maven-connector</artifactId>

    <url>https://github.com/veithen/cosmos</url>

    <scm>
        <url>https://github.com/veithen/cosmos/tree/master</url>
        <connection>scm:git:http://github.com/veithen/cosmos.git</connection>
        <developerConnection>scm:git:https://github.com/veithen/cosmos.git</developerConnection>
        <tag>0.3</tag>
    </scm>

    <dependencies>
        <dependency>
            <groupId>javax.inject</groupId>
            <artifactId>javax.inject</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.maven.resolver</groupId>
            <artifactId>maven-resolver-spi</artifactId>
        </dependency>
        <dependency>
            <groupId>com.github.veithen.cosmos</groupId>
            <artifactId>maven-p2</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>com.google.truth</groupId>
            <artifactId>truth</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-proxy</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.eclipse.sisu</groupId>
                <artifactId>sisu-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>main-index</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>reserve-network-port</id>
                        <goals>
                            <goal>reserve-network-port</goal>
                        </goals>
                        <phase>pre-integration-test</phase>
                        <configuration>
                            <portNames>
                                <portName>repo.httpPort</portName>
                                <portName>proxy.httpPort</portName>
                            </portNames>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.github.veithen.cosmos</groupId>
                <artifactId>p2-publisher-maven-plugin</artifactId>
                <version>${project.version}</version>
                <executions>
                    <execution>
                        <phase>pre-integration-test</phase>
                        <goals>
                            <goal>create-repository</goal>
                        </goals>
                        <configuration>
                            <skip>${skipTests}</skip>
                            <outputDirectory>${project.build.directory}/repo</outputDirectory>
                            <artifacts>
                                <artifact>
                                    <groupId>org.codehaus.woodstox</groupId>
                                    <artifactId>stax2-api</artifactId>
                                    <version>4.0.0</version>
                                </artifact>
                                <artifact>
                                    <groupId>com.fasterxml.woodstox</groupId>
                                    <artifactId>woodstox-core</artifactId>
                                    <version>5.0.3</version>
                                </artifact>
                            </artifacts>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.github.veithen.daemon</groupId>
                <artifactId>daemon-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>start-repo</id>
                        <goals>
                            <goal>start-webapp</goal>
                        </goals>
                        <configuration>
                            <port>${repo.httpPort}</port>
                            <resourceBases>
                                <resourceBase>${project.build.directory}/repo</resourceBase>
                            </resourceBases>
                        </configuration>
                    </execution>
                    <execution>
                        <id>start-proxy</id>
                        <goals>
                            <goal>start-webapp</goal>
                        </goals>
                        <configuration>
                            <port>${proxy.httpPort}</port>
                            <resourceBases>
                                <resourceBase>${project.basedir}/src/test/webapp/proxy</resourceBase>
                            </resourceBases>
                            <requestLog>${project.build.directory}/proxy.log</requestLog>
                        </configuration>
                    </execution>
                    <execution>
                        <id>stop-all</id>
                        <goals>
                            <goal>stop-all</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.github.veithen.invoker</groupId>
                <artifactId>resolver-proxy-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>start</goal>
                            <goal>stop</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-invoker-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <debug>true</debug>
                            <addTestClassPath>true</addTestClassPath>
                            <mavenOpts>${argLine} -Dsisu.debug</mavenOpts>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
