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

kwin pushed a commit to branch 
feature/SLING-11862-prevent-annotations-with-compile-scope
in repository https://gitbox.apache.org/repos/asf/sling-parent.git

commit 1cb7079de75633b7c666f6c014bf09808fa57040
Author: Konrad Windszus <[email protected]>
AuthorDate: Fri May 5 12:12:50 2023 +0200

    SLING-11862 Prevent usage of annotation dependencies with compile scope
---
 sling-bundle-parent/pom.xml | 11 +++++++++++
 sling-parent/pom.xml        | 19 +++++++++++++++++++
 2 files changed, 30 insertions(+)

diff --git a/sling-bundle-parent/pom.xml b/sling-bundle-parent/pom.xml
index a629fa0..6241b88 100644
--- a/sling-bundle-parent/pom.xml
+++ b/sling-bundle-parent/pom.xml
@@ -162,6 +162,17 @@ Bundle-DocURL: https://sling.apache.org
                                     </excludes>
                                     <message>Use the individual OSGi chapter 
dependencies instead of the aggregate ones. Further infos at 
http://docs.osgi.org/artifacts/#aggregate-artifacts.</message>
                                 </bannedDependencies>
+                                <bannedDependencies>
+                                    <searchTransitive>false</searchTransitive>
+                                    <excludes>
+                                        
<exclude>org.osgi:org.osgi.annotation.versioning:*:*:compile</exclude>
+                                        
<exclude>org.osgi:org.osgi.annotation.bundle:*:*:compile</exclude>
+                                        
<exclude>org.osgi:org.osgi.service.component.annotations:*:*:compile</exclude>
+                                        
<exclude>org.osgi:org.osgi.service.metatype.annotations:*:*:compile</exclude>
+                                        
<exclude>org.apache.sling:org.apache.sling.servlets.annotations:*:*:compile</exclude>
+                                    </excludes>
+                                    <message>The annotation dependencies 
should be used with scope provided to prevent transitive inheritance and to 
prevent runtime inclusion</message>
+                                </bannedDependencies>
                             </rules>
                         </configuration>
                     </execution>
diff --git a/sling-parent/pom.xml b/sling-parent/pom.xml
index 7c950dd..c149092 100644
--- a/sling-parent/pom.xml
+++ b/sling-parent/pom.xml
@@ -147,6 +147,21 @@
                             </rules>
                         </configuration>
                     </execution>
+                    <execution>
+                        <id>enforce-scope-of-annotation-deps</id>
+                        <goals>
+                            <goal>enforce</goal>
+                        </goals>
+                        <configuration>
+                            <bannedDependencies>
+                                <searchTransitive>false</searchTransitive>
+                                <excludes>
+                                    
<exclude>org.jetbrains:annotations:*:*:compile</exclude>
+                                </excludes>
+                                <message>The annotation dependencies should be 
used with scope provided to prevent transitive inheritance and to prevent 
runtime inclusion</message>
+                            </bannedDependencies>
+                        </configuration>
+                    </execution>
                 </executions>
             </plugin>
 
@@ -262,6 +277,10 @@
 
         <pluginManagement>
             <plugins>
+                <plugin>
+                    <artifactId>maven-enforcer-plugin</artifactId>
+                    <version>3.3.0</version>
+                </plugin>
                 <plugin>
                     <artifactId>maven-javadoc-plugin</artifactId>
                     <!-- this affects both direct invocation and execution in 
the context of site building 
(https://maven.apache.org/shared/maven-reporting-exec/) -->

Reply via email to