<!--
    Licensed to the Apache Software Foundation (ASF) under one
    or more contributor license agreements.  See the NOTICE file
    distributed with this work for additional information
    regarding copyright ownership.  The ASF licenses this file
    to you under the Apache License, Version 2.0 (the
    "License"); you may not use this file except in compliance
    with the License.  You may obtain a copy of the License at
    
    http://www.apache.org/licenses/LICENSE-2.0
    
    Unless required by applicable law or agreed to in writing,
    software distributed under the License is distributed on an
    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    KIND, either express or implied.  See the License for the
    specific language governing permissions and limitations
    under the License.
-->
<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>
  <parent>
    <groupId>org.apache.felix</groupId>
    <artifactId>felix-parent</artifactId>
    <version>3</version>
    <relativePath>../../pom/pom.xml</relativePath>
  </parent>

  <artifactId>org.apache.felix.webconsole.plugins.scriptconsole</artifactId>
  <packaging>bundle</packaging>
  <version>1.0.2</version>

  <name>Apache Felix Script Console Plugin</name>
  <description>
      Apache Felix Script Console Plugin allows invocation of script through Felix Web Console UI. Refer to
      http://felix.apache.org/documentation/subprojects/apache-felix-script-console-plugin.html for more details.
  </description>

  <properties>
    <pax-exam.version>4.6.0</pax-exam.version>
    <bundle.build.name>
      ${basedir}/target
    </bundle.build.name>
    <bundle.file.name>
      ${bundle.build.name}/${project.build.finalName}.jar
    </bundle.file.name>
    <felix.java.version>6</felix.java.version>
  </properties>

  <scm>
    <connection>scm:svn:http://svn.apache.org/repos/asf/felix/releases/org.apache.felix.webconsole.plugins.scriptconsole-1.0.2</connection>
    <developerConnection>
        scm:svn:https://svn.apache.org/repos/asf/felix/releases/org.apache.felix.webconsole.plugins.scriptconsole-1.0.2
    </developerConnection>
    <url>http://svn.apache.org/viewvc/felix/releases/org.apache.felix.webconsole.plugins.scriptconsole-1.0.2</url>
  </scm>

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <version>2.5.3</version>
        <extensions>true</extensions>
        <configuration>
          <instructions>
            <Bundle-Category>osgi</Bundle-Category>
            <Bundle-SymbolicName>
              ${project.artifactId}
            </Bundle-SymbolicName>
            <Import-Package>
                  org.json.*;version=0,
                  javax.servlet.*;version=2.3,
                  org.apache.commons.io; version="[1.4,3)",
                  *
            </Import-Package>
            <Bundle-Activator>
              org.apache.felix.webconsole.plugins.scriptconsole.internal.Activator
            </Bundle-Activator>
          </instructions>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.rat</groupId>
        <artifactId>apache-rat-plugin</artifactId>
        <configuration>
          <includes>
            <include>src/**</include>
          </includes>
          <excludes>
            <exclude>src/main/appended-resources/**</exclude>
            <exclude>src/main/resources/res/ui/codemirror/**</exclude>
            <exclude>src/main/resources/res/ui/*.*</exclude>
            <exclude>src/main/resources/templates/*.*</exclude>
            <exclude>src/test/resources/*.*</exclude>
          </excludes>
        </configuration>
      </plugin>

      <!-- Required for pax exam-->

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <version>1.8</version>
        <executions>
          <execution>
            <id>reserve-network-port</id>
            <goals>
              <goal>reserve-network-port</goal>
            </goals>
            <phase>pre-integration-test</phase>
            <configuration>
              <portNames>
                <portName>http.port</portName>
              </portNames>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.servicemix.tooling</groupId>
        <artifactId>depends-maven-plugin</artifactId>
        <version>1.2</version>
        <executions>
          <execution>
            <id>generate-depends-file</id>
            <goals>
              <goal>generate-depends-file</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <!-- integration tests run with pax-exam -->
      <plugin>
        <artifactId>maven-failsafe-plugin</artifactId>
        <version>2.12</version>
        <executions>
          <execution>
            <goals>
              <goal>integration-test</goal>
              <goal>verify</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <systemPropertyVariables>
            <coverage.command>${coverage.command}</coverage.command>
            <http.port>${http.port}</http.port>
            <project.bundle.file>${bundle.file.name}</project.bundle.file>
          </systemPropertyVariables>
          <forkMode>always</forkMode>
          <parallel>none</parallel>
          <threadCount>1</threadCount>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <dependencies>
    <!-- Need to keep first to override conflicts in core and
    compendium jars-->
    <dependency>
      <groupId>org.apache.felix</groupId>
      <artifactId>org.apache.felix.framework</artifactId>
      <version>5.4.0</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.osgi</groupId>
      <artifactId>org.osgi.core</artifactId>
      <version>4.2.0</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.osgi</groupId>
      <artifactId>org.osgi.compendium</artifactId>
      <version>4.2.0</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>servlet-api</artifactId>
      <version>2.4</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>commons-io</groupId>
      <artifactId>commons-io</artifactId>
      <version>1.4</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.felix</groupId>
      <artifactId>org.apache.felix.webconsole</artifactId>
      <version>3.1.8</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.json</groupId>
      <artifactId>json</artifactId>
      <version>20070829</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>commons-fileupload</groupId>
      <artifactId>commons-fileupload</artifactId>
      <version>1.2.1</version>
      <scope>provided</scope>
    </dependency>


    <!-- testing -->
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <scope>test</scope>
      <version>4.10</version>
    </dependency>
    <!-- Pax Exam Dependencies -->
    <dependency>
      <groupId>org.ops4j.pax.exam</groupId>
      <artifactId>pax-exam-container-native</artifactId>
      <version>${pax-exam.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.ops4j.pax.exam</groupId>
      <artifactId>pax-exam-junit4</artifactId>
      <version>${pax-exam.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.ops4j.pax.exam</groupId>
      <artifactId>pax-exam-link-mvn</artifactId>
      <version>${pax-exam.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.ops4j.pax.url</groupId>
      <artifactId>pax-url-wrap</artifactId>
      <version>2.4.3</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>javax.inject</groupId>
      <artifactId>javax.inject</artifactId>
      <version>1</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-simple</artifactId>
      <version>1.6.0</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.felix</groupId>
      <artifactId>org.apache.felix.configadmin</artifactId>
      <version>1.6.0</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.felix</groupId>
      <artifactId>org.apache.felix.http.jetty</artifactId>
      <version>2.2.0</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.sling</groupId>
      <artifactId>org.apache.sling.testing.tools</artifactId>
      <version>1.0.2</version>
      <scope>test</scope>
    </dependency>
  </dependencies>


  <profiles>
    <!--
        copy the package such that IDEs may easily use it without
        setting the system property
    -->
    <profile>
      <id>ide</id>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-antrun-plugin</artifactId>
            <version>1.7</version>
            <executions>
              <execution>
                <id>scr-file-create</id>
                <phase>package</phase>
                <goals>
                  <goal>run</goal>
                </goals>
                <configuration>
                  <target>
                    <copy file="${project.build.directory}/${project.build.finalName}.jar" tofile="${project.build.directory}/scriptconsole.jar" />
                  </target>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>coverage</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.jacoco</groupId>
            <artifactId>jacoco-maven-plugin</artifactId>
            <version>0.6.2.201302030002</version>
            <executions>
              <execution>
                <id>prepare-agent</id>
                <goals>
                  <goal>prepare-agent</goal>
                </goals>
                <configuration>
                  <propertyName>coverage.command</propertyName>
                  <includes>
                    <include>org.apache.felix.jaas.*</include>
                  </includes>
                  <excludes>
                    <exclude>org.apache.felix.jaas.integration.*</exclude>
                  </excludes>
                </configuration>
              </execution>
              <execution>
                <id>report</id>
                <phase>post-integration-test</phase>
                <goals>
                  <goal>report</goal>
                </goals>
              </execution>
              <execution>
                <id>check</id>
                <goals>
                  <goal>check</goal>
                </goals>
                <configuration>
                  <check>
                    <classRatio>100</classRatio>
                    <instructionRatio>90</instructionRatio>
                    <methodRatio>95</methodRatio>
                    <branchRatio>85</branchRatio>
                    <complexityRatio>85</complexityRatio>
                    <lineRatio>90</lineRatio>
                  </check>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>