You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by kw...@apache.org on 2022/06/24 06:33:50 UTC

[sling-parent] 01/01: SLING-11411 remove scope from depMgmt

This is an automated email from the ASF dual-hosted git repository.

kwin pushed a commit to branch feature/SLING-11411-remove-scope-from-depMgmt
in repository https://gitbox.apache.org/repos/asf/sling-parent.git

commit 15237de893b428f0742e6eecbfd78e10e188f39e
Author: Konrad Windszus <kw...@apache.org>
AuthorDate: Fri Jun 24 08:33:43 2022 +0200

    SLING-11411 remove scope from depMgmt
    
    enforce explicit scope for all local dependencies via Maven Enforcer
    rule
---
 sling-bundle-parent/pom.xml | 11 -----------
 sling-parent/pom.xml        | 28 +++++++++++++++++++---------
 2 files changed, 19 insertions(+), 20 deletions(-)

diff --git a/sling-bundle-parent/pom.xml b/sling-bundle-parent/pom.xml
index e1d05e9..689b53a 100644
--- a/sling-bundle-parent/pom.xml
+++ b/sling-bundle-parent/pom.xml
@@ -212,14 +212,12 @@ Bundle-DocURL: https://sling.apache.org
                 <groupId>org.osgi</groupId>
                 <artifactId>osgi.core</artifactId>
                 <version>7.0.0</version>
-                <scope>provided</scope>
             </dependency>
             <!-- Compendium R6 -->
             <dependency>
                 <groupId>org.osgi</groupId>
                 <artifactId>osgi.cmpn</artifactId>
                 <version>7.0.0</version>
-                <scope>provided</scope>
             </dependency>
             <!-- individual OSGi spec API artifacts (preferred) -->
             <!-- Framework 1.9, Core R7 (https://docs.osgi.org/javadoc/osgi.core/7.0.0/org/osgi/framework/package-summary.html) -->
@@ -227,14 +225,12 @@ Bundle-DocURL: https://sling.apache.org
                 <groupId>org.osgi</groupId>
                 <artifactId>org.osgi.framework</artifactId>
                 <version>1.9.0</version>
-                <scope>provided</scope>
             </dependency>
             <!-- Tracker 1.5, Core R7 (https://docs.osgi.org/javadoc/osgi.core/7.0.0/org/osgi/util/tracker/package-summary.html) -->
             <dependency>
                 <groupId>org.osgi</groupId>
                 <artifactId>org.osgi.util.tracker</artifactId>
                 <version>1.5.4</version>
-                <scope>provided</scope>
             </dependency>
             <!-- Data Transfer Object 1.1, Core R7 (https://docs.osgi.org/javadoc/osgi.core/7.0.0/org/osgi/dto/package-summary.html) -->
             <dependency>
@@ -259,7 +255,6 @@ Bundle-DocURL: https://sling.apache.org
                 <groupId>org.osgi</groupId>
                 <artifactId>org.osgi.service.cm</artifactId>
                 <version>1.6.1</version>
-                <scope>provided</scope>
             </dependency>
             <!-- Service Component 1.4, Compendium R7 (https://osgi.org/javadoc/osgi.cmpn/7.0.0/org/osgi/service/component/package-frame.html) -->
             <!-- and component property types (https://osgi.org/javadoc/osgi.cmpn/7.0.0/org/osgi/service/component/propertytypes/package-frame.html) -->
@@ -267,7 +262,6 @@ Bundle-DocURL: https://sling.apache.org
                 <groupId>org.osgi</groupId>
                 <artifactId>org.osgi.service.component</artifactId>
                 <version>1.4.0</version>
-                <scope>provided</scope>
             </dependency>
             <!-- Event Admin 1.4, Compendium R7 (https://docs.osgi.org/javadoc/osgi.cmpn/7.0.0/org/osgi/service/event/package-summary.html) -->
             <dependency>
@@ -282,35 +276,30 @@ Bundle-DocURL: https://sling.apache.org
                 <groupId>org.osgi</groupId>
                 <artifactId>org.osgi.annotation.versioning</artifactId>
                 <version>1.1.2</version>
-                <scope>provided</scope>
             </dependency>
             <!-- https://osgi.org/javadoc/osgi.annotation/7.0.0/org/osgi/annotation/bundle/package-frame.html -->
             <dependency>
                 <groupId>org.osgi</groupId>
                 <artifactId>org.osgi.annotation.bundle</artifactId>
                 <version>1.0.0</version>
-                <scope>provided</scope>
             </dependency>
             <!-- https://osgi.org/javadoc/osgi.cmpn/7.0.0/org/osgi/service/component/annotations/package-frame.html -->
             <dependency>
                 <groupId>org.osgi</groupId>
                 <artifactId>org.osgi.service.component.annotations</artifactId>
                 <version>1.4.0</version>
-                <scope>provided</scope>
             </dependency>
             <!-- https://osgi.org/javadoc/osgi.cmpn/7.0.0/org/osgi/service/metatype/annotations/package-frame.html -->
             <dependency>
                 <groupId>org.osgi</groupId>
                 <artifactId>org.osgi.service.metatype.annotations</artifactId>
                 <version>1.4.1</version>
-                <scope>provided</scope>
             </dependency>
             <!-- https://sling.apache.org/apidocs/sling11/org/apache/sling/servlets/annotations/package-summary.html -->
             <dependency>
                 <groupId>org.apache.sling</groupId>
                 <artifactId>org.apache.sling.servlets.annotations</artifactId>
                 <version>1.2.6</version>
-                <scope>provided</scope>
             </dependency>
         </dependencies>
     </dependencyManagement>
diff --git a/sling-parent/pom.xml b/sling-parent/pom.xml
index f0accb3..ab985d2 100644
--- a/sling-parent/pom.xml
+++ b/sling-parent/pom.xml
@@ -111,11 +111,18 @@
         <plugins>
             <plugin>
                 <artifactId>maven-enforcer-plugin</artifactId>
+                <dependencies>
+                    <dependency>
+                        <groupId>org.apache.sling</groupId>
+                        <artifactId>maven-enforcer-rules</artifactId>
+                        <version>1.0.1-SNAPSHOT</version>
+                    </dependency>
+                </dependencies>
                 <executions>
                      <execution>
                         <id>enforce-sling-java-version</id>
                         <goals>
-                          <goal>enforce</goal>
+                            <goal>enforce</goal>
                         </goals>
                         <configuration>
                             <rules>
@@ -129,6 +136,17 @@
                             </rules>
                         </configuration>
                     </execution>
+                    <execution>
+                        <id>enforce-explicit-scope</id>
+                        <goals>
+                            <goal>enforce</goal>
+                        </goals>
+                        <configuration>
+                            <rules>
+                                <requireExplicitDependencyScope implementation="org.apache.sling.maven.enforcer.RequireExplicitDependencyScope" />
+                            </rules>
+                        </configuration>
+                    </execution>
                 </executions>
             </plugin>
 
@@ -942,7 +960,6 @@
                 <groupId>javax.servlet</groupId>
                 <artifactId>javax.servlet-api</artifactId>
                 <version>3.1.0</version>
-                <scope>provided</scope>
             </dependency>
 
             <!-- Dependency injection annotations -->
@@ -950,7 +967,6 @@
                 <groupId>javax.inject</groupId>
                 <artifactId>javax.inject</artifactId>
                 <version>1</version>
-                <scope>provided</scope>
             </dependency>
 
             <!-- JCR API -->
@@ -958,7 +974,6 @@
                 <groupId>javax.jcr</groupId>
                 <artifactId>jcr</artifactId>
                 <version>2.0</version>
-                <scope>provided</scope>
             </dependency>
 
             <!-- Basic Logging -->
@@ -966,7 +981,6 @@
                 <groupId>org.slf4j</groupId>
                 <artifactId>slf4j-api</artifactId>
                 <version>1.7.25</version>
-                <scope>provided</scope>
             </dependency>
 
             <!-- JetBrains annotations for null-analysis (SLING-7798), https://github.com/JetBrains/java-annotations -->
@@ -974,7 +988,6 @@
                 <groupId>org.jetbrains</groupId>
                 <artifactId>annotations</artifactId>
                 <version>23.0.0</version>
-                <scope>provided</scope>
             </dependency>
 
             <!-- Annotations used in Maven Plugins -->
@@ -982,7 +995,6 @@
                 <groupId>org.apache.maven.plugin-tools</groupId>
                 <artifactId>maven-plugin-annotations</artifactId>
                 <version>${maven.plugin.tools.version}</version>
-                <scope>provided</scope> <!-- annotations are not used at runtime because @Retention(value=CLASS), they are needed only to build the plugin -->
             </dependency>
 
             <!-- Basic dependencies for Unit Tests -->
@@ -990,13 +1002,11 @@
                 <groupId>junit</groupId>
                 <artifactId>junit</artifactId>
                 <version>4.13.2</version>
-                <scope>test</scope>
             </dependency>
             <dependency>
                 <groupId>org.slf4j</groupId>
                 <artifactId>slf4j-simple</artifactId>
                 <version>1.7.25</version>
-                <scope>test</scope>
             </dependency>
         </dependencies>
     </dependencyManagement>