<?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>dev.cyberstamp.maven.assembly.sbom</groupId>
    <artifactId>assembly-sbom-parent</artifactId>
    <version>0.1.9</version>
    <packaging>pom</packaging>

    <name>Assembly SBOM Parent</name>
    <description>Parent POM for Assembly SBOM modules</description>
    <url>https://github.com/cyberstamp/maven-assembly-sbom</url>
    <licenses>
        <license>
            <name>Apache License, Version 2.0</name>
            <url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
        </license>
    </licenses>
    <scm>
        <connection>scm:git:git://github.com/cyberstamp/maven-assembly-sbom.git</connection>
        <developerConnection>scm:git:ssh://github.com/cyberstamp/maven-assembly-sbom.git</developerConnection>
        <url>https://github.com/cyberstamp/maven-assembly-sbom</url>
      <tag>0.1.9</tag>
  </scm>
    <developers>
        <developer>
            <name>Alexey Loubyansky</name>
            <email>olubyans@redhat.com</email>
        </developer>
    </developers>

    <modules>
        <module>core</module>
        <module>handler</module>
        <module>maven-plugin</module>
    </modules>

    <properties>
        <assembly.plugin.version>3.8.0</assembly.plugin.version>
        <commons.io.version>2.22.0</commons.io.version>
        <cyclonedx.version>13.2.0</cyclonedx.version>
        <javax.inject.version>1</javax.inject.version>
        <junit.version>6.1.3</junit.version>
        <maven.compiler.source>17</maven.compiler.source>
        <maven.compiler.target>17</maven.compiler.target>
        <maven.resolver.version>1.9.27</maven.resolver.version>
        <maven.version>3.9.16</maven.version>
        <maven-plugin-api.version>3.9.16</maven-plugin-api.version>
        <maven-plugin-annotations.version>3.16.0</maven-plugin-annotations.version>
        <mockito.version>5.24.0</mockito.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <sisu.version>1.1.0</sisu.version>
        <version.formatter.plugin>2.29.0</version.formatter.plugin>
        <version.impsort.plugin>1.13.0</version.impsort.plugin>
        <quarkus-ide-config.version>3.40.1</quarkus-ide-config.version>
        <central-publishing-plugin.version>0.11.0</central-publishing-plugin.version>
        <maven-javadoc-plugin.version>3.12.0</maven-javadoc-plugin.version>
        <maven-release-plugin.version>3.3.1</maven-release-plugin.version>
        <maven-source-plugin.version>3.4.0</maven-source-plugin.version>
        <sigmund.version>0.0.1</sigmund.version>
        <format.skip>false</format.skip>
        <readme.update.skip>true</readme.update.skip>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.cyclonedx</groupId>
                <artifactId>cyclonedx-core-java</artifactId>
                <version>${cyclonedx.version}</version>
            </dependency>
            <dependency>
                <groupId>org.junit.jupiter</groupId>
                <artifactId>junit-jupiter</artifactId>
                <version>${junit.version}</version>
            </dependency>
            <dependency>
                <groupId>org.mockito</groupId>
                <artifactId>mockito-core</artifactId>
                <version>${mockito.version}</version>
            </dependency>
            <dependency>
                <groupId>org.mockito</groupId>
                <artifactId>mockito-junit-jupiter</artifactId>
                <version>${mockito.version}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>dev.cyberstamp.sigmund</groupId>
                    <artifactId>sigmund-maven-plugin</artifactId>
                    <version>${sigmund.version}</version>
                </plugin>
                <plugin>
                    <groupId>net.revelc.code.formatter</groupId>
                    <artifactId>formatter-maven-plugin</artifactId>
                    <version>${version.formatter.plugin}</version>
                    <dependencies>
                        <dependency>
                            <groupId>io.quarkus</groupId>
                            <artifactId>quarkus-ide-config</artifactId>
                            <version>${quarkus-ide-config.version}</version>
                        </dependency>
                    </dependencies>
                    <configuration>
                        <cachedir>.cache/formatter-maven-plugin-${version.formatter.plugin}</cachedir>
                        <configFile>eclipse-format.xml</configFile>
                        <lineEnding>LF</lineEnding>
                        <skip>${format.skip}</skip>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>net.revelc.code</groupId>
                    <artifactId>impsort-maven-plugin</artifactId>
                    <version>${version.impsort.plugin}</version>
                    <configuration>
                        <cachedir>.cache/impsort-maven-plugin-${version.impsort.plugin}</cachedir>
                        <groups>java.,javax.,jakarta.,org.,com.</groups>
                        <staticGroups>*</staticGroups>
                        <skip>${format.skip}</skip>
                        <removeUnused>true</removeUnused>
                        <compliance>17</compliance>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

    <profiles>
        <profile>
            <id>format</id>
            <activation>
                <activeByDefault>true</activeByDefault>
                <property>
                    <name>!no-format</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>net.revelc.code.formatter</groupId>
                        <artifactId>formatter-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <phase>process-sources</phase>
                                <goals>
                                    <goal>format</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>net.revelc.code</groupId>
                        <artifactId>impsort-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>sort-imports</id>
                                <goals>
                                    <goal>sort</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>validate</id>
            <activation>
                <activeByDefault>true</activeByDefault>
                <property>
                    <name>no-format</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>net.revelc.code.formatter</groupId>
                        <artifactId>formatter-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <phase>process-sources</phase>
                                <goals>
                                    <goal>validate</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>net.revelc.code</groupId>
                        <artifactId>impsort-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>check-imports</id>
                                <goals>
                                    <goal>check</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-release-plugin</artifactId>
                        <version>${maven-release-plugin.version}</version>
                        <configuration>
                            <tagNameFormat>@{project.version}</tagNameFormat>
                            <autoVersionSubmodules>true</autoVersionSubmodules>
                            <preparationGoals>clean install</preparationGoals>
                            <completionGoals>clean install</completionGoals>
                            <arguments>-Dreadme.update.skip=false</arguments>
                            <pushChanges>false</pushChanges>
                            <localCheckout>true</localCheckout>
                            <remoteTagging>false</remoteTagging>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>${maven-source-plugin.version}</version>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <goals>
                                    <goal>jar-no-fork</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>${maven-javadoc-plugin.version}</version>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.sonatype.central</groupId>
                        <artifactId>central-publishing-maven-plugin</artifactId>
                        <version>${central-publishing-plugin.version}</version>
                        <extensions>true</extensions>
                        <configuration>
                            <publishingServerId>central</publishingServerId>
                            <autoPublish>true</autoPublish>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>dev.cyberstamp.sigmund</groupId>
                        <artifactId>sigmund-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <goals><goal>sign</goal></goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>update-readme</id>
            <activation>
                <property>
                    <name>readme.update.skip</name>
                    <value>false</value>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>exec-maven-plugin</artifactId>
                        <version>3.6.4</version>
                        <inherited>false</inherited>
                        <executions>
                            <execution>
                                <id>update-readme-version</id>
                                <phase>validate</phase>
                                <goals>
                                    <goal>exec</goal>
                                </goals>
                                <configuration>
                                    <executable>bash</executable>
                                    <arguments>
                                        <argument>-c</argument>
                                        <argument>echo '${project.version}' | grep -q SNAPSHOT || sed -i -e '/&lt;artifactId&gt;assembly-sbom-handler&lt;\/artifactId&gt;/{n;s/&lt;version&gt;[^&lt;]*&lt;\/version&gt;/&lt;version&gt;${project.version}&lt;\/version&gt;/}' -e '/&lt;artifactId&gt;assembly-sbom-maven-plugin&lt;\/artifactId&gt;/{n;s/&lt;version&gt;[^&lt;]*&lt;\/version&gt;/&lt;version&gt;${project.version}&lt;\/version&gt;/}' ${project.basedir}/README.md</argument>
                                    </arguments>
                                </configuration>
                            </execution>
                            <execution>
                                <id>commit-readme-version</id>
                                <phase>validate</phase>
                                <goals>
                                    <goal>exec</goal>
                                </goals>
                                <configuration>
                                    <executable>bash</executable>
                                    <arguments>
                                        <argument>-c</argument>
                                        <argument>echo '${project.version}' | grep -q SNAPSHOT || { cd ${project.basedir} &amp;&amp; git diff --quiet README.md 2&gt;/dev/null || (git add README.md &amp;&amp; git commit -m "Update README plugin version to ${project.version}"); }</argument>
                                    </arguments>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
