<?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>no.nav.modig</groupId>
        <artifactId>modig-frontend</artifactId>
        <version>1.1.122</version>
    </parent>

    <artifactId>modig-frontend-ressurser</artifactId>
    <packaging>jar</packaging>

    <name>${project.artifactId}</name>
    <description>
        Dette biblioteket inneholder statiske ressurser for felles utseende og oppførsel i moderniserte applikasjoner i NAV.
    </description>

    <build>
        <resources>
            <resource>
                <filtering>false</filtering>
                <directory>src/main/resources</directory>
            </resource>
            <resource>
                <filtering>false</filtering>
                <directory>src/main/generated-resources/img/enonic</directory>
                <targetPath>img/enonic</targetPath>
            </resource>
            <resource>
                <filtering>false</filtering>
                <directory>src/main/generated-resources/img/appres/legacy</directory>
                <targetPath>img/appres/legacy</targetPath>
            </resource>
            <resource>
                <filtering>false</filtering>
                <directory>src/main/generated-resources/css/enonic</directory>
                <targetPath>css/enonic</targetPath>
            </resource>
            <resource>
                <filtering>false</filtering>
                <directory>src/main/generated-resources/js/enonic/navno</directory>
                <targetPath>js/enonic/navno</targetPath>
            </resource>
            <resource>
                <filtering>false</filtering>
                <directory>src/main/generated-resources/js/enonic/skjemaveileder</directory>
                <targetPath>js/enonic/skjemaveileder</targetPath>
            </resource>

            <resource>
                <filtering>false</filtering>
                <directory>src/main/generated-resources/css/appres</directory>
                <targetPath>css/appres</targetPath>
            </resource>
            <resource>
                <filtering>false</filtering>
                <directory>src/main/generated-resources/js/appres</directory>
                <targetPath>js/appres</targetPath>
            </resource>
        </resources>

        <plugins>
	        <plugin>
		        <groupId>org.codehaus.mojo</groupId>
		        <artifactId>properties-maven-plugin</artifactId>
		        <version>1.0-alpha-2</version>
		        <executions>
			        <execution>
				        <phase>initialize</phase>
				        <goals>
					        <goal>read-project-properties</goal>
				        </goals>
				        <configuration>
					        <files>
						        <file>path_til_node.properties</file>
					        </files>
				        </configuration>
			        </execution>
		        </executions>
	        </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>1.2.1</version>
                <configuration>
                    <executable>${pathTilNode}</executable>
                    <arguments>
                        <argument>src/main/nodejs/build-frontend.js</argument>
                        <argument>${basedir}</argument>
                    </arguments>
                </configuration>
                <executions>
                    <execution>
                        <id>build-bootstrap</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>build-frontend-and-copy-to-enonic</id>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-antrun-plugin</artifactId>
                        <version>1.7</version>
                        <configuration>
                            <target name="UploadToDev" description="Laster opp de genererte ressursene til Enonics filsystem i utviklingsmiljøet.">
                                <scp todir="admin@portal-admin-u1.adeo.no:/dav/scp-test/" password="password" trust="true">
                                    <fileset dir="${basedir}/src/main/generated-resources/" />
                                </scp>
                            </target>
                        </configuration>
                        <executions>
                            <execution>
                                <phase>process-resources</phase>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                            </execution>
                        </executions>
                        <dependencies>
                            <dependency>
                                <groupId>org.apache.ant</groupId>
                                <artifactId>ant-jsch</artifactId>
                                <version>1.9.2</version>
                            </dependency>
                            <dependency>
                                <groupId>jsch</groupId>
                                <artifactId>jsch</artifactId>
                                <version>0.1.44</version>
                            </dependency>
                        </dependencies>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
