<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>MOA.id</groupId>
    <artifactId>moa-id</artifactId>
    <version>3.x</version>
  </parent>
  
  <groupId>MOA.id.server</groupId>
  <artifactId>moa-id-frontend-resources</artifactId>
  <version>${moa-id-version}</version>  
  <packaging>jar</packaging>
  
  <name>MOA-ID-Auth FrontEnd-Resources</name>
  <description>FrontEnd resources for MOA-ID-Auth </description>
  <organization>
  	<name>EGIZ</name>
  	<url>https://www.egiz.gv.at</url>
  </organization>
  <developers>
  	<developer>
  		<name>Thomas Lenz</name>
  		<organization>EGIZ</organization>
  		<email>thomas.lenz@egiz.gv.at</email>
  	</developer>
  </developers>
  
 	<properties>
		<repositoryPath>${basedir}/../../../../repository</repositoryPath>
	</properties>
  
  <build>
  	<plugins>
  	<plugin>
    	<groupId>org.codehaus.mojo</groupId>
    	<artifactId>groovy-maven-plugin</artifactId>
    	<version>1.5</version>
    <executions>
      <execution>
        <phase>generate-resources</phase>
        <goals>
          <goal>execute</goal>
        </goals>
        <configuration>
          <source>
        	<![CDATA[
        	println("==== Creating version.txt ====");
        	File mainDir = new File("${basedir}/src/main/resources");
        	if(mainDir.exists() && !mainDir.isDirectory()) {
            println("Main dir does not exist, wont create version.txt!");
            return;
        	}
        	File confDir = new File("${basedir}/src/main/resources/mainGUI");
        	if(confDir.exists() && !confDir.isDirectory()) {
            println("Conf dir is not a directory, wont create version.txt!");
            return;
        	}
        	if(!confDir.exists()) {
            confDir.mkdir();
        	}
        	File versionFile = new File("${basedir}/src/main/resources/mainGUI/version.txt");
        	if(versionFile.exists() && versionFile.isDirectory()) {
            println("Version file exists and is directory! Wont overwrite");
            return;
        	}
        	if(versionFile.exists() && !versionFile.isDirectory()) {
          	 println("Version file already exists, overwriting!");
        	}
        	println("Creating Version File");
        	BufferedWriter writer = new BufferedWriter(new FileWriter(versionFile));

        	writer.write("groupId = ${project.groupId}");
        	writer.newLine();
        	writer.write("version = ${project.version}");
        	writer.newLine();
        	writer.write("timestamp = ${maven.build.timestamp}");

        	String buildTag = "";
        	String buildNumber = "";
        	String buildId = "";
        	try {
            	buildTag = "${BUILD_TAG}";
            	buildNumber = "${BUILD_NUMBER}";
            	buildId = "${BUILD_ID}";

            	writer.write("BUILD_TAG = " + buildTag + "\n");
            	writer.write("BUILD_NUMBER = " + buildNumber + "\n");
            	writer.write("BUILD_ID = " + buildId + "\n");

        		} catch (Exception e) {
            		println("============= Could not find BUILD_TAG probably this is not a Jenkins/Hudson build ===========");
        		}

        		writer.close();
        		]]>
          		</source>
        		</configuration>
      		</execution>
    		</executions>
  		</plugin>
  	</plugins>
  </build>
  
  <dependencies>  	
   	 <dependency>
  		<groupId>MOA.id.server</groupId>
  		<artifactId>moa-id-commons</artifactId>
  	</dependency>
  	<dependency>
    	<groupId>at.gv.egiz.eaaf</groupId>
		<artifactId>eaaf-core</artifactId>
    </dependency> 
  	
  	<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-webmvc</artifactId>
			<exclusions>
				<exclusion>
					<groupId>commons-logging</groupId>
					<artifactId>commons-logging</artifactId>
				</exclusion>
			</exclusions>
  	</dependency>
  	
  	<dependency>
			<groupId>org.apache.velocity</groupId>
			<artifactId>velocity</artifactId>
			<version>1.7</version>
		</dependency>
  	
  	<dependency>
			<groupId>javax.servlet</groupId>
			<artifactId>javax.servlet-api</artifactId>
			<scope>provided</scope>
		</dependency>
		
		
  </dependencies>
  
</project>