<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>underlying</artifactId>
    <version>1.12.1</version>
  </parent>
  <groupId>ru.entaxy.esb.underlying</groupId>
  <artifactId>entaxy-underlying-features</artifactId>
  <packaging>pom</packaging>
  <name>ENTAXY :: UNDERLYING :: FEATURES</name>
  <description>Features for low-level components and modules for Entaxy</description>

  <build>
  	<plugins>
	  	<!-- WE'RE JUST UNPACKING READY-TO-USE RESOURCES FROM entaxy-underlying-configuration -->
		<plugin>
			<groupId>org.apache.maven.plugins</groupId>
			<artifactId>maven-dependency-plugin</artifactId>
			<executions>
				<execution>
            		<id>prepare-org.apache.karaf.features.xml</id>
            		<phase>generate-resources</phase>
            		<goals>
              			<goal>copy</goal>
            		</goals>
            		<configuration>
	              		<artifactItems>
	                		<artifactItem>
					  			<groupId>ru.entaxy.esb.underlying</groupId>
					  			<artifactId>entaxy-underlying-configuration</artifactId>
					  			<version>${project.version}</version>
	                  			<type>xml</type>
	                  			<classifier>org.apache.karaf.features</classifier>
	                  			<overWrite>true</overWrite>
	                  			<outputDirectory>${project.build.directory}/support</outputDirectory>
	                  			<destFileName>org.apache.karaf.features.xml</destFileName>
	                		</artifactItem>
	              		</artifactItems>
	              	</configuration>
	            </execution>
			</executions>
		</plugin>	
	      <plugin>
	        <groupId>org.codehaus.mojo</groupId>
	        <artifactId>xml-maven-plugin</artifactId>
	        <version>1.0.2</version>
	        <executions>
	          <execution>
	          	<id>generate-feature-content</id>
	          	<phase>generate-resources</phase>
	            <goals>
	              <goal>transform</goal>
	            </goals>
	          </execution>
	        </executions>
	        <configuration>
	          <forceCreation>true</forceCreation>	
	          <transformationSets>
	            <transformationSet>
	              <dir>${project.build.directory}/support</dir>
	              <stylesheet>src/main/support/generate_replacements.xslt</stylesheet>
	              <outputDir>${project.build.directory}/support-generated</outputDir>
	            </transformationSet>
	          </transformationSets>
	        </configuration>
	        <dependencies>
	          <dependency>
	            <groupId>net.sf.saxon</groupId>
	            <artifactId>saxon</artifactId>
	            <version>8.7</version>
	          </dependency>
            </dependencies>
	      </plugin>
		<!-- The following task is disabled because an error occurred during the build:
			[ERROR] [replaceregexp] The following file is missing: 'entaxy-framework/underlying/entaxy-underlying-features/src/main/features/replacements.xml'
			and no one remembers what this task is for -->
<!--	      <plugin>-->
<!--				<groupId>org.apache.maven.plugins</groupId>-->
<!--				<artifactId>maven-antrun-plugin</artifactId>-->
<!--				<executions>-->
<!--					&lt;!&ndash; -->
<!--						combine resulting org.apache.karaf.features.repos.cfg-->
<!--						from fragments in ${project.build.directory}/temp/org.apache.karaf.features.repos -->
<!--					&ndash;&gt;-->
<!--					-->
<!--					<execution>-->
<!--				        <id>put-feature-content</id>-->
<!--				        <phase>generate-resources</phase>-->
<!--				        <goals>-->
<!--					        <goal>run</goal>-->
<!--				        </goals>-->
<!--						<configuration>-->
<!--							<target>-->
<!--								<loadfile property="replacementsContent" srcFile="${project.build.directory}/support-generated/org.apache.karaf.features.xml" />-->
<!--								<echo>${replacementsContent}</echo>	-->
<!--								<property name="replacePattern">&lt;feature\s.*name="entaxy-underlying-replacements"[^&gt;]*&gt;.*&lt;/feature&gt;</property>-->
<!--								<replaceregexp file="src/main/features/replacements.xml" match="${replacePattern}" replace="${replacementsContent}" flags="gs" byline="false" />-->
<!--							</target>-->
<!--						</configuration>-->
<!--					</execution>-->
<!--				</executions>-->
<!--			</plugin>	           -->
  	</plugins>
  </build>  
 
  
</project>
