<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
		 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  <groupId>edu.wpi.first.wpilibj</groupId>
  <artifactId>wpilibJavaFinal</artifactId>
  <packaging>jar</packaging>
  <version>0.1.0-SNAPSHOT</version>
  
  <parent>
    <groupId>edu.wpi.first.wpilib.templates.athena</groupId>
    <artifactId>library-jar</artifactId>
    <version>0.1.0-SNAPSHOT</version>
    <relativePath>../../maven-utilities/athena/library-jar/pom.xml</relativePath>
  </parent>

  <repositories>
    <!-- repository>
      <id>sonatype</id>
      <name>Sonatype OSS Snapshots Repository</name>
      <url>http://oss.sonatype.org/content/groups/public</url>
    </repository -->
    <!-- For old snapshots, please use groupId `com.jnaerator` and the following repo -->
    <!-- repository>
      <id>nativelibs4java-repo</id>
      <url>http://nativelibs4java.sourceforge.net/maven</url>
    </repository -->
  </repositories>
  
  <dependencies>
	<dependency>
		<groupId>edu.wpi.first.wpilibj</groupId>
		<artifactId>wpilibJava</artifactId>
		<version>0.1.0-SNAPSHOT</version>
	</dependency>
	<dependency>
		<groupId>edu.wpi.first.wpilibj</groupId>
		<artifactId>wpilibJavaJNI</artifactId>
		<version>0.1.0-SNAPSHOT</version>
		<type>so</type>
	</dependency>
  </dependencies>

  <build>
	<plugins>
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-antrun-plugin</artifactId>
        <version>1.7</version>
        <executions>
          <execution>
            <id>extract-java-jar</id>
            <goals>
              <goal>run</goal>
            </goals>
            <phase>generate-sources</phase>
            <configuration>
              <target>
                <taskdef resource="net/sf/antcontrib/antcontrib.properties"
                            classpathref="maven.plugin.classpath" />

                <property name="mvn.wpilibJava.jar.path" value="${edu.wpi.first.wpilibj:wpilibJava:jar}"/>

                <available file="${mvn.wpilibJava.jar.path}" type="file" property="mvn.wpilibJava.jar.isfile" />

                <if>
                  <isset property="mvn.wpilibJava.jar.isfile" />
                  <then>
                    <unzip src="${mvn.wpilibJava.jar.path}" dest="${project.build.directory}/classes" />
                  </then>
                  <else>
                    <copy todir="${project.build.directory}/classes" >
                          <fileset dir="${mvn.wpilibJava.jar.path}" />  
                    </copy>
                  </else>
                </if>
              </target>
            </configuration>
          </execution>

          <execution>
            <id>copy-jni-so</id>
            <goals>
              <goal>run</goal>
            </goals>
            <phase>generate-sources</phase>
            <configuration>
              <target>
                  <copy todir="${project.build.directory}/classes/linux-arm" 
                        file="${edu.wpi.first.wpilibj:wpilibJavaJNI:so}" />  
              </target>
            </configuration>
          </execution>

          
        </executions>
        <dependencies>
          <dependency>
                  <groupId>ant-contrib</groupId>
                  <artifactId>ant-contrib</artifactId>
                  <version>1.0b3</version>
                  <exclusions>
                <exclusion>
                    <groupId>ant</groupId>
                    <artifactId>ant</artifactId>
                  </exclusion>
              </exclusions>
              </dependency>
        </dependencies>
      </plugin>


	  <!-- <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <version>2.8</version>
        <executions>
          <execution>
          <id>unpack</id>
          <phase>generate-sources</phase>
          <goals>
            <goal>unpack</goal>
          </goals>
          <configuration>
            <artifactItems>
              <artifactItem>
      				  <groupId>edu.wpi.first.wpilibj</groupId>
      				  <artifactId>wpilibJava</artifactId>
      				  <version>0.1.0-SNAPSHOT</version>
      				  <type>jar</type>
              </artifactItem>
            </artifactItems>
            <outputDirectory>${project.build.directory}/classes</outputDirectory>
          </configuration>
          </execution>
         <execution>
            <id>fetch-dependencies</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>copy</goal>
            </goals>
            <configuration>
              <artifactItems>
                <artifactItem>
        				  <groupId>edu.wpi.first.wpilibj</groupId>
        				  <artifactId>wpilibJavaJNI</artifactId>
        				  <version>0.1.0-SNAPSHOT</version>
        				  <type>so</type>
        				  <destFileName>libwpilibJavaJNI.so</destFileName>
        				  <outputDirectory>${project.build.directory}/classes/linux-arm</outputDirectory>
                </artifactItem>
               COMMENT BEGIN <artifactItem>
				  <groupId>edu.wpi.first.wpilib.hal</groupId>
				  <artifactId>libHALAthenaJava</artifactId>
				  <version>0.1.0-SNAPSHOT</version>
				  <type>so</type>
				  <destFileName>libHALAthenaJava.so</destFileName>
				  <outputDirectory>${project.build.directory}/classes/linux-arm</outputDirectory>
                </artifactItem> COMMENT END
              </artifactItems>
              <overWriteReleases>false</overWriteReleases>
              <overWriteSnapshots>true</overWriteSnapshots>
            </configuration>
          </execution>
        </executions>
      </plugin> -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-install-plugin</artifactId>
        <version>2.5.1</version>
        <executions>
          <execution>
          <id>install-jar</id>
          <phase>install</phase>
          <goals>
            <goal>install</goal>
          </goals>
          </execution>
        </executions>
      </plugin>
	</plugins>
	<pluginManagement>
		<plugins>
			<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
			<plugin>
				<groupId>org.eclipse.m2e</groupId>
				<artifactId>lifecycle-mapping</artifactId>
				<version>1.0.0</version>
				<configuration>
					<lifecycleMappingMetadata>
						<pluginExecutions>
							<pluginExecution>
								<pluginExecutionFilter>
									<groupId>
										org.apache.maven.plugins
									</groupId>
									<artifactId>
										maven-dependency-plugin
									</artifactId>
									<versionRange>[2.8,)</versionRange>
									<goals>
										<goal>copy</goal>
									</goals>
								</pluginExecutionFilter>
								<action>
									<execute />
								</action>
							</pluginExecution>
							<pluginExecution>
								<pluginExecutionFilter>
									<groupId>org.apache.maven.plugins</groupId>
        							<artifactId>maven-dependency-plugin</artifactId>
									<versionRange>[2.8,)</versionRange>
									<goals>
										<goal>unpack</goal>
									</goals>
								</pluginExecutionFilter>
								<action>
									<ignore />
								</action>
							</pluginExecution>
						</pluginExecutions>
					</lifecycleMappingMetadata>
				</configuration>
			</plugin>
		</plugins>
	</pluginManagement>
  </build>
</project>
