<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.ion</groupId>
    <artifactId>entaxy-ion-distribution</artifactId>
    <version>1.12.0</version>
  </parent>
  <groupId>ru.entaxy.ion.distribution</groupId>
  <artifactId>entaxy-ion-support</artifactId>
  <packaging>pom</packaging>
  <name>ENTAXY :: ION :: DISTRIBUTION :: SUPPORT</name>
  <description>ENTAXY :: ION :: DISTRIBUTION :: SUPPORT</description>
  
  <build>
  
  	<plugins>

  	
  	
  	</plugins>
  	
  </build>
  
  <profiles>
	
  	<profile>
  		<!-- @FUTURE for future possible use -->
  		<id>append-features-optimization</id>
  		<activation>
  			<activeByDefault>false</activeByDefault>
  		</activation>
  		
  		<build>
  		
  			<plugins>

		        <plugin>
		            <groupId>org.apache.maven.plugins</groupId>
		            <artifactId>maven-dependency-plugin</artifactId>
		            <executions>
		                <execution>
		                    <id>download-features-processing</id>
		                    <phase>generate-sources</phase>
		                    <goals>
		                        <goal>copy</goal>
		                    </goals>
		                    <configuration>
		                        <artifactItems>
		                            <artifactItem>
		                                <groupId>ru.entaxy.esb.underlying</groupId>
		                                <artifactId>entaxy-underlying-configuration</artifactId>
		                                <version>${entaxy.underlying.version}</version>
		                                <type>xml</type>
		                                <classifier>org.apache.karaf.features</classifier>
		                                <overWrite>true</overWrite>
		                                <outputDirectory>${project.build.directory}/merge</outputDirectory>
		                                <destFileName>org.apache.karaf.features.xml</destFileName>
		                            </artifactItem>
		                        </artifactItems>
		                    </configuration>
		                </execution>
					</executions>
				</plugin>	
		
		        <plugin>
		            <groupId>org.apache.maven.plugins</groupId>
		            <artifactId>maven-antrun-plugin</artifactId>
		            <executions>
		            	<execution>
		            		<id>prepare-files-for-merge</id>
		            		<phase>generate-sources</phase>
		            		<goals>
		            			<goal>run</goal>
		            		</goals>
						        <configuration>
						            <target>
						                <taskdef resource="net/sf/antcontrib/antcontrib.properties"
						                         classpathref="maven.plugin.classpath"/>
						
						                <copy file="src/non-packaged/optimization.replacements.xml"
						                      toFile="${project.build.directory}/merge/append.xml"
						                      overwrite="true" force="true"/>
						                <copy file="src/support/xml-merge.xslt"
						                      toFile="${project.build.directory}/merge/xml-merge.xslt"
						                      overwrite="true" force="true"/>
						                      
						            </target>
						        </configuration>
		            	</execution>
		            </executions>
		        </plugin>
		  	
			    <plugin>
			        <groupId>org.codehaus.mojo</groupId>
			        <artifactId>xml-maven-plugin</artifactId>
			        <executions>
			            <execution>
			                <id>merge-replacements-xml</id>
			                <phase>generate-resources</phase>
			                <goals>
			                    <goal>transform</goal>
			                </goals>
			                <configuration>
			                    <forceCreation>true</forceCreation>
			                    <transformationSets>
			                        <transformationSet>
			                            <dir>
			                                ${project.build.directory}/merge
			                            </dir>
			                            <includes>
			                                <include>org.apache.karaf.features.xml</include>
			                            </includes>
			                            <stylesheet>
			                                ${project.build.directory}/merge/xml-merge.xslt
			                            </stylesheet>
			                            <outputDir>
			                                ${project.build.directory}/merged
			                            </outputDir>
			                            <!--
			                            <fileMappers>
			                                <fileMapper
			                                        implementation="org.codehaus.plexus.components.io.filemappers.FileExtensionMapper">
			                                    <targetExtension>.list</targetExtension>
			                                </fileMapper>
			                            </fileMappers>
			                            -->
			                        </transformationSet>
			                    </transformationSets>
			                </configuration>
			            </execution>
			
			        </executions>
			    </plugin>
  	
		  		<plugin>
		
			        <groupId>org.codehaus.mojo</groupId>
			        <artifactId>build-helper-maven-plugin</artifactId>
			        <version>${build-helper-maven-plugin.version}</version>
			        
					<executions>
						<execution>
							<id>attach-optimized-features</id>
					        <goals>
								<goal>attach-artifact</goal>
							</goals>
							<phase>prepare-package</phase>
				            <configuration>
				                <artifacts>
				                    <artifact>
				                        <file>
				                        	${project.build.directory}/merged/org.apache.karaf.features.xml
				                        </file>
				                        <type>xml</type>
				                        <classifier>org.apache.karaf.features</classifier>
				                    </artifact>
				                </artifacts>
				            </configuration>
						</execution>
					</executions>
		
		  		</plugin>
		  			

  			
  			</plugins>
  			
  		</build>
  		
  	</profile>
  </profiles>
  
  <modules>
  	<module>external-features-customized</module>
  </modules>
</project>
