pom.xml

303 lines | 15.121 kB Blame History Raw Download
<?xml version="1.0"?>
<!--
~ Copyright 2016 Red Hat, Inc. and/or its affiliates
~ and other contributors as indicated by the @author tags.
~
~ 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.
-->

<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <parent>
        <groupId>org.keycloak.testsuite</groupId>
        <artifactId>integration-arquillian-servers-app-server</artifactId>
        <version>3.4.1.CR1</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>integration-arquillian-servers-app-server-tomcat</artifactId>
    <packaging>pom</packaging>
    <name>App Server - Tomcat</name>

    <properties>
        <common.resources>${project.parent.basedir}/common</common.resources>
        <assembly.xml>${project.parent.basedir}/assembly.xml</assembly.xml>
        <app.server.tomcat.home>${containers.home}/${app.server.tomcat.unpacked.folder.name}</app.server.tomcat.home>
    </properties>

    <profiles>
        <profile>
            <id>app-server-tomcat-submodules</id>
            <activation>
                <file>
                    <exists>src</exists>
                </file>
            </activation>    
            <build>
                <plugins>
                    
                    <plugin>
                        <artifactId>maven-enforcer-plugin</artifactId>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>enforce</goal>
                                </goals>
                                <configuration>
                                    <rules>
                                        <requireProperty>
                                            <property>app.server.tomcat</property>
                                            <property>app.server.tomcat.groupId</property>
                                            <property>app.server.tomcat.artifactId</property>
                                            <property>app.server.tomcat.version</property>
                                            <property>app.server.tomcat.unpacked.folder.name</property>
                                            <property>app.server.oidc.adapter.artifactId</property>
                                        </requireProperty>
                                    </rules>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>                    
                    
                    <plugin>
                        <artifactId>maven-dependency-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>unpack-tomcat-and-adapter</id>
                                <phase>generate-test-resources</phase>
                                <goals>
                                    <goal>unpack</goal>
                                </goals>
                                <configuration>
                                    <artifactItems>
                                        <artifactItem>
                                            <groupId>${app.server.tomcat.groupId}</groupId>
                                            <artifactId>${app.server.tomcat.artifactId}</artifactId>
                                            <version>${app.server.tomcat.version}</version>
                                            <type>zip</type>
                                            <outputDirectory>${containers.home}</outputDirectory>
                                        </artifactItem>
                                        <artifactItem>
                                            <groupId>org.keycloak</groupId>
                                            <artifactId>${app.server.oidc.adapter.artifactId}</artifactId>
                                            <version>${project.version}</version>
                                            <type>zip</type>
                                            <outputDirectory>${app.server.tomcat.home}/lib</outputDirectory>
                                        </artifactItem>
                                    </artifactItems>
                                    <overWriteIfNewer>true</overWriteIfNewer>
                                </configuration>
                            </execution>
                            <execution>
                                <id>libs-for-tomcat</id>
                                <phase>generate-test-resources</phase>
                                <goals>
                                    <goal>copy</goal>
                                </goals>
                                <configuration>
                                    <artifactItems>
                                        <artifactItem>
                                            <groupId>org.jboss.resteasy</groupId>
                                            <artifactId>resteasy-client</artifactId>
                                        </artifactItem>
                                        <artifactItem>
                                            <groupId>org.jboss.spec.javax.ws.rs</groupId>
                                            <artifactId>jboss-jaxrs-api_2.0_spec</artifactId>
                                        </artifactItem>                                        
                                        <artifactItem>
                                            <groupId>org.jboss.resteasy</groupId>
                                            <artifactId>resteasy-jaxrs</artifactId>
                                        </artifactItem>
                                        <artifactItem>
                                            <groupId>commons-io</groupId>
                                            <artifactId>commons-io</artifactId>
                                            <version>1.4</version>
                                        </artifactItem>
                                    </artifactItems>
                                    <outputDirectory>${app.server.tomcat.home}/lib</outputDirectory>
                                    <overWriteIfNewer>true</overWriteIfNewer>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>xml-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>add-tomcat-manager-user</id>
                                <phase>process-test-resources</phase>
                                <goals>
                                    <goal>transform</goal>
                                </goals>
                                <configuration>
                                    <transformationSets>
                                        <transformationSet>
                                            <dir>${app.server.tomcat.home}/conf</dir>
                                            <stylesheet>${common.resources}/tomcat-users.xsl</stylesheet>
                                            <includes>
                                                <include>tomcat-users.xml</include>
                                            </includes>
                                            <outputDir>${app.server.tomcat.home}/conf</outputDir>
                                        </transformationSet>
                                    </transformationSets>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    
                    <plugin>
                        <artifactId>maven-antrun-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>parametrize-server-ports</id>
                                <phase>process-test-resources</phase>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                                <configuration>
                                    <tasks>
                                        <replace file="${app.server.tomcat.home}/conf/server.xml">
                                            <replacetoken>8005</replacetoken>
                                            <replacevalue>${tomcat.server.port}</replacevalue>
                                        </replace>
                                        <replace file="${app.server.tomcat.home}/conf/server.xml">
                                            <replacetoken>8080</replacetoken>
                                            <replacevalue>${tomcat.http.port}</replacevalue>
                                        </replace>
                                        <replace file="${app.server.tomcat.home}/conf/server.xml">
                                            <replacetoken>8443</replacetoken>
                                            <replacevalue>${tomcat.server.port}</replacevalue>
                                        </replace>
                                        <replace file="${app.server.tomcat.home}/conf/server.xml">
                                            <replacetoken>8009</replacetoken>
                                            <replacevalue>${tomcat.ajp.port}</replacevalue>
                                        </replace>
                                        
                                        <propertyfile
                                            file="${app.server.tomcat.home}/conf/catalina.properties"
                                            comment="Parametrized Tomcat Ports in server.xml">
                                            <entry  key="tomcat.server.port" value="8005"/>
                                            <entry  key="tomcat.http.port" value="8080"/>
                                            <entry  key="tomcat.https.port" value="8443"/>
                                            <entry  key="tomcat.ajp.port" value="8009"/>
                                        </propertyfile>
                                        
                                    </tasks>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    
                    <plugin>
                        <artifactId>maven-assembly-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>create-zip</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>single</goal>
                                </goals>
                                <configuration>
                                    <descriptors>
                                        <descriptor>${assembly.xml}</descriptor>
                                    </descriptors>
                                    <appendAssemblyId>false</appendAssemblyId>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>                    
                </plugins>
            </build>
        </profile>
        
        <profile>
            <id>app-server-saml-supported</id>
            <activation>
                <file>
                    <exists>src/saml-adapter-supported</exists>
                </file>
            </activation>
            <properties>
                <app.server.saml.adapter.supported>true</app.server.saml.adapter.supported>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-enforcer-plugin</artifactId>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>enforce</goal>
                                </goals>
                                <configuration>
                                    <rules>
                                        <requireProperty>
                                            <property>app.server.saml.adapter.artifactId</property>
                                        </requireProperty>
                                    </rules>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <artifactId>maven-dependency-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>unpack-saml-adapter</id>
                                <phase>generate-resources</phase>
                                <goals>
                                    <goal>unpack</goal>
                                </goals>
                                <configuration>
                                    <artifactItems>
                                        <artifactItem>
                                            <groupId>org.keycloak</groupId>
                                            <artifactId>${app.server.saml.adapter.artifactId}</artifactId>
                                            <version>${project.version}</version>
                                            <type>zip</type>
                                            <outputDirectory>${app.server.tomcat.home}/lib</outputDirectory>
                                        </artifactItem>
                                    </artifactItems>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        
        <profile>
            <id>app-server-tomcat7</id>
            <modules>
                <module>tomcat7</module>
            </modules>
        </profile>
        <profile>
            <id>app-server-tomcat8</id>
            <modules>
                <module>tomcat8</module>
            </modules>
        </profile>
        <profile>
            <id>app-server-tomcat9</id>
            <modules>
                <module>tomcat9</module>
            </modules>
        </profile>
        
    </profiles>


</project>