<?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">
    <parent>
        <artifactId>root</artifactId>
        <groupId>ru.entaxy.esb</groupId>
        <version>1.8.0</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>platform</artifactId>
    <name>ENTAXY :: PLATFORM</name>
    <description>Entaxy Platform</description>
    <packaging>pom</packaging>

    <modules>
        <module>runtime</module>
    </modules>
    
    <profiles>
    	<profile>
    		<id>install-script</id>
    		<activation>
    			<file>
    				<exists>src/main/scripts/entaxy-platform.install</exists>
    			</file>
    		</activation>
			    <build>
			    	<plugins>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>license-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>update-file-header</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>
			    			<!-- @TODO move plugin declaration to root/pom.xml -->
					        <groupId>org.apache.maven.plugins</groupId>
					        <artifactId>maven-resources-plugin</artifactId>
					        <version>3.2.0</version>
					        <executions>
						        	<execution>
						            <id>copy-resources</id>
						            <!-- here the phase you need -->
						            <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-script</id>
			                        <phase>verify</phase>
			                        <goals>
			                            <goal>attach-artifact</goal>
			                        </goals>
			                        <configuration>
			                            <artifacts>
			                                <artifact>
			                                    <file>target/scripts/entaxy-platform.install</file>
			                                    <type>install</type>
			                                    <classifier>entaxy-platform</classifier>
			                                </artifact>
										</artifacts>
									</configuration>
								</execution>
							</executions>    			
			    		</plugin>
			    	</plugins>
			    </build>
		</profile>
    
  </profiles>

	
</project>