<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.platform.runtime</groupId>
    <artifactId>base</artifactId>
    <version>1.10.1</version>
  </parent>
  <groupId>ru.entaxy.platform</groupId>
  <artifactId>logging</artifactId>
  <packaging>pom</packaging>
  <name>ENTAXY :: LOGGING</name>
  <description>ENTAXY :: LOGGING</description>
  <modules>
  	<module>cef-logger-layout</module>
  	<module>entaxy-audit</module>
  </modules>
  
  
  <profiles>
		<profile>
			<id>combine-logging-cfg</id>
			<activation>
				<activeByDefault>false</activeByDefault>
	                <file>
	                    <exists>src/main/cfg/org.ops4j.pax.logging.cfg</exists>
	                </file>
			</activation>
			
  <build>
	<plugins>
		<plugin>
			<groupId>org.apache.maven.plugins</groupId>
			<artifactId>maven-dependency-plugin</artifactId>
			<executions>
				<execution>
					<id>copy-logging-from-underlying</id>
					<phase>prepare-package</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>cfg</type>
                                    <classifier>org.ops4j.pax.logging</classifier>
                                    <overWrite>true</overWrite>
                                    <outputDirectory>${project.build.directory}/combine-logging</outputDirectory>
                                    <destFileName>1.cfg</destFileName>
                                </artifactItem>
						</artifactItems>
					</configuration>
				</execution>
			</executions>
		</plugin>
		
		<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <executions>
                    <!--
                        combine org.ops4j.pax.logging from underlying with local one
                    -->

                    <execution>
                        <id>combine_logging_cfg</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <target>
								<copy file="${project.build.directory}/attach-resources/resources/cfg/org.ops4j.pax.logging.cfg"
                                    tofile="${project.build.directory}/combine-logging/2.cfg" />
                                <delete file="${project.build.directory}/attach-resources/resources/cfg/org.ops4j.pax.logging.cfg"/>
                                <concat destfile="${project.build.directory}/attach-resources/resources/cfg/org.ops4j.pax.logging.cfg"
                                        force="yes">
                                    <fileset dir="${project.build.directory}/combine-logging">
                                        <include name="**/*.cfg"></include>
                                    </fileset>
                                </concat>
                                <!-- copy file="${project.build.directory}/tmp/startup.properties"
                                    tofile="${project.build.directory}/assembly/etc/startup.properties" / -->
                            </target>

                        </configuration>
                    </execution>
                </executions>
            </plugin>		
	</plugins>
  </build>
			
			
		</profile>
  </profiles>
	
  
  
  
</project>
