<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.atlassian.fisheye</groupId>
        <artifactId>atlassian-fisheye-root</artifactId>
        <version>4.9.0-20240503150220</version>
        <relativePath>../pom.xml</relativePath>
    </parent>
    <artifactId>release</artifactId>

    <properties>
        <build.number.string>SNAPSHOT</build.number.string>
        <build.release.num>${project.version}</build.release.num>
        <build.date>${maven.build.timestamp}</build.date>
        <pack.zip.suffix>SNAPSHOT</pack.zip.suffix>
        <maven.build.timestamp.format>yyyy-MM-dd</maven.build.timestamp.format>
    </properties>

    <build>
        <resources>
            <resource>
                <directory>src/main/resources/readme</directory>
                <filtering>true</filtering>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>unpack-fecru-zip</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>unpack</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.directory}/output</outputDirectory>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>com.atlassian.fisheye</groupId>
                                    <artifactId>fecru-zip</artifactId>
                                    <version>${project.version}</version>
                                    <type>zip</type>
                                    <excludes>content/</excludes>
                                </artifactItem>
                            </artifactItems>
                            <overWriteReleases>false</overWriteReleases>
                            <overWriteSnapshots>true</overWriteSnapshots>
                            <overWriteIfNewer>true</overWriteIfNewer>
                        </configuration>
                    </execution>
                    <execution>
                        <id>copy-dependencies-maven</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>copy</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.directory}/output/lib</outputDirectory>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>com.atlassian.fisheye</groupId>
                                    <artifactId>atlassian-fisheye-api</artifactId>
                                    <version>${project.version}</version>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>com.atlassian.fisheye</groupId>
                                    <artifactId>core-utilities</artifactId>
                                    <version>${project.version}</version>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>com.atlassian.fisheye</groupId>
                                    <artifactId>atlassian-fisheye-api</artifactId>
                                    <version>${project.version}</version>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>com.atlassian.fisheye</groupId>
                                    <artifactId>antlr-syntax</artifactId>
                                    <version>${project.version}</version>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>com.atlassian.fisheye</groupId>
                                    <artifactId>core-gwt-bridge</artifactId>
                                    <version>${project.version}</version>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>com.atlassian.fisheye</groupId>
                                    <artifactId>core-gwt</artifactId>
                                    <version>${project.version}</version>
                                </artifactItem>
                            </artifactItems>
                            <overWriteReleases>false</overWriteReleases>
                            <overWriteSnapshots>true</overWriteSnapshots>
                            <overWriteIfNewer>true</overWriteIfNewer>
                        </configuration>
                    </execution>
                    <execution>
                        <id>unpack-content</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>unpack</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.directory}/output/content</outputDirectory>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>com.atlassian.fisheye</groupId>
                                    <artifactId>content</artifactId>
                                    <version>${project.version}</version>
                                    <type>zip</type>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>com.atlassian.fisheye</groupId>
                                    <artifactId>core-gwt</artifactId>
                                    <version>${project.version}</version>
                                    <type>zip</type>
                                </artifactItem>
                            </artifactItems>
                            <overWriteReleases>true</overWriteReleases>
                            <overWriteSnapshots>true</overWriteSnapshots>
                            <overWriteIfNewer>true</overWriteIfNewer>
                        </configuration>
                    </execution>
                    <execution>
                        <id>unpack-truncated-content</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>unpack</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.directory}/output/truncated-content</outputDirectory>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>com.atlassian.fisheye</groupId>
                                    <artifactId>content</artifactId>
                                    <version>${project.version}</version>
                                    <type>zip</type>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>com.atlassian.fisheye</groupId>
                                    <artifactId>core-gwt</artifactId>
                                    <version>${project.version}</version>
                                    <type>zip</type>
                                </artifactItem>
                            </artifactItems>
                            <overWriteReleases>true</overWriteReleases>
                            <overWriteSnapshots>true</overWriteSnapshots>
                            <overWriteIfNewer>true</overWriteIfNewer>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-install-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>none</phase>
                        <id>default-install</id>
                    </execution>
                    <execution>
                        <id>install-fisheye</id>
                        <phase>install</phase>
                        <goals>
                            <goal>install-file</goal>
                        </goals>
                        <configuration>
                            <file>target/fisheye-${build.release.num}${pack.zip.suffix}.zip</file>
                            <groupId>com.atlassian.fisheye</groupId>
                            <artifactId>atlassian-fisheye</artifactId>
                            <version>${project.version}</version>
                            <packaging>zip</packaging>
                            <generatePom>true</generatePom>
                        </configuration>
                    </execution>
                    <execution>
                        <id>install-crucible</id>
                        <phase>install</phase>
                        <goals>
                            <goal>install-file</goal>
                        </goals>
                        <configuration>
                            <file>target/crucible-${build.release.num}${pack.zip.suffix}.zip</file>
                            <groupId>com.atlassian.crucible</groupId>
                            <artifactId>atlassian-crucible</artifactId>
                            <version>${project.version}</version>
                            <packaging>zip</packaging>
                            <generatePom>true</generatePom>
                        </configuration>
                    </execution>
                    <execution>
                        <id>install-fisheye-jspsources</id>
                        <phase>install</phase>
                        <goals>
                            <goal>install-file</goal>
                        </goals>
                        <configuration>
                            <file>target/fisheye-jspsources-${build.release.num}${pack.zip.suffix}.zip</file>
                            <groupId>com.atlassian.fisheye</groupId>
                            <artifactId>atlassian-fisheye-jspsources</artifactId>
                            <version>${project.version}</version>
                            <packaging>zip</packaging>
                            <generatePom>true</generatePom>
                        </configuration>
                    </execution>
                    <execution>
                        <id>install-crucible-jspsources</id>
                        <phase>install</phase>
                        <goals>
                            <goal>install-file</goal>
                        </goals>
                        <configuration>
                            <file>target/crucible-jspsources-${build.release.num}${pack.zip.suffix}.zip</file>
                            <groupId>com.atlassian.crucible</groupId>
                            <artifactId>atlassian-crucible-jspsources</artifactId>
                            <version>${project.version}</version>
                            <packaging>zip</packaging>
                            <generatePom>true</generatePom>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-deploy-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>none</phase>
                        <goals>
                            <goal>deploy</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>deploy-fisheye</id>
                        <phase>deploy</phase>
                        <goals>
                            <goal>deploy-file</goal>
                        </goals>
                        <configuration>
                            <file>target/fisheye-${build.release.num}${pack.zip.suffix}.zip</file>
                            <groupId>com.atlassian.fisheye</groupId>
                            <artifactId>atlassian-fisheye</artifactId>
                            <version>${project.version}</version>
                            <packaging>zip</packaging>
                            <generatePom>true</generatePom>
                            <url>${deploymentUrl}</url>
                            <repositoryId>${repositoryId}</repositoryId>
                        </configuration>
                    </execution>
                    <execution>
                        <id>deploy-crucible</id>
                        <phase>deploy</phase>
                        <goals>
                            <goal>deploy-file</goal>
                        </goals>
                        <configuration>
                            <file>target/crucible-${build.release.num}${pack.zip.suffix}.zip</file>
                            <groupId>com.atlassian.crucible</groupId>
                            <artifactId>atlassian-crucible</artifactId>
                            <version>${project.version}</version>
                            <packaging>zip</packaging>
                            <generatePom>true</generatePom>
                            <url>${deploymentUrl}</url>
                            <repositoryId>${repositoryId}</repositoryId>
                        </configuration>
                    </execution>
                    <execution>
                        <id>deploy-fisheye-jspsources</id>
                        <phase>deploy</phase>
                        <goals>
                            <goal>deploy-file</goal>
                        </goals>
                        <configuration>
                            <file>target/fisheye-jspsources-${build.release.num}${pack.zip.suffix}.zip</file>
                            <groupId>com.atlassian.fisheye</groupId>
                            <artifactId>atlassian-fisheye-jspsources</artifactId>
                            <version>${project.version}</version>
                            <packaging>zip</packaging>
                            <generatePom>true</generatePom>
                            <url>${deploymentUrl}</url>
                            <repositoryId>${repositoryId}</repositoryId>
                        </configuration>
                    </execution>
                    <execution>
                        <id>deploy-crucible-jspsources</id>
                        <phase>deploy</phase>
                        <goals>
                            <goal>deploy-file</goal>
                        </goals>
                        <configuration>
                            <file>target/crucible-jspsources-${build.release.num}${pack.zip.suffix}.zip</file>
                            <groupId>com.atlassian.crucible</groupId>
                            <artifactId>atlassian-crucible-jspsources</artifactId>
                            <version>${project.version}</version>
                            <packaging>zip</packaging>
                            <generatePom>true</generatePom>
                            <url>${deploymentUrl}</url>
                            <repositoryId>${repositoryId}</repositoryId>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>fisheye-crucible-with-jsp</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-assembly-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>fisheye-download-jspsources-assembly</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>single</goal>
                                </goals>
                                <configuration>
                                    <descriptors>
                                        <descriptor>src/main/assembly/download/fisheye-download-assembly.xml
                                        </descriptor>
                                    </descriptors>
                                    <finalName>fecru-download</finalName>
                                    <appendAssemblyId>false</appendAssemblyId>
                                </configuration>
                            </execution>
                            <execution>
                                <id>fisheye-jspsources-assembly</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>single</goal>
                                </goals>
                                <configuration>
                                    <descriptors>
                                        <descriptor>src/main/assembly/jspsources/fisheye-jspsources-assembly.xml
                                        </descriptor>
                                    </descriptors>
                                    <finalName>fisheye-jspsources-${build.release.num}${pack.zip.suffix}</finalName>
                                    <appendAssemblyId>false</appendAssemblyId>
                                </configuration>
                            </execution>
                            <execution>
                                <id>crucible-download-jspsources-assembly</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>single</goal>
                                </goals>
                                <configuration>
                                    <descriptors>
                                        <descriptor>src/main/assembly/download/crucible-download-assembly.xml
                                        </descriptor>
                                    </descriptors>
                                    <finalName>fecru-download</finalName>
                                    <appendAssemblyId>false</appendAssemblyId>
                                </configuration>
                            </execution>
                            <execution>
                                <id>crucible-jspsources-assembly</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>single</goal>
                                </goals>
                                <configuration>
                                    <descriptors>
                                        <descriptor>src/main/assembly/jspsources/crucible-jspsources-assembly.xml
                                        </descriptor>
                                    </descriptors>
                                    <finalName>crucible-jspsources-${build.release.num}${pack.zip.suffix}</finalName>
                                    <appendAssemblyId>false</appendAssemblyId>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>fisheye-crucible-without-jsp</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-antrun-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>truncate-jsp-files</id>
                                <phase>generate-resources</phase>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                                <configuration>
                                    <target>
                                        <taskdef name="truncate"
                                                 classname="com.cenqua.fisheye.anttasks.FileTruncateTask"
                                                 classpathref="maven.plugin.classpath"/>
                                        <truncate>
                                            <fileset id="content.truncate"
                                                     dir="target/output/truncated-content"
                                                     includes="**/*.jsp,**/*.jspf,**/*.tag"/>
                                        </truncate>
                                    </target>
                                </configuration>
                            </execution>
                            <execution>
                                <id>replace-web-xml</id>
                                <phase>generate-resources</phase>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                                <configuration>
                                    <target>
                                        <loadfile property="generated.web.xml" srcfile="../output/generated_web.xml"/>
                                        <replace file="target/output/truncated-content/WEB-INF/web.xml"
                                                 value="${generated.web.xml}">
                                            <replacetoken><![CDATA[<!-- GENERATED WEB XML -->]]></replacetoken>
                                        </replace>
                                    </target>
                                </configuration>
                            </execution>
                        </executions>
                        <dependencies>
                            <dependency>
                                <groupId>com.atlassian.fisheye</groupId>
                                <artifactId>ant-tasks</artifactId>
                                <version>${project.version}</version>
                            </dependency>
                        </dependencies>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-assembly-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>fisheye-download-assembly</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>single</goal>
                                </goals>
                                <configuration>
                                    <descriptors>
                                        <descriptor>src/main/assembly/download/fisheye-download-assembly.xml
                                        </descriptor>
                                    </descriptors>
                                    <finalName>fecru-download</finalName>
                                    <appendAssemblyId>false</appendAssemblyId>
                                </configuration>
                            </execution>
                            <execution>
                                <id>fisheye-assembly</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>single</goal>
                                </goals>
                                <configuration>
                                    <descriptors>
                                        <descriptor>src/main/assembly/fisheye-assembly.xml</descriptor>
                                    </descriptors>
                                    <finalName>fisheye-${build.release.num}${pack.zip.suffix}</finalName>
                                    <appendAssemblyId>false</appendAssemblyId>
                                </configuration>
                            </execution>
                            <execution>
                                <id>crucible-download-assembly</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>single</goal>
                                </goals>
                                <configuration>
                                    <descriptors>
                                        <descriptor>src/main/assembly/download/crucible-download-assembly.xml
                                        </descriptor>
                                    </descriptors>
                                    <finalName>fecru-download</finalName>
                                    <appendAssemblyId>false</appendAssemblyId>
                                </configuration>
                            </execution>
                            <execution>
                                <id>crucible-assembly</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>single</goal>
                                </goals>
                                <configuration>
                                    <descriptors>
                                        <descriptor>src/main/assembly/crucible-assembly.xml</descriptor>
                                    </descriptors>
                                    <finalName>crucible-${build.release.num}${pack.zip.suffix}</finalName>
                                    <appendAssemblyId>false</appendAssemblyId>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
