<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">

  <modelVersion>4.0.0</modelVersion>

  <parent>
    <groupId>org.openhab.core</groupId>
    <artifactId>org.openhab.core.reactor</artifactId>
    <version>5.2.0-SNAPSHOT</version>
  </parent>

  <groupId>org.openhab.core.bundles</groupId>
  <artifactId>org.openhab.core.reactor.bundles</artifactId>
  <packaging>pom</packaging>

  <name>openHAB Core :: Bundles</name>

  <modules>
    <module>org.openhab.core.addon</module>
    <module>org.openhab.core.addon.eclipse</module>
    <module>org.openhab.core.addon.marketplace</module>
    <module>org.openhab.core.addon.marketplace.karaf</module>
    <module>org.openhab.core.auth.jaas</module>
    <module>org.openhab.core.auth.oauth2client</module>
    <module>org.openhab.core.automation</module>
    <module>org.openhab.core.automation.module.media</module>
    <module>org.openhab.core.automation.module.script</module>
    <module>org.openhab.core.automation.module.script.providersupport</module>
    <module>org.openhab.core.automation.module.script.rulesupport</module>
    <module>org.openhab.core.automation.rest</module>
    <module>org.openhab.core.config.core</module>
    <module>org.openhab.core.config.discovery</module>
    <module>org.openhab.core.config.discovery.addon</module>
    <module>org.openhab.core.config.discovery.addon.ip</module>
    <module>org.openhab.core.config.discovery.addon.mdns</module>
    <module>org.openhab.core.config.discovery.addon.process</module>
    <module>org.openhab.core.config.discovery.addon.sddp</module>
    <module>org.openhab.core.config.discovery.addon.upnp</module>
    <module>org.openhab.core.config.discovery.addon.usb</module>
    <module>org.openhab.core.config.discovery.mdns</module>
    <module>org.openhab.core.config.discovery.sddp</module>
    <module>org.openhab.core.config.discovery.usbserial</module>
    <module>org.openhab.core.config.discovery.usbserial.linuxsysfs</module>
    <module>org.openhab.core.config.discovery.usbserial.ser2net</module>
    <module>org.openhab.core.config.discovery.usbserial.windowsregistry</module>
    <module>org.openhab.core.config.discovery.upnp</module>
    <module>org.openhab.core.config.dispatch</module>
    <module>org.openhab.core.config.serial</module>
    <module>org.openhab.core</module>
    <module>org.openhab.core.audio</module>
    <module>org.openhab.core.ephemeris</module>
    <module>org.openhab.core.id</module>
    <module>org.openhab.core.persistence</module>
    <module>org.openhab.core.semantics</module>
    <module>org.openhab.core.thing</module>
    <module>org.openhab.core.transform</module>
    <module>org.openhab.core.voice</module>
    <module>org.openhab.core.karaf</module>
    <module>org.openhab.core.io.bin2json</module>
    <module>org.openhab.core.io.console</module>
    <module>org.openhab.core.io.console.eclipse</module>
    <module>org.openhab.core.io.console.rfc147</module>
    <module>org.openhab.core.io.console.karaf</module>
    <module>org.openhab.core.io.http</module>
    <module>org.openhab.core.io.http.auth</module>
    <module>org.openhab.core.io.monitor</module>
    <module>org.openhab.core.io.net</module>
    <module>org.openhab.core.io.rest</module>
    <module>org.openhab.core.io.rest.audio</module>
    <module>org.openhab.core.io.rest.auth</module>
    <module>org.openhab.core.io.rest.core</module>
    <module>org.openhab.core.io.rest.log</module>
    <module>org.openhab.core.io.rest.mdns</module>
    <module>org.openhab.core.io.rest.sitemap</module>
    <module>org.openhab.core.io.rest.sse</module>
    <module>org.openhab.core.io.rest.swagger</module>
    <module>org.openhab.core.io.rest.transform</module>
    <module>org.openhab.core.io.rest.ui</module>
    <module>org.openhab.core.io.rest.voice</module>
    <module>org.openhab.core.io.transport.mdns</module>
    <module>org.openhab.core.io.transport.modbus</module>
    <module>org.openhab.core.io.transport.mqtt</module>
    <module>org.openhab.core.io.transport.serial</module>
    <module>org.openhab.core.io.transport.serial.javacomm</module>
    <module>org.openhab.core.io.transport.serial.rxtx</module>
    <module>org.openhab.core.io.transport.serial.rxtx.rfc2217</module>
    <module>org.openhab.core.io.transport.upnp</module>
    <module>org.openhab.core.io.websocket</module>
    <module>org.openhab.core.io.websocket.audio</module>
    <module>org.openhab.core.io.jetty.certificate</module>
    <module>org.openhab.core.model.core</module>
    <module>org.openhab.core.model.item</module>
    <module>org.openhab.core.model.item.ide</module>
    <module>org.openhab.core.model.item.runtime</module>
    <module>org.openhab.core.model.lsp</module>
    <module>org.openhab.core.model.persistence</module>
    <module>org.openhab.core.model.persistence.ide</module>
    <module>org.openhab.core.model.persistence.runtime</module>
    <module>org.openhab.core.model.rule</module>
    <module>org.openhab.core.model.rule.ide</module>
    <module>org.openhab.core.model.rule.runtime</module>
    <module>org.openhab.core.model.script</module>
    <module>org.openhab.core.model.script.ide</module>
    <module>org.openhab.core.model.script.runtime</module>
    <module>org.openhab.core.model.sitemap</module>
    <module>org.openhab.core.model.sitemap.ide</module>
    <module>org.openhab.core.model.sitemap.runtime</module>
    <module>org.openhab.core.model.thing</module>
    <module>org.openhab.core.model.thing.ide</module>
    <module>org.openhab.core.model.thing.runtime</module>
    <module>org.openhab.core.model.yaml</module>
    <module>org.openhab.core.storage.json</module>
    <module>org.openhab.core.test</module>
    <module>org.openhab.core.test.magic</module>
    <module>org.openhab.core.ui</module>
    <module>org.openhab.core.ui.icon</module>
  </modules>

  <properties>
    <m2e.jdt.annotationpath>target/dependency</m2e.jdt.annotationpath>
  </properties>

  <dependencies>
    <dependency>
      <groupId>org.openhab.core.bom</groupId>
      <artifactId>org.openhab.core.bom.compile</artifactId>
      <type>pom</type>
    </dependency>
    <dependency>
      <groupId>org.openhab.core.bom</groupId>
      <artifactId>org.openhab.core.bom.test</artifactId>
      <type>pom</type>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-jar-plugin</artifactId>
          <configuration>
            <archive>
              <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
            </archive>
            <skipIfEmpty>true</skipIfEmpty>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <plugin>
        <groupId>biz.aQute.bnd</groupId>
        <artifactId>bnd-maven-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-source-plugin</artifactId>
        <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-dependency-plugin</artifactId>
        <version>3.10.0</version>
        <executions>
          <execution>
            <id>unpack-eea</id>
            <goals>
              <goal>unpack</goal>
            </goals>
            <configuration>
              <artifactItems>
                <artifactItem>
                  <groupId>org.lastnpe.eea</groupId>
                  <artifactId>eea-all</artifactId>
                  <version>${eea.version}</version>
                  <overWrite>true</overWrite>
                </artifactItem>
              </artifactItems>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>jaxb-specific-profile</id>
      <activation>
        <file>
          <exists>jaxb.profile-marker</exists>
        </file>
      </activation>

      <build>
        <plugins>
          <plugin>
            <groupId>org.jvnet.jaxb2.maven2</groupId>
            <artifactId>maven-jaxb2-plugin</artifactId>
            <version>0.15.3</version>
            <configuration>
              <schemaDirectory>schema</schemaDirectory>
              <bindingDirectory>schema/binding</bindingDirectory>
              <generateDirectory>src/generated/java</generateDirectory>
              <noFileHeader>true</noFileHeader>
              <markGenerated>true</markGenerated>
              <removeOldOutput>true</removeOldOutput>
              <cleanPackageDirectories>true</cleanPackageDirectories>
              <locale>en</locale>
              <episode>true</episode>
              <useDependenciesAsEpisodes>true</useDependenciesAsEpisodes>
              <extension>true</extension>
              <strict>false</strict>
              <args>
                <arg>-Xxew</arg>
                <arg>-Xxew:instantiate early</arg>
              </args>
              <plugins>
                <plugin>
                  <groupId>com.github.jaxb-xew-plugin</groupId>
                  <artifactId>jaxb-xew-plugin</artifactId>
                  <version>1.10</version>
                </plugin>
              </plugins>
            </configuration>
            <dependencies>
              <dependency>
                <!-- Required for JDK 17 compatibility, see: https://github.com/highsource/maven-jaxb2-plugin/issues/207 -->
                <groupId>org.glassfish.jaxb</groupId>
                <artifactId>jaxb-runtime</artifactId>
                <version>2.3.9</version>
              </dependency>
            </dependencies>
            <executions>
              <execution>
                <id>generate-jaxb-sources</id>
                <goals>
                  <goal>generate</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>build-helper-maven-plugin</artifactId>
            <executions>
              <execution>
                <goals>
                  <goal>add-resource</goal>
                </goals>
                <phase>generate-resources</phase>
                <configuration>
                  <resources>
                    <resource>
                      <directory>src/generated</directory>
                    </resource>
                  </resources>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>model-specific-profile</id>
      <activation>
        <file>
          <exists>model.profile-marker</exists>
        </file>
      </activation>
      <dependencies>
        <dependency>
          <groupId>org.openhab.core.bom</groupId>
          <artifactId>org.openhab.core.bom.compile-model</artifactId>
          <type>pom</type>
        </dependency>
      </dependencies>
      <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-clean-plugin</artifactId>
              <configuration>
                <filesets>
                  <fileset>
                    <directory>${basedir}/xtend-gen</directory>
                    <includes>
                      <include>**</include>
                    </includes>
                    <excludes>
                      <exclude>.gitignore</exclude>
                    </excludes>
                  </fileset>
                  <fileset>
                    <directory>${basedir}/src/main/generated-sources/xtend</directory>
                    <includes>
                      <include>**</include>
                    </includes>
                    <excludes>
                      <exclude>.gitignore</exclude>
                    </excludes>
                  </fileset>
                </filesets>
              </configuration>
            </plugin>
          </plugins>
        </pluginManagement>
        <plugins>
          <plugin>
            <artifactId>maven-resources-plugin</artifactId>
            <executions>
              <execution>
                <id>copy-antlr-generator-patch</id>
                <goals>
                  <goal>copy-resources</goal>
                </goals>
                <phase>generate-sources</phase>
                <configuration>
                  <outputDirectory>${basedir}/</outputDirectory>
                  <resources>
                    <resource>
                      <directory>${basedirRoot}/bundles</directory>
                      <includes>
                        <include>.antlr-generator-3.2.0-patch.jar</include>
                      </includes>
                    </resource>
                  </resources>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>build-helper-maven-plugin</artifactId>
            <executions>
              <execution>
                <goals>
                  <goal>add-resource</goal>
                </goals>
                <phase>generate-resources</phase>
                <configuration>
                  <resources>
                    <resource>
                      <directory>src-gen</directory>
                      <includes>
                        <!-- binary version of xmi files -->
                        <include>**/*.xtextbin</include>
                        <!-- tokens - Loaded by reflection -->
                        <!-- See: e.g. org.openhab.core.model.parser.antlr.ItemsAntlrTokenFileProvider -->
                        <include>**/*.tokens</include>
                      </includes>
                    </resource>
                    <resource>
                      <directory>src</directory>
                      <includes>
                        <include>**/*.xtext</include>
                      </includes>
                    </resource>
                    <resource>
                      <directory>model</directory>
                      <targetPath>model</targetPath>
                    </resource>
                  </resources>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

</project>
