<?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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>org.antlr</groupId>
    <artifactId>antlr-master</artifactId>
    <packaging>pom</packaging>
    <version>3.1.3</version>
    <name>ANTLR Master build control POM</name>
    <url>http://maven.apache.org</url>

  <!--
    What version of ANTLR are we building? This sets the 
    the version number for all other things that are built
    as part of an ANTLR release, unless they override or
    ignore it. We do this via a properites file for this
    pom.
    -->

  <!--
     This is the master pom for building the ANTLR
     toolset and runtime (Java) at the specific level
     defined above. Hence we specify here the modules that
     this pom will build when we build this pom
    -->

    <modules>

        <module>runtime/Java</module>
        <module>tool</module>
        <module>antlr3-maven-plugin</module>
        <module>gunit</module>
    </modules>
  <!--

    Define where the ANTLR releated jars are deployed both for
    the main ANTLR repository, which syncs with the maven main
    repository, and the snapshot repository, which can be
    used by developers that need the latest development version of
    something, but is used here to show maven where to deploy
    snapshots and releases.
    -->
    <distributionManagement>

        <repository>
            <id>antlr-repo</id>
            <name>ANTLR Testing repository</name>
            <url>scpexe://antlr.org/home/mavensync/antlr-repo</url>
        </repository>
      
        <snapshotRepository>
            <id>antlr-snapshot</id>
            <name>ANTLR Testing Snapshot Repository</name>
            <url>scpexe://antlr.org/home/mavensync/antlr-snapshot</url>
        </snapshotRepository>

    </distributionManagement>
  
  <!--
  
    Inform Maven of the ANTLR snapshot repository, which it will
    need to consult to get the latest snapshot build of the runtime
    if it was not built and installed locally.
    -->
    <repositories>

      <!--
        This is the ANTLR repository.
        -->
        <repository>
            <id>antlr-snapshot</id>
            <name>ANTLR Testing Snapshot Repository</name>
            <url>http://antlr.org/antlr-snapshot</url>
            <snapshots>
                <enabled>true</enabled>
                <updatePolicy>always</updatePolicy>
            </snapshots>
        </repository>
      
    </repositories>

  <!--

    Tell Maven which other artifacts we need in order to
    build, run and test the ANTLR jars.
    This is the master pom, and so it only contains those
    dependencies that are common to all the modules below
    or are just included for test
    -->
    <dependencyManagement>

        <dependencies>

            <dependency>
                <groupId>junit</groupId>
                <artifactId>junit</artifactId>
                <version>4.5</version>
                <scope>test</scope>
            </dependency>

            <dependency>
                <groupId>antlr</groupId>
                <artifactId>antlr</artifactId>
                <version>2.7.7</version>
                <scope>compile</scope>
            </dependency>

            <dependency>
                <groupId>org.antlr</groupId>
                <artifactId>stringtemplate</artifactId>
                <version>3.2</version>
                <scope>compile</scope>
            </dependency>

            <dependency>
                
                <groupId>org.antlr</groupId>
                <artifactId>gunit</artifactId>
                <version>3.1.3-SNAPSHOT</version>
                <scope>runtime</scope>
                
            </dependency>

        </dependencies>
        
    </dependencyManagement>

    <build>
      
        <defaultGoal>install</defaultGoal>

        <!--
            The following filter definition means that both the master
            project and the sub projects will read in a file in the same
            directory as the pom.xml is located and set any properties
            that are defined there in the standard x=y format. These
            properties can then be referenced via ${x} in any resource
            file specified in any pom. So, there is a master antlr.config
            file in the same location as this pom.xml file and here you can
            define anything that is relevant to all the modules that we
            build here. However each module also has an antlr.config file
            where you can override property values from the master file or
            define things that are only relevant to that module. 
          -->
        <filters>
            <filter>antlr.config</filter>
        </filters>

        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>
        
        <plugins>

             <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>buildnumber-maven-plugin</artifactId>
                <configuration>
                  <format>{0,date,MMM dd, yyyy} {0,time,kk:mm:ss}</format>
                  <items>
                    <item>timestamp</item>
                  </items>
                </configuration>
                <executions>
                  <execution>
                    <phase>validate</phase>
                    <goals>
                      <goal>create</goal>
                    </goals>
                  </execution>
                </executions>
             </plugin>

            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.5</source>
                    <target>1.5</target>
                    <sourceDirectory>src</sourceDirectory>
                </configuration>
            </plugin>

            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
            </plugin>

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>findbugs-maven-plugin</artifactId>
                <configuration>
                    <findbugsXmlOutput>true</findbugsXmlOutput>
                    <findbugsXmlWithMessages>true</findbugsXmlWithMessages>
                    <xmlOutput>true</xmlOutput>
                </configuration>
            </plugin>

            <plugin>

                <!--

                    Build an uber-jar for the ANTLR Tool that is packaged with all the other dependencies,
                    such as the antlr-runtime and stringtemplate etc. This will be useful
                    for developers, who then do not need to download anything else or
                    remember that they need stringtemplate.jar in their CLASSPATH and so
                    on.

                    Note that this is only the tool Uber jar as anything else is standalone.

                    The uber-jar is then self contained for developing and testing.
                    
                  -->

                <artifactId>maven-assembly-plugin</artifactId>

                <!-- 
                    Do not make the child modules build an assembly
                  -->
                <inherited>false</inherited>
           
                <configuration>
                    <descriptors>
                        <descriptor>antlrjar.xml</descriptor>
                    </descriptors>
                        <!--

                            Specify that we want the resulting jar to be executable
                            via java -jar, which we do by modifying the manifest
                            of course.
                          -->
                    <archive>
                        <manifest>
                            <mainClass>org.antlr.Tool</mainClass>
                        </manifest>
                    </archive>
                </configuration>



            </plugin>

        </plugins>

        <extensions>
            <extension>
                <groupId>org.apache.maven.wagon</groupId>
                <artifactId>wagon-ssh-external</artifactId>
                <version>1.0-beta-2</version>
            </extension>
        </extensions>

    </build>
</project>
