<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://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">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>com.vaadin</groupId>
    <artifactId>vaadin-swing-bridge</artifactId>
    <version>1.3.0-alpha1</version>
  </parent>
  <groupId>com.vaadin</groupId>
  <artifactId>swing-bridge-nb-playground</artifactId>
  <version>1.3.0-alpha1</version>
  <name>Vaadin Swing Bridge NB-RCP Playground</name>
  <description>Spring Boot host that demonstrates embedding a NetBeans Platform RCP application via SwingBridge. The example app's cluster is copied from `netbeans-rcp-app/application/target/swingcrm/` into `applibs/` during the build, so the bridge auto-discovers it through the standard `applibs/` convention.</description>
  <licenses>
    <license>
      <name>Vaadin Commercial License and Service Terms</name>
      <url>https://vaadin.com/commercial-license-and-service-terms</url>
    </license>
  </licenses>
  <properties>
    <maven.compiler.target>21</maven.compiler.target>
    <spotless.license-header>https://github.com/vaadin/flow/raw/main/eclipse/vaadin-commercial-license-header.txt</spotless.license-header>
    <vaadin.version>25.2.1</vaadin.version>
    <maven.compiler.source>21</maven.compiler.source>
    <spring-boot.version>4.1.0</spring-boot.version>
  </properties>
  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-dependencies</artifactId>
        <version>${spring-boot.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>swing-bridge-graphics</artifactId>
      <version>1.3.0-alpha1</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>com.vaadin</groupId>
      <artifactId>swing-bridge-flow</artifactId>
      <version>1.3.0-alpha1</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>com.vaadin</groupId>
      <artifactId>vaadin-spring-boot-starter</artifactId>
      <version>25.2.1</version>
      <scope>compile</scope>
      <exclusions>
        <exclusion>
          <groupId>org.apache.logging.log4j</groupId>
          <artifactId>log4j-to-slf4j</artifactId>
        </exclusion>
        <exclusion>
          <groupId>ch.qos.logback</groupId>
          <artifactId>logback-classic</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>com.vaadin</groupId>
      <artifactId>vaadin-dev</artifactId>
      <version>25.2.1</version>
      <scope>compile</scope>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-web</artifactId>
      <version>4.1.0</version>
      <scope>compile</scope>
      <exclusions>
        <exclusion>
          <groupId>org.apache.logging.log4j</groupId>
          <artifactId>log4j-to-slf4j</artifactId>
        </exclusion>
        <exclusion>
          <groupId>ch.qos.logback</groupId>
          <artifactId>logback-classic</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
  </dependencies>
  <build>
    <plugins>
      <plugin>
        <artifactId>maven-resources-plugin</artifactId>
        <executions>
          <execution>
            <id>copy-cluster-into-applibs</id>
            <phase>generate-resources</phase>
            <goals>
              <goal>copy-resources</goal>
            </goals>
            <configuration>
              <outputDirectory>${project.basedir}/applibs</outputDirectory>
              <overwrite>true</overwrite>
              <resources>
                <resource>
                  <directory>${project.parent.basedir}/netbeans-rcp-app/application/target/swingcrm</directory>
                  <filtering>false</filtering>
                </resource>
              </resources>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-clean-plugin</artifactId>
        <configuration>
          <filesets>
            <fileset>
              <directory>${project.basedir}/applibs</directory>
              <excludes>
                <exclude>.gitkeep</exclude>
                <exclude>README.md</exclude>
              </excludes>
              <followSymlinks>false</followSymlinks>
            </fileset>
          </filesets>
        </configuration>
      </plugin>
      <plugin>
        <groupId>com.vaadin</groupId>
        <artifactId>vaadin-maven-plugin</artifactId>
        <version>${vaadin.version}</version>
        <executions>
          <execution>
            <goals>
              <goal>prepare-frontend</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
        <version>${spring-boot.version}</version>
        <configuration>
          <jvmArguments>--patch-module java.desktop=../swing-bridge-patch/target/swing-bridge-patch-${project.version}.jar
            -Xbootclasspath/a:../swing-bridge-graphics/target/swing-bridge-graphics-${project.version}.jar
            --add-reads=java.desktop=ALL-UNNAMED
            --add-exports=java.desktop/sun.font=ALL-UNNAMED
            --add-exports=java.desktop/sun.awt=ALL-UNNAMED
            --add-exports=java.desktop/sun.awt.dnd=ALL-UNNAMED
            --add-exports=java.desktop/sun.awt.dnd.peer=ALL-UNNAMED
            --add-exports=java.base/sun.nio.cs=ALL-UNNAMED
            --add-exports=java.desktop/sun.java2d=ALL-UNNAMED
            --add-exports=java.desktop/sun.java2d.pipe=ALL-UNNAMED
            --add-exports=java.desktop/sun.awt.datatransfer=ALL-UNNAMED
            --add-exports=java.desktop/sun.awt.image=ALL-UNNAMED
            --add-exports=java.desktop/java.awt.peer=ALL-UNNAMED
            --add-exports=java.desktop/java.awt.dnd=ALL-UNNAMED
            --add-exports=java.desktop/java.awt.dnd.peer=ALL-UNNAMED
            --add-exports=java.desktop/sun.print=ALL-UNNAMED
            --add-exports=java.desktop/sun.swing=ALL-UNNAMED
            --add-opens=java.desktop/java.awt.event=ALL-UNNAMED
            --add-opens=java.desktop/sun.awt=ALL-UNNAMED
            --add-opens=java.desktop/java.awt.dnd=ALL-UNNAMED
            --add-opens=java.desktop/javax.swing.text=ALL-UNNAMED
            --add-opens=java.desktop/javax.swing=ALL-UNNAMED
            --add-opens=java.base/java.net=ALL-UNNAMED
            --add-opens=java.base/java.security=ALL-UNNAMED
            --add-opens=java.base/java.lang=ALL-UNNAMED
            -Djava.security.manager=allow</jvmArguments>
          <systemPropertyVariables>
            <java.awt.headless>false</java.awt.headless>
          </systemPropertyVariables>
        </configuration>
      </plugin>
    </plugins>
  </build>
  <profiles>
    <profile>
      <id>it</id>
      <dependencies>
        <dependency>
          <groupId>com.vaadin</groupId>
          <artifactId>vaadin-core</artifactId>
          <exclusions>
            <exclusion>
              <groupId>com.vaadin</groupId>
              <artifactId>vaadin-dev</artifactId>
            </exclusion>
          </exclusions>
        </dependency>
      </dependencies>
    </profile>
  </profiles>
</project>
