<?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>ru.entaxy.esb</groupId>
    <artifactId>ui</artifactId>
    <version>1.12.0</version>
  </parent>
  <groupId>ru.entaxy.esb.ui</groupId>
  <artifactId>entaxy-hawtio</artifactId>
  <packaging>pom</packaging>
  <name>ENTAXY :: UI :: HAWTIO</name>
  <description>ENTAXY :: UI :: HAWTIO</description>
  
  <properties>
  	<entaxy.underlying.version>${project.version}</entaxy.underlying.version>
  </properties>
  
  <dependencyManagement>
  	<dependencies>
  		<dependency>
            <groupId>io.hawt</groupId>
            <artifactId>hawtio-plugin-mbean</artifactId>
            <version>${hawtio.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-log4j12</artifactId>
                </exclusion>
            </exclusions>
  		</dependency>
  		<dependency>
	      	<groupId>javax.servlet</groupId>
	      	<artifactId>javax.servlet-api</artifactId>
	      	<version>3.1.0</version>
  		</dependency>
  	</dependencies>
  </dependencyManagement>
  
	<build>
		<pluginManagement>
			<plugins>
				<plugin>
			        <groupId>org.apache.maven.plugins</groupId>
			        <artifactId>maven-war-plugin</artifactId>
				</plugin>
			</plugins>
		</pluginManagement>

	</build>
  
	<profiles>
	
		<profile>
			<id>attach-cfg</id>
			<activation>
				<file>
					<exists>src/main/resources/etc/org.apache.karaf.features.repos.cfg</exists>
				</file>
			</activation>		
			<build>
				<plugins>
					<plugin>
						<groupId>org.codehaus.mojo</groupId>
						<artifactId>build-helper-maven-plugin</artifactId>
						<executions>
							<execution>
								<id>attach-cfg-hawtio</id>
								<phase>package</phase>
								<goals>
									<goal>attach-artifact</goal>
								</goals>
								<configuration>
									<runOnlyAtExecutionRoot>false</runOnlyAtExecutionRoot>
									<artifacts>
										<artifact>
											<file>target/classes/etc/org.apache.karaf.features.repos.cfg</file>
											<type>cfg</type>
											<classifier>org.apache.karaf.features.repos</classifier>
										</artifact>
									</artifacts>
								</configuration>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>	
		</profile>
	
		<profile>
			<id>entaxy-hawtio-license</id>
            <activation>
                <property>
                    <name>processLicense</name>
                    <value>true</value>
                </property>
            </activation>
			<build>
				<plugins>
					<plugin>
						<groupId>org.codehaus.mojo</groupId>
						<artifactId>license-maven-plugin</artifactId>
						<executions>
							<execution>
								<id>update-file-header-entaxy-hawtio</id>
								<goals>
									<goal>update-file-header</goal>
								</goals>
								<phase>process-sources</phase>
								<configuration>
									<organizationName>${license.organizationName}</organizationName>
									<inceptionYear>${license.inceptionYear}</inceptionYear>
									<projectName>${license.projectName}</projectName>
									<copyrightOwners>${license.copyrightOwners}</copyrightOwners>
									<licenseName>${license.licenseName}</licenseName>

									<!-- plugin documentation recommends "true"
                                    but we use "false" to look like Apache sources -->
									<addJavaLicenseAfterPackage>false</addJavaLicenseAfterPackage>
									<emptyLineAfterHeader>false</emptyLineAfterHeader>

									<!-- excludes>
                                        <exclude>**/*.json</exclude>
                                    </excludes-->
									<extraExtensions>
										<!-- treat *.install files as *.properties -->
										<install>properties</install>
									</extraExtensions>

									<ignoreNoFileToScan>true</ignoreNoFileToScan>
									<keepBackup>true</keepBackup>

									<processStartTag>${license.processStartTag}</processStartTag>
									<processEndTag>${license.processEndTag}</processEndTag>
									<sectionDelimiter>${license.sectionDelimiter}</sectionDelimiter>
								</configuration>
							</execution>
							<execution>
								<id>update-file-header</id>
								<goals>
									<goal>update-file-header</goal>
								</goals>
								<phase>process-sources</phase>
								<configuration>
									<excludes combine.self="override">
										<!--
											we exclude org.apache.karaf.features.repos.cfg
											for it will be used as a fragment
										 -->
										<exclude>**/org.apache.karaf.features.repos.cfg</exclude>
										<exclude>**/*.cfg</exclude>
										<exclude>**/*.json1</exclude>
										<!-- *.ftl files will be processed by the next plugin -->
										<exclude>**/*.ftl</exclude>
									</excludes>
								</configuration>
							</execution>							
						</executions>
					</plugin>
				</plugins>
			</build>			
		</profile>
	
		<!-- 
			@DISABLED @TO_REMOVE
		 -->
		<profile>
			<id>install-hawtio-script</id>
			<activation>
				<activeByDefault>false</activeByDefault>
				<file>
					<exists>src/main/scripts/entaxy-hawtio.install_1</exists>
				</file>
			</activation>
			<build>
				<plugins>
					<plugin>
						<groupId>org.codehaus.mojo</groupId>
						<artifactId>license-maven-plugin</artifactId>
						<executions>
							<execution>
								<id>update-file-header-hawtio</id>
								<goals>
									<goal>update-file-header</goal>
								</goals>
								<phase>process-sources</phase>
								<configuration>
									<organizationName>${license.organizationName}</organizationName>
									<inceptionYear>${license.inceptionYear}</inceptionYear>
									<projectName>${license.projectName}</projectName>
									<copyrightOwners>${license.copyrightOwners}</copyrightOwners>
									<licenseName>${license.licenseName}</licenseName>

									<!-- plugin documentation recommends "true"
                                    but we use "false" to look like Apache sources -->
									<addJavaLicenseAfterPackage>false</addJavaLicenseAfterPackage>
									<emptyLineAfterHeader>false</emptyLineAfterHeader>

									<!-- excludes>
                                        <exclude>**/*.json</exclude>
                                    </excludes-->
									<extraExtensions>
										<!-- treat *.install files as *.properties -->
										<install>properties</install>
									</extraExtensions>

									<ignoreNoFileToScan>true</ignoreNoFileToScan>
									<keepBackup>true</keepBackup>

									<processStartTag>${license.processStartTag}</processStartTag>
									<processEndTag>${license.processEndTag}</processEndTag>
									<sectionDelimiter>${license.sectionDelimiter}</sectionDelimiter>
								</configuration>
							</execution>
						</executions>
					</plugin>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-resources-plugin</artifactId>
						<executions>
							<execution>
								<id>copy-resources-hawtio</id>
								<phase>validate</phase>
								<goals>
									<goal>copy-resources</goal>
								</goals>
								<configuration>
									<outputDirectory>${basedir}/target/scripts</outputDirectory>
									<resources>
										<resource>
											<directory>src/main/scripts</directory>
											<filtering>true</filtering>
										</resource>
									</resources>
								</configuration>
							</execution>
						</executions>
					</plugin>
					<plugin>
						<groupId>org.codehaus.mojo</groupId>
						<artifactId>build-helper-maven-plugin</artifactId>
						<executions>
							<execution>
								<id>attach-cfg-hawtio</id>
								<phase>package</phase>
								<goals>
									<goal>attach-artifact</goal>
								</goals>
								<configuration>
									<runOnlyAtExecutionRoot>false</runOnlyAtExecutionRoot>
									<artifacts>
										<artifact>
											<file>target/classes/etc/org.apache.karaf.features.repos.cfg</file>
											<type>cfg</type>
											<classifier>org.apache.karaf.features.repos</classifier>
										</artifact>
									</artifacts>
								</configuration>
							</execution>
							<execution>
								<id>attach-script-hawtio</id>
								<phase>verify</phase>
								<goals>
									<goal>attach-artifact</goal>
								</goals>
								<configuration>
									<runOnlyAtExecutionRoot>false</runOnlyAtExecutionRoot>
									<artifacts>
										<artifact>
											<file>target/scripts/entaxy-hawtio.install</file>
											<type>install</type>
											<classifier>entaxy-hawtio</classifier>
										</artifact>
									</artifacts>
								</configuration>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>

	</profiles>


	<modules>
		<module>entaxy-branding-plugin</module>
		<module>artemis-plugin-entaxy</module>
		<module>entaxy-management-plugin</module>
		<module>entaxy-cicd-plugin</module>
		<module>entaxy-h2-plugin</module>
    </modules>
</project>
