<?xml version="1.0" encoding="UTF-8"?>
<!--
 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>9</version>
        <relativePath />
    </parent>

    <artifactId>org.apache.felix.configadmin</artifactId>
    <version>1.10.0</version>
    <packaging>bundle</packaging>

    <name>Apache Felix Configuration Admin Service</name>
    <description>
        Implementation of the OSGi Configuration Admin Service Specification 1.6
    </description>

    <scm>
        <connection>scm:git:https://github.com/apache/felix-dev.git</connection>
        <developerConnection>scm:git:https://github.com/apache/felix-dev.git</developerConnection>
        <url>https://gitbox.apache.org/repos/asf?p=felix-dev.git</url>
      <tag>org.apache.felix.configadmin-1.10.0</tag>
  </scm>

    <!--
        A Note on Testing
        =================
        
        This project contains two kinds of tests: regular unit tests running
        in the test phase and integration tests based on PAX Exam running
        in the integration-test phase.
        
        Basically the complete project is build using Java 7 source and target
	compatibility as inherited by the parent pom.
        
        For running the integration tests from the console using Maven nothing
        special has to be done as the tests run automatically. To run the tests
        in your IDE, the project has to be built to the "package" phase with
        the profile "ide" enabled:
        
             $ mvn -Pide clean package
             
        This creates the configadmin.jar file in the target folder, which is used by
        the integration tests when run from the IDE. Alternatively the
        "project.bundle.file" system property may be set to the bundle JAR
        in the IDE launcher. 
    -->
    <properties>
        <bundle.build.name>
            ${basedir}/target
        </bundle.build.name>
        <bundle.file.name>
            ${bundle.build.name}/${project.build.finalName}.jar
        </bundle.file.name>
        <!-- Sibling Felix bundles the tests run against. Pinned to the latest release
             so this module also builds on its own; CI overrides them with the locally
             built versions so the tests exercise the code in this repository.
             See FELIX-6870. -->
        <felix.framework.version>7.0.5</felix.framework.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>osgi.annotation</artifactId>
            <version>6.0.1</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>org.osgi.core</artifactId>
            <version>6.0.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>org.osgi.service.cm</artifactId>
            <version>1.6.0</version>
           <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>org.osgi.service.log</artifactId>
            <version>1.3.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>org.osgi.service.coordinator</artifactId>
            <version>1.0.2</version>
            <scope>provided</scope>
        </dependency>
        
        <!-- Integration Testing with Pax Exam -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.13.2</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <version>4.8.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.ops4j.pax.exam</groupId>
            <artifactId>pax-exam-junit4</artifactId>
            <version>4.13.3</version>
            <scope>test</scope>
        </dependency>
        <!-- The forked container is needed so that we can use Java security in the tests -->
        <dependency>
            <groupId>org.ops4j.pax.exam</groupId>
            <artifactId>pax-exam-container-forked</artifactId>
            <version>4.13.3</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.ops4j.pax.exam</groupId>
            <artifactId>pax-exam-link-mvn</artifactId>
            <version>4.13.3</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.ops4j.pax.url</groupId>
            <artifactId>pax-url-aether</artifactId>
            <version>2.6.12</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.ops4j.pax.tinybundles</groupId>
            <artifactId>tinybundles</artifactId>
            <version>1.0.0</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.geronimo.specs</groupId>
            <artifactId>geronimo-atinject_1.0_spec</artifactId>
            <version>1.0</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <version>1.7.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.felix</groupId>
            <artifactId>org.apache.felix.framework</artifactId>
            <version>${felix.framework.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.felix</groupId>
            <artifactId>org.apache.felix.framework.security</artifactId>
            <!-- Not built in this repository any more (removed in the 8.0.0 framework
                 line, FELIX-6807); only ConfigAdminSecurityTest uses it, and that test is
                 excluded below. -->
            <version>2.8.3</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <version>3.5.0</version>
                <extensions>true</extensions>
                <configuration>
                    <instructions>
                        <Bundle-Category>osgi</Bundle-Category>
                        <Bundle-SymbolicName>
                            ${project.artifactId}
                        </Bundle-SymbolicName>
                        <Bundle-Vendor>The Apache Software Foundation</Bundle-Vendor>
                        <Bundle-DocURL>
                            http://felix.apache.org/site/apache-felix-config-admin.html
                        </Bundle-DocURL>
                        <Bundle-Activator>
                            org.apache.felix.cm.impl.Activator
                        </Bundle-Activator>
                        <Export-Package>
                            <!-- just list, version from package-info classes -->
                            <!-- when the spec version changes, update the service property that includes the spec version in ConfigurationManager -->
                            org.apache.felix.cm;
                            org.apache.felix.cm.file,
                            org.osgi.service.cm;provide:=true
                        </Export-Package>
                        <Import-Package>
                            org.osgi.service.cm,
							org.osgi.service.coordinator;resolution:=optional,
							org.osgi.service.log;resolution:=optional,
                            *
                        </Import-Package>
                        <DynamicImport-Package>
                            org.osgi.service.coordinator;version="[1.0,2)",                            
                            org.osgi.service.log;version="[1.3,2)"
                        </DynamicImport-Package>
                        <Provide-Capability><![CDATA[
                            osgi.service;objectClass:List<String>="org.osgi.service.cm.ConfigurationAdmin";uses:="org.osgi.service.cm,org.apache.felix.cm",
                            osgi.service;objectClass:List<String>="org.apache.felix.cm.PersistenceManager";uses:="org.osgi.service.cm,org.apache.felix.cm",
                            osgi.implementation;osgi.implementation="osgi.cm";uses:="org.osgi.service.cm,org.apache.felix.cm";version:Version="1.6"
                        ]]></Provide-Capability>
                        <Require-Capability><![CDATA[
                            osgi.service;filter:="(objectClass=org.osgi.service.log.LogService)";effective:=active;resolution:=optional
                        ]]></Require-Capability>
                    </instructions>
                </configuration>
                   <executions>
                        <execution>
                            <id>baseline</id>
                            <goals>
                                <goal>baseline</goal>
                            </goals>
                        </execution>
                    </executions>
              </plugin>
            <!--
                Exclude Integration tests in (default) unit tests and
                conversely enable integration tests for integration testing
                only. Helper classes are completely excluded from testing. 
            -->
            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <executions>
                    <execution>
                        <id>surefire-it</id>
                        <phase>integration-test</phase>
                        <goals>
                            <goal>test</goal>
                        </goals>
                        <configuration>
                            <systemProperties>
                                <property>
                                    <name>project.bundle.file</name>
                                    <value>${bundle.file.name}</value>
                                </property>
                            </systemProperties>
                            <excludes>
                                <exclude>**/cm/*</exclude>
                                <exclude>**/cm/file/*</exclude>
                                <exclude>**/cm/impl/**</exclude>
                                <!--
                                    ConfigAdminSecurityTest launches a framework with
                                    org.osgi.framework.security set, so Felix.init calls
                                    System.setSecurityManager. That has thrown
                                    UnsupportedOperationException since Java 18 unless
                                    -Djava.security.manager=allow is passed, and passing
                                    that flag is itself a fatal startup error from Java 24
                                    on (JEP 486). The test therefore cannot run on any JDK
                                    this project builds with apart from 17.
                                -->
                                <exclude>**/integration/ConfigAdminSecurityTest.java</exclude>
                            </excludes>
                            <includes>
                                <include>**/integration/*</include>
                            </includes>
                        </configuration>
                    </execution>
                </executions>
                <configuration>
                    <excludes>
                        <exclude>**/integration/**</exclude>
                    </excludes>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <configuration>
                    <!-- The JDK 21 doclet enforces HTML5 and rejects the pre-HTML5 markup in
                         these javadoc comments, as it does for the framework. Tracked separately;
                         it must not block a release. -->
                    <failOnError>false</failOnError>
                </configuration>
            </plugin>
        </plugins>
    </build>
    
    <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.3</version>
                        <executions>
                            <execution>
                                <id>cm-file-create</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                                <configuration>
                                    <tasks>
                                        <copy file="${project.build.directory}/${project.build.finalName}.jar" tofile="${project.build.directory}/configadmin.jar" />
                                    </tasks>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
