<?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>
  <parent>
    <groupId>com.vaadin</groupId>
    <artifactId>vaadin-swing-bridge</artifactId>
    <version>1.2-SNAPSHOT</version>
  </parent>

  <artifactId>swing-bridge-flow</artifactId>
  <name>Vaadin Swing Bridge Flow</name>
  <description>Vaadin Flow integration for the Swing Bridge</description>

  <licenses>
    <license>
      <name>Vaadin Commercial License and Service Terms</name>
      <url>https://vaadin.com/commercial-license-and-service-terms</url>
      <distribution>repo</distribution>
    </license>
  </licenses>

  <properties>
    <maven.compiler.source>21</maven.compiler.source>
    <maven.compiler.target>21</maven.compiler.target>
    <vaadin.version>25.2.0-beta1</vaadin.version>
    <log4j.version>2.24.3</log4j.version>
  </properties>

  <dependencyManagement>
    <dependencies>
      <!--
        Imported before vaadin-bom so junit-* artifacts stay consistent.
        Vaadin's BOM transitively bumps junit-jupiter-api to 6.x via
        spring-boot-dependencies while leaving junit-jupiter-engine at 5.x,
        which breaks test discovery.
      -->
      <dependency>
        <groupId>org.junit</groupId>
        <artifactId>junit-bom</artifactId>
        <version>${junit-jupiter.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
      <dependency>
        <groupId>com.vaadin</groupId>
        <artifactId>vaadin-bom</artifactId>
        <version>${vaadin.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <dependencies>
    <dependency>
      <groupId>com.vaadin</groupId>
      <artifactId>vaadin-core</artifactId>
    </dependency>
    <dependency>
      <groupId>com.vaadin</groupId>
      <artifactId>license-checker</artifactId>
    </dependency>
    <dependency>
      <groupId>com.vaadin</groupId>
      <artifactId>swing-bridge-graphics</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>com.vaadin</groupId>
      <artifactId>swing-bridge-annotations</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>jakarta.servlet</groupId>
      <artifactId>jakarta.servlet-api</artifactId>
      <version>6.0.0</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-core</artifactId>
      <version>${log4j.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-slf4j2-impl</artifactId>
      <version>${log4j.version}</version>
    </dependency>
    <dependency>
      <groupId>org.mockito</groupId>
      <artifactId>mockito-junit-jupiter</artifactId>
      <version>5.14.2</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <repositories>
    <repository>
      <releases>
        <enabled>true</enabled>
      </releases>
      <id>central</id>
      <url>https://repo1.maven.org/maven2</url>
    </repository>
    <repository>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
      <id>vaadin-prereleases</id>
      <url>https://maven.vaadin.com/vaadin-prereleases</url>
    </repository>
  </repositories>

  <pluginRepositories>
    <pluginRepository>
      <releases>
        <enabled>true</enabled>
      </releases>
      <id>central</id>
      <url>https://repo1.maven.org/maven2</url>
    </pluginRepository>
    <pluginRepository>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
      <id>vaadin-prereleases</id>
      <url>https://maven.vaadin.com/vaadin-prereleases</url>
    </pluginRepository>
  </pluginRepositories>

  <build>
    <resources>
      <!-- Needed for setting the version on the properties file -->
      <resource>
        <filtering>true</filtering>
        <directory>src/main/resources</directory>
      </resource>
    </resources>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <release combine.self="override"/>
          <compilerArgs>
            <arg>--add-exports=java.desktop/sun.font=ALL-UNNAMED</arg>
            <arg>--add-exports=java.desktop/sun.awt.image=ALL-UNNAMED</arg>
            <arg>--add-exports=java.desktop/sun.awt=ALL-UNNAMED</arg>
            <arg>--add-exports=java.desktop/sun.java2d=ALL-UNNAMED</arg>
            <arg>--add-exports=java.desktop/sun.java2d.pipe=ALL-UNNAMED</arg>

            <arg>--add-exports=java.desktop/java.awt=ALL-UNNAMED</arg>
            <arg>--add-exports=java.desktop/java.awt.peer=ALL-UNNAMED</arg>
            <arg>--add-exports=java.desktop/java.awt.dnd.peer=ALL-UNNAMED</arg>
          </compilerArgs>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <!--
            SwingBridgeToolkit extends sun.awt.SunToolkit. To even load the
            class in tests (e.g. via Mockito static mocking) the JVM must
            be allowed to access sun.awt. Production runs (the playground
            Spring Boot app) pass these via spring-boot-maven-plugin's
            jvmArguments.
          -->
          <argLine>--add-exports=java.desktop/sun.awt=ALL-UNNAMED</argLine>
        </configuration>
      </plugin>
    </plugins>
  </build>

</project>
