<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.distribution</groupId>
    <artifactId>entaxy-ion-support</artifactId>
    <version>1.12.0</version>
  </parent>
  <artifactId>external-features-customized</artifactId>
  <packaging>pom</packaging>
  
  <properties>
  	<assembly-project>assembled-replacements</assembly-project>
  </properties>
  
  <modules>
  	<module>org.apache.karaf.features_standard_4.2.9.entaxy</module>
  	<module>org.apache.karaf.features_enterprise_4.2.9.entaxy</module>
  	<module>org.ops4j.pax.jdbc_pax.jdbc.features_1.4.4.entaxy</module>
  	<module>org.apache.activemq_artemis-features_2.19.0.entaxy</module>
  	<module>
  		org.ops4j.pax.transx_pax-transx-features_0.4.4.entaxy
  	</module>
  	<module>org.apache.aries.jpa_jpa-features_2.7.2.entaxy</module>
  	<module>org.ops4j.pax.web_pax-web-features_7.2.16.entaxy</module>
  	<module>org.apache.camel.karaf_apache-camel_3.4.5.entaxy</module>
	<module>org.apache.cxf.karaf_apache-cxf_3.3.6.entaxy</module>

  	<!-- MUST be LAST -->
  	<module>assembled-replacements</module>
  </modules>
  
 <profiles>
 
 	<profile>
  		<id>clear-assembled-features-list</id>
  		<activation>
  			<file>
  				<exists>assembled-features-list</exists>
  			</file>
  		</activation>
 		
 		<build>
 		
 			<plugins>
		
				<plugin>
		            <groupId>org.apache.maven.plugins</groupId>
		            <artifactId>maven-antrun-plugin</artifactId>
		            <executions>
		              <execution>
		                <id>clear-assembled-features-list</id>
		                <phase>process-resources</phase>
		                <goals>
		                  <goal>run</goal>
		                </goals>
		                <configuration>
		                  <skip>false</skip>
		                  <target>
		                    <delete file="${project.basedir}/${assembly-project}/generated/list"/>
		                    <echo file="${project.basedir}/${assembly-project}/generated/list" />
		                  </target>
		                </configuration>
		              </execution>
		            </executions>
				</plugin> 			
 				
 			
 			</plugins>
 		
 		</build>
 		
 	</profile>
 
  	<profile>
  		<id>attach-customized-features</id>
  		<activation>
  			<file>
  				<exists>src/features/features.xml</exists>
  			</file>
  		</activation>
  		<build>
  		
		  	<resources>
		  	
		  		<resource>
		  			<directory>src/features</directory>
		  			<filtering>true</filtering>
		  			<targetPath>${project.build.directory}/features</targetPath>
		  		</resource>
		  	
		  	</resources>
    		
  			<plugins>
		  		<plugin>
		
			        <groupId>org.codehaus.mojo</groupId>
			        <artifactId>build-helper-maven-plugin</artifactId>
			        <version>${build-helper-maven-plugin.version}</version>
			        
					<executions>
						<execution>
							<id>attach-customized-features</id>
					        <goals>
								<goal>attach-artifact</goal>
							</goals>
							<phase>prepare-package</phase>
				            <configuration>
				                <artifacts>
				                    <artifact>
				                        <file>
				                        	${project.build.directory}/features/features.xml
				                        </file>
				                        <type>xml</type>
				                        <classifier>features</classifier>
				                    </artifact>
				                </artifacts>
				            </configuration>
						</execution>
					</executions>
		
		  		</plugin>

				<plugin>
		            <groupId>org.apache.maven.plugins</groupId>
		            <artifactId>maven-antrun-plugin</artifactId>
		            <executions>
		              <execution>
		                <id>add-to-assembled-features-list</id>
		                <phase>process-resources</phase>
		                <goals>
		                  <goal>run</goal>
		                </goals>
		                <configuration>
		                  <skip>false</skip>
		                  <target>
							<echo file="${project.basedir}/../${assembly-project}/generated/list" append="true">
${project.groupId}/${project.artifactId}/${project.version}/xml/features,					
							</echo>					
		                  </target>
		                </configuration>
		              </execution>
		            </executions>
				</plugin> 
  				
  			</plugins>
  		</build>
  	</profile>
  	
  </profiles>
  
</project>
