<?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">
	
  <modelVersion>4.0.0</modelVersion>
    <parent>
    <groupId>org.exoplatform.ecms</groupId>
    <artifactId>exo-ecms-docs</artifactId>
    <version>2.3.8</version>
  </parent>
  <artifactId>exo-ecms-docs-userguide</artifactId>
  <packaging>jdocbook</packaging>

  <name>ECMS documentation userguide (co-edited by RHT)</name>

  <properties>
    <translation>en-US</translation>
    <bookname>User Guide</bookname>
    <docname>User_Guide</docname>
  </properties> 

<!--
Repositories are proxied in http://repository.exoplatform.org/public, should be declared in maven settings.
<repositories>
      <repository>
          <id>jboss-public-repository-group</id>
          <name>JBoss Public Maven Repository Group</name>
          <url>https://repository.jboss.org/nexus/content/groups/public/</url>
          <layout>default</layout>
          <releases>
            <enabled>true</enabled>
            <updatePolicy>never</updatePolicy>
          </releases>
          <snapshots>
            <enabled>true</enabled>
            <updatePolicy>never</updatePolicy>
          </snapshots>
      </repository>
  </repositories>
  <pluginRepositories>
    <pluginRepository>
          <id>jboss-public-repository-group</id>
          <name>JBoss Public Maven Repository Group</name>
          <url>https://repository.jboss.org/nexus/content/groups/public/</url>
          <layout>default</layout>
          <releases>
            <enabled>true</enabled>
          </releases>
          <snapshots>
            <enabled>true</enabled>
          </snapshots>
    </pluginRepository>
 </pluginRepositories>
-->
  <profiles>
    <!-- mvn compile -->
    <profile>
      <id>all</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <build>
    		<plugins>
    			<plugin>
    				<groupId>org.jboss.maven.plugins</groupId>
    				<artifactId>maven-jdocbook-plugin</artifactId>
    				<version>2.2.1</version>
    				<extensions>true</extensions>
    				<configuration>
    				  <formats>
        				<format>
        				  <formatName>pdf</formatName>
        					<stylesheetResource>classpath:/xslt/org/jboss/pdf.xsl</stylesheetResource>
        					<finalName>${artifactId}.pdf</finalName>
        				</format>
    					  <format>
    					    <formatName>html</formatName>
    						  <stylesheetResource>classpath:/xslt/org/jboss/xhtml.xsl</stylesheetResource>
    						  <finalName>index.html</finalName>
    					  </format>
        				<format>
        				  <formatName>html_single</formatName>
        					<stylesheetResource>classpath:/xslt/org/jboss/xhtml-single.xsl</stylesheetResource>
        					<finalName>index.html</finalName>
        				</format>
    					</formats>
  					</configuration>
  				</plugin>
				</plugins>
			</build>
		</profile>

    <!-- mvn compile -Phtml -->
    <profile>
      <id>html</id>
      <activation>
        <activeByDefault>false</activeByDefault>
      </activation>
      <build>
    		<plugins>
    			<plugin>
    				<groupId>org.jboss.maven.plugins</groupId>
    				<artifactId>maven-jdocbook-plugin</artifactId>
    				<version>2.2.1</version>
    				<extensions>true</extensions>
    				<configuration>
    				  <formats>
    					  <format>
    					    <formatName>html</formatName>
    						  <stylesheetResource>classpath:/xslt/org/jboss/xhtml.xsl</stylesheetResource>
    						  <finalName>index.html</finalName>
    					  </format>
    					</formats>
  					</configuration>
  				</plugin>
				</plugins>
			</build>
		</profile>

    <!-- mvn compile -Phtml-single -->
    <profile>
      <id>html-single</id>
      <activation>
        <activeByDefault>false</activeByDefault>
      </activation>
      <build>
    		<plugins>
    			<plugin>
    				<groupId>org.jboss.maven.plugins</groupId>
    				<artifactId>maven-jdocbook-plugin</artifactId>
    				<version>2.2.1</version>
    				<extensions>true</extensions>
    				<configuration>
    				  <formats>
        				<format>
        				  <formatName>html_single</formatName>
        					<stylesheetResource>classpath:/xslt/org/jboss/xhtml-single.xsl</stylesheetResource>
        					<finalName>index.html</finalName>
        				</format>
    					</formats>
  					</configuration>
  				</plugin>
				</plugins>
			</build>
		</profile>

    <!-- mvn compile -Ppdf -->
    <profile>
      <id>pdf</id>
      <activation>
        <activeByDefault>false</activeByDefault>
      </activation>
      <build>
    		<plugins>
    			<plugin>
    				<groupId>org.jboss.maven.plugins</groupId>
    				<artifactId>maven-jdocbook-plugin</artifactId>
    				<version>2.2.1</version>
    				<extensions>true</extensions>
    				<configuration>
    				  <formats>
        				<format>
        				  <formatName>pdf</formatName>
        					<stylesheetResource>classpath:/xslt/org/jboss/pdf.xsl</stylesheetResource>
        					<finalName>${artifactId}.pdf</finalName>
        				</format>
    					</formats>
  					</configuration>
  				</plugin>
				</plugins>
			</build>
		</profile>

  </profiles>

	<build>
		<plugins>
			<plugin>
				<groupId>org.jboss.maven.plugins</groupId>
				<artifactId>maven-jdocbook-plugin</artifactId>
				<version>2.2.1</version>
				<extensions>true</extensions>
				<dependencies>
					<dependency>
						<groupId>org.jboss</groupId>
						<artifactId>jbossorg-docbook-xslt</artifactId>
            <!--Non-namespaced version for DocBook 4.5 compatibility. For XSD namespaced version, implement jbossorg-docbook-xslt-ns-->
						<version>1.1.1</version>
					</dependency>
					<dependency>
						<groupId>org.jboss</groupId>
						<artifactId>jbossorg-jdocbook-style</artifactId>
						<version>1.1.1</version>
						<type>jdocbook-style</type>
					</dependency>
				</dependencies>
				<configuration>
		      <sourceDocumentName>${docname}.xml</sourceDocumentName>
				  <sourceDirectory>${basedir}</sourceDirectory>
				  <imageResource>
					  <directory>${basedir}/${translation}</directory>
					  <includes>
						  <include>images/*</include>
					  </includes>
				  </imageResource>
				  <options>
					  <xincludeSupported>true</xincludeSupported>
					  <xmlTransformerType>saxon</xmlTransformerType>
					  <!-- needed for uri-resolvers; can be ommitted if using 'current' uri scheme -->
					  <!--     could also locate the docbook dependency and inspect its version... -->
					  <docbookVersion>1.72.0</docbookVersion>
    				<transformerParameters>
    				  <property>
    					  <name>javax.xml.parsers.DocumentBuilderFactory</name>
    						<value>org.apache.xerces.jaxp.DocumentBuilderFactoryImpl</value>
    					</property>
    					<property>
    						<name>javax.xml.parsers.SAXParserFactory</name>
    						<value>org.apache.xerces.jaxp.SAXParserFactoryImpl</value>
    					</property>
    				</transformerParameters>
    			</options>
			  </configuration>
		  </plugin>
		  
		  
     <!-- html-zip packaging -->
      <plugin>
        <artifactId>maven-assembly-plugin</artifactId>
        <configuration>
          <descriptors>
            <descriptor>src/main/assembly/html-zip.xml</descriptor>
          </descriptors>
          <appendAssemblyId>false</appendAssemblyId>
        </configuration>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>single</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <!-- Attach the doc to the pom in maven repo -->
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>add-source</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>add-source</goal>
            </goals>
            <configuration>
              <sources>
                <source>src/main/resources</source>
                <source>en-US</source>
              </sources>
            </configuration>
          </execution>
          <execution>
            <id>attach-artifacts</id>
            <phase>package</phase>
            <goals>
              <goal>attach-artifact</goal>
            </goals>
            <configuration>
              <artifacts>
                <artifact>
                  <file>target/docbook/publish/en-US/pdf/${project.artifactId}.pdf</file>
                  <type>pdf</type>
                </artifact>
                <artifact>
                  <file>target/${project.artifactId}-${project.version}.zip</file>
                  <type>zip</type>
                </artifact>
              </artifacts>
            </configuration>
          </execution>
        </executions>
      </plugin> 
	  </plugins>
  </build>

</project>
