Преглед изворни кода

修改javax.servlet-api作用域为provided,其他可选依赖使用optional=true

nieqiurong пре 6 година
родитељ
комит
0592f0c14a
3 измењених фајлова са 20 додато и 12 уклоњено
  1. 12 3
      build.gradle
  2. 2 2
      mybatis-plus-core/build.gradle
  3. 6 7
      mybatis-plus-extension/build.gradle

+ 12 - 3
build.gradle

@@ -80,6 +80,7 @@ subprojects {
 
     apply plugin: 'java'
     apply plugin: 'signing'
+    apply plugin: 'war'
     apply plugin: 'maven-publish'
     apply plugin: 'nebula.optional-base'
     apply plugin: 'nebula.provided-base'
@@ -105,7 +106,7 @@ subprojects {
     }
 
     dependencies {
-        provided rootProject.ext.dependencies["lombok"]
+        compile rootProject.ext.dependencies["lombok"], optional
         testCompile rootProject.ext.dependencies["mockito-all"]
         testCompile rootProject.ext.dependencies["junit"]
     }
@@ -165,7 +166,6 @@ subprojects {
                 }
             }
         }
-
         publications {
 
             mavenJava(MavenPublication) {
@@ -205,6 +205,16 @@ subprojects {
                             email = 'jobob@qq.com'
                         }
                     }
+
+                    withXml {
+                        asNode().dependencies.'*'.findAll() {
+                            it.scope.text() == 'compile' && project.configurations.providedCompile.allDependencies.find { dep ->
+                                dep.name == it.artifactId.text()
+                            }
+                        }.each() {
+                            it.scope*.value = 'provided'
+                        }
+                    }
                 }
             }
         }
@@ -213,5 +223,4 @@ subprojects {
             sign publishing.publications.mavenJava
         }
     }
-
 }

+ 2 - 2
mybatis-plus-core/build.gradle

@@ -4,8 +4,8 @@ dependencies {
     compile rootProject.ext.dependencies["jsqlparser"]
 //    compile rootProject.ext.dependencies["mybatis-spring"]
 
-    provided rootProject.ext.dependencies["cglib"]
-    provided rootProject.ext.dependencies["spring-aop"]
+    compile rootProject.ext.dependencies["cglib"], optional
+    compile rootProject.ext.dependencies["spring-aop"], optional
 //    provided rootProject.ext.dependencies["spring-tx"]
 
     testCompile rootProject.ext.dependencies["mybatis-ehcache"]

+ 6 - 7
mybatis-plus-extension/build.gradle

@@ -1,16 +1,15 @@
 apply plugin: 'org.jetbrains.kotlin.jvm'
-
 dependencies {
     compile project(":mybatis-plus-core")
     compile rootProject.ext.dependencies["mybatis-spring"]
     compile rootProject.ext.dependencies["mybatis"]
 
-    provided rootProject.ext.dependencies["kotlin-stdlib-jdk8"]
-    provided rootProject.ext.dependencies["kotlin-reflect"]
-    provided rootProject.ext.dependencies["spring-context-support"]
-    provided rootProject.ext.dependencies["spring-jdbc"]
-    provided rootProject.ext.dependencies["javax.servlet-api"]
-    provided rootProject.ext.dependencies["slf4j-api"]
+    compile rootProject.ext.dependencies["kotlin-stdlib-jdk8"], optional
+    compile rootProject.ext.dependencies["kotlin-reflect"], optional
+    compile rootProject.ext.dependencies["spring-context-support"], optional
+    compile rootProject.ext.dependencies["spring-jdbc"], optional
+    providedCompile rootProject.ext.dependencies["javax.servlet-api"]
+    compile rootProject.ext.dependencies["slf4j-api"], optional
 
     testCompile rootProject.ext.dependencies["spring-web"]
     testCompile rootProject.ext.dependencies["javax.servlet-api"]