<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>com.googlecode.catch-exception</groupId>
  <artifactId>catch-exception</artifactId>
  <version>1.0.4</version>
  <packaging>jar</packaging>
  <name>catch-exception</name>
  <description>Catch and verify exceptions</description>
  <url>http://code.google.com/p/catch-exception/</url>

  <!--  required by Sonatype OOS hosting -->
  <parent>
    <groupId>org.sonatype.oss</groupId>
    <artifactId>oss-parent</artifactId>
    <version>7</version>
  </parent>

  <properties>
    <!-- Prevents "[WARNING] Using platform encoding (Cp1252 actually) to copy filtered 
      resources, i.e. build is platform dependent! See http://maven.apache.org/general.html#encoding-warning -->
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

    <!-- successfully tested versions: 1.4.10, 1.4.9, 1.4.8, 1.4.7, 1.4.6 -->
    <powermock.version>1.4.10</powermock.version>
    
    <!-- used by maven-license-plugin -->
    <project.inceptionYear>2011</project.inceptionYear>
  </properties>

  <dependencies>
    <!-- required runtime scope dependencies +++++++++++++++++++++++++++++++ -->
    <dependency>
        <groupId>org.mockito</groupId>
        <artifactId>mockito-core</artifactId>
        <version>1.8.5</version>
        <!-- 
          successfully tested versions: 1.8.1, 1.8.2, 1.8.3, 1.8.4, 1.8.5, 1.9.0-rc1 
          not compatible versions: 1.5, 1.6, 1.7 
         -->
    </dependency>

    <!-- optional runtime scope dependencies +++++++++++++++++++++++++++++++ -->
    <dependency>
        <groupId>org.easytesting</groupId>
        <artifactId>fest-assert</artifactId>
        <version>1.4</version>
        <optional>true</optional>
    </dependency>

    <!-- required test scope dependencies ++++++++++++++++++++++++++++++++++ -->
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.8.2</version>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>org.powermock</groupId>
      <artifactId>powermock-module-junit4</artifactId>
      <version>${powermock.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.powermock</groupId>
      <artifactId>powermock-api-mockito</artifactId>
      <version>${powermock.version}</version>
      <scope>test</scope>
    </dependency>

  </dependencies>


  <build>
    <!--
      Deploy snapshot to sonatype snapshot release repository:
      mvn clean source:jar javadoc:jar install deploy
      // the classes are signed but the source and javadoc are not signed
    
      1. Set release version.
      2. Execute: mvn clean install source:jar javadoc:jar
      3. Zip the three jars (classes, source, javadoc).
      4. Upload at google code using summary "classes, sources and javadocs"
      5. Update javadoc: "copy target/apidocs catch-exception.javadoc"
      6. "Commit catch-exception.javadoc"
      7. Set snapshot version. Increase version.
      8. "Commit catch-exception"
       -->
    <plugins>

      <!-- http://maven.apache.org/plugins/maven-source-plugin/index.html 
         mvn source:jar -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-source-plugin</artifactId>
        <version>2.1.2</version>
      </plugin>

      <!-- http://maven.apache.org/plugins/maven-javadoc-plugin/usage.html
         mvn javadoc:jar -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <version>2.8</version>
        <configuration>
          <show>private</show>
          <use>true</use>
          <overview>${basedir}/src/main/javadoc/overview/overview.html</overview>
          <linksource>true</linksource>
          <!-- is obviously redundant (but why?) <javadocDirectory>${basedir}/src/main/javadoc</javadocDirectory> -->
          <docfilessubdirs>true</docfilessubdirs>
          <stylesheetfile>${basedir}/src/main/javadoc/stylesheet/stylesheet-modified.css</stylesheetfile>
              <footer xml:space="preserve"><![CDATA[
     
<script type='text/javascript'>
/* TODO move this code to a property file or something similar */

/**
  * @author http://www.javascriptkit.com/javatutors/loadjavascriptcss.shtml
  */
function loadjscssfile(filename, filetype){
 if (filetype=='js') { /* if filename is a external JavaScript file */
   var fileref=document.createElement('script');
   fileref.setAttribute('type','text/javascript');
   fileref.setAttribute('src', filename);
 }
 else if (filetype=='css') { /* if filename is an external CSS file */
   var fileref=document.createElement('link');
   fileref.setAttribute('rel', 'stylesheet');
   fileref.setAttribute('type', 'text/css');
   fileref.setAttribute('href', filename);
 }
 if (typeof fileref!='undefined') {
   document.getElementsByTagName('head')[0].appendChild(fileref);
 }
}

function pathToRoot(belowroot, url) {
   var result = new RegExp('(.*[\\/])' + belowroot + '[\\/].*').exec(url);
   if (result == null) {
     return null; /* nothing found */
   }
   else {
     return RegExp.$1;
   }
}

/* prettyPrint(); does not work (as the code is not loaded yet?) */
var tryToRunPrettyPrint = 5;
function runPrettyPrint() {
  if (typeof prettyPrint == 'function') {
    if (console) {
       console.log("prettyPrint is available and will be started now");
    }
    prettyPrint();
    if (console) {
        console.log("prettyPrint has been successfully applied");
    }
  }
  else if (tryToRunPrettyPrint > 0) {
    tryToRunPrettyPrint = tryToRunPrettyPrint - 1;
    if (console) {
        console.log("we sleep a bit before we try to run prettyPrint again");
    }
    window.setTimeout('runPrettyPrint();',500);
  }
}

/* test: alert('roopath test:' + pathToRoot('org', 'http://apache.org/doc/org/2011/org/apache/xmlbeans/org-package.html')); */
var rootpath = pathToRoot('com', '' + window.location.href );

if (rootpath != null) {
  /* var rootpath =  '../../../'; */
  /* such an alert breaks the code. why? alert('rootpath: ' + rootpath); */
  loadjscssfile(rootpath + 'doc-files/google-code-prettify/prettify.js', 'js');
  loadjscssfile(rootpath + 'doc-files/google-code-prettify/prettify.css', 'css');

  window.setTimeout('runPrettyPrint();',500);
}
else {
    if (console) {
        console.log("no rootpath found by analysing " + window.location.href);
    }
}
</script>     
      ]]>
              </footer><!-- footer or bottom makes no difference for javascript -->
        </configuration>
      </plugin>


       <!-- 
         add headers if "maven verify" fails (due to license:check) 
        mvn license:format   -->
        <plugin>
          <groupId>com.google.code.maven-license-plugin</groupId>
          <artifactId>maven-license-plugin</artifactId>
          <version>1.4.0</version>
          <configuration>
            <header>${basedir}/src/etc/header.txt</header>
            <includes>
              <include>src/**</include>
            </includes>
            <excludes>
              <!-- exclude third party code -->
              <exclude>src/main/javadoc/doc-files/google-code-prettify/**</exclude>
              <!--  stylesheet-modified.css excluded as most of the code is from the original doclet -->
              <exclude>src/main/javadoc/stylesheet/stylesheet-modified.css</exclude>
              <!-- automatically excluded :-) <exclude>src/etc/header.txt</exclude>  -->
            </excludes>
            <useDefaultExcludes>true</useDefaultExcludes>
            <useDefaultMapping>true</useDefaultMapping>
            <properties>
              <year>${project.inceptionYear}</year>
              <email>rwoo@gmx.de</email>
            </properties>
            <encoding>UTF-8</encoding>
          </configuration>
          <executions>
            <execution>
              <goals>
                <goal>check</goal>
              </goals>
            </execution>
          </executions>
        </plugin>

        <!-- automatic signing of created artifacts (at least the classes jar)
           https://docs.sonatype.org/display/Repository/How+To+Generate+PGP+Signatures+With+Maven
           Then simply deploy your artifacts use normal maven command:
           $ mvn clean deploy -Dgpg.passphrase=yourpassphrase
           If you don’t specify the passphrase, you will be prompted for one.
            -->
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-gpg-plugin</artifactId>
          <version>1.4</version>
          <executions>
            <execution>
              <id>sign-artifacts</id>
              <phase>verify</phase>
              <goals>
                <goal>sign</goal>
              </goals>
            </execution>
          </executions>
        </plugin>

    </plugins>
  </build>
  

  <licenses>
    <license>
      <name>Apache 2</name>
      <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
      <distribution>repo</distribution>
      <comments>A business-friendly OSS license</comments>
    </license>
  </licenses>

  <developers>
    <developer>
      <id>rwoo</id>
      <name>Rod Woo</name>
      <email>rwoo@gmx.de</email>
    </developer>
  </developers>

  <scm>
    <connection>scm:hg:https://code.google.com/p/catch-exception/</connection>
    <developerConnection>scm:hg:https://code.google.com/p/catch-exception/</developerConnection>
    <url>http://code.google.com/p/catch-exception/source/browse/</url>
  </scm>

</project>