<?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>
  <groupId>org.clojure</groupId>
  <artifactId>clojure</artifactId>
  <name>clojure</name>
  <packaging>jar</packaging>
  <version>1.12.0</version>

  <url>http://clojure.org/</url>
  <description>Clojure core environment and runtime library.</description>

  <developers>
    <developer>
      <name>Rich Hickey</name>
      <email>richhickey@gmail.com</email>
      <timezone>-5</timezone>
    </developer>
  </developers>

  <licenses>
    <license>
      <name>Eclipse Public License 1.0</name>
      <url>http://opensource.org/licenses/eclipse-1.0.php</url>
      <distribution>repo</distribution>
    </license>
  </licenses>

  <scm>
    <connection>scm:git:git@github.com:clojure/clojure.git</connection>
    <developerConnection>scm:git:git@github.com:clojure/clojure.git</developerConnection>
    <url>git@github.com:clojure/clojure.git</url>
    <tag>clojure-1.12.0</tag>
  </scm>

  <properties>
    <directlinking>true</directlinking>
  </properties>

  <dependencies>
    <dependency>
      <groupId>org.clojure</groupId>
      <artifactId>spec.alpha</artifactId>
       <version>0.5.238</version>
    </dependency>
    <dependency>
      <groupId>org.clojure</groupId>
      <artifactId>core.specs.alpha</artifactId>
      <version>0.4.74</version>
    </dependency>
    <dependency>
      <groupId>org.clojure</groupId>
      <artifactId>test.generative</artifactId>
      <version>1.1.0</version>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <groupId>org.clojure</groupId>
          <artifactId>clojure</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.clojure</groupId>
      <artifactId>test.check</artifactId>
      <version>1.1.1</version>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <groupId>org.clojure</groupId>
          <artifactId>clojure</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>javax.xml.ws</groupId>
      <artifactId>jaxws-api</artifactId>
      <version>2.3.1</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <distributionManagement>
    <snapshotRepository>
      <!-- This id is linked to the key setup on the CI server -->
      <id>sonatype-nexus-staging</id>
      <url>https://oss.sonatype.org/content/repositories/snapshots</url>
    </snapshotRepository>
  </distributionManagement>

  <build>
    <resources>
      <resource>
	<directory>src/resources</directory>
	<filtering>true</filtering>
      </resource>
      <resource>
	<directory>src/clj</directory>
      </resource>
    </resources>
    <testSourceDirectory>test/java</testSourceDirectory>
    <plugins>
      <plugin>
	<groupId>org.apache.maven.plugins</groupId>
	<artifactId>maven-compiler-plugin</artifactId>
	<version>3.13.0</version>
	<configuration>
	  <source>1.8</source>
	  <target>1.8</target>
	  <encoding>UTF-8</encoding>
	</configuration>
      </plugin>
      <plugin>
	<artifactId>maven-antrun-plugin</artifactId>
	<version>3.1.0</version>
	<executions>
	  <execution>
	    <id>clojure-compile</id>
	    <phase>compile</phase>
	    <goals>
	      <goal>run</goal>
	    </goals>
	    <configuration>
	      <target>
                <property name="maven.compile.classpath" refid="maven.compile.classpath" />
		<ant target="compile-clojure" />
	      </target>
	    </configuration>
	  </execution>
	  <execution>
	    <id>clojure-test</id>
	    <phase>test</phase>
	    <goals>
	      <goal>run</goal>
	    </goals>
	    <configuration>
	      <target>
                <property name="maven.test.classpath" refid="maven.test.classpath" />
		<ant target="test" />
	      </target>
	    </configuration>
	  </execution>
	</executions>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <version>3.5.0</version>
        <executions>
          <execution>
            <id>add-clojure-source-dirs</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>add-source</goal>
            </goals>
            <configuration>
              <sources>
		<source>src/jvm</source>
              </sources>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
	<artifactId>maven-assembly-plugin</artifactId>
        <version>3.7.1</version>
	<executions>
	  <execution>
	    <id>clojure-slim-jar</id>
	    <phase>package</phase>
	    <goals>
	      <goal>single</goal>
	    </goals>
	    <configuration>
	      <descriptors>
		<descriptor>src/assembly/slim.xml</descriptor>
	      </descriptors>
	    </configuration>
	  </execution>
	</executions>
      </plugin>
      <plugin>
	<artifactId>maven-jar-plugin</artifactId>
	<version>3.4.1</version>
      </plugin>
      <plugin>
	<artifactId>maven-source-plugin</artifactId>
	<version>3.3.1</version>
	<executions>
	  <execution>
	    <id>attach-sources</id>
	    <phase>package</phase>
	    <goals>
	      <goal>jar</goal>
	    </goals>
            <configuration>
              <excludes>
                <exclude>clojure/version.properties</exclude>
              </excludes>
            </configuration>
	  </execution>
	</executions>
      </plugin>
      <plugin>
	<!-- do not push SCM changes to upstream repository;
	     prevents pushing tags/commits for failed releases;
	     instead, push SCM changes in Hudson configuration -->
	<groupId>org.apache.maven.plugins</groupId>
	<artifactId>maven-release-plugin</artifactId>
	<version>3.0.1</version>
	<configuration>
	  <pushChanges>false</pushChanges>
	  <localCheckout>true</localCheckout>
	</configuration>
      </plugin>
      <plugin>
	<!-- disable the Surefire testing plugin -->
	<groupId>org.apache.maven.plugins</groupId>
	<artifactId>maven-surefire-plugin</artifactId>
	<version>3.2.5</version>
	<configuration>
	  <skip>true</skip>
	</configuration>
      </plugin>

      <!-- deploy artifacts to sonatype -->
      <plugin>
        <groupId>org.sonatype.plugins</groupId>
        <artifactId>nexus-staging-maven-plugin</artifactId>
        <version>1.6.13</version>
        <extensions>true</extensions>
        <configuration>
          <!-- The server "id" element from settings to use authentication from -->
          <serverId>sonatype-nexus-staging</serverId>
          <nexusUrl>https://oss.sonatype.org/</nexusUrl>
          <autoReleaseAfterClose>true</autoReleaseAfterClose>
        </configuration>
      </plugin>

    </plugins>
  </build>

  <profiles>
    <!-- Use "mvn -Ptest-direct" or "mvn -Ptest-no-direct" to choose testing with direct linking -->
    <profile>
      <id>test-direct</id>
      <properties>
        <directlinking>true</directlinking>
      </properties>
    </profile>
    <profile>
      <id>test-no-direct</id>
      <properties>
        <directlinking>false</directlinking>
      </properties>
    </profile>
    <profile>
      <!-- "mvn -Pdistribution package" builds a .zip file -->
      <id>distribution</id>
      <build>
	<plugins>
	  <plugin>
	    <artifactId>maven-assembly-plugin</artifactId>
	    <version>3.7.1</version>
	    <executions>
	      <execution>
		<id>clojure-distribution</id>
		<phase>package</phase>
		<goals>
		  <goal>single</goal>
		</goals>
		<configuration>
		  <appendAssemblyId>false</appendAssemblyId>
		  <descriptors>
		    <descriptor>src/assembly/distribution.xml</descriptor>
		  </descriptors>
		</configuration>
	      </execution>
	    </executions>
	  </plugin>
	</plugins>
      </build>
    </profile>
    <profile>
      <!-- sign artifacts for deployment -->
      <id>sign</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <version>3.2.4</version>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <phase>verify</phase>
                <goals>
                  <goal>sign</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>local</id>
      <dependencies>
        <dependency>
          <groupId>org.clojure</groupId>
          <artifactId>test.check</artifactId>
          <version>1.1.1</version>
          <exclusions>
            <exclusion>
              <groupId>org.clojure</groupId>
              <artifactId>clojure</artifactId>
            </exclusion>
          </exclusions>
        </dependency>
      </dependencies>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-shade-plugin</artifactId>
            <version>3.5.3</version>
            <executions>
              <execution>
                <phase>package</phase>
                <goals>
                  <goal>shade</goal>
                </goals>
                <configuration>
                  <transformers>
                    <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                      <mainClass>clojure.main</mainClass>
                    </transformer>
                  </transformers>
		  <outputFile>clojure.jar</outputFile>
		</configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
