Просмотр исходного кода

改用nebula配合maven-publish.

nieqiurong 6 лет назад
Родитель
Сommit
b22e61554d

+ 33 - 61
build.gradle

@@ -4,8 +4,8 @@ buildscript {
         maven { url "https://plugins.gradle.org/m2/" }
     }
     dependencies {
-        classpath("io.spring.gradle:propdeps-plugin:0.0.9.RELEASE")
         classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.10")
+        classpath 'com.netflix.nebula:gradle-extra-configurations-plugin:3.0.3'
     }
 }
 
@@ -76,21 +76,16 @@ allprojects {
 
 description = "Mybatis 增强工具包 - 只做增强不做改变,简化CRUD操作"
 
-configure(subprojects) {
-    apply plugin: 'propdeps'
-    apply plugin: 'propdeps-maven'
-    apply plugin: 'propdeps-idea'
-    apply plugin: 'propdeps-eclipse'
-}
-
 subprojects {
 
     apply plugin: 'java'
     apply plugin: 'signing'
+    apply plugin: 'maven-publish'
+    apply plugin: 'nebula.optional-base'
+    apply plugin: 'nebula.provided-base'
     sourceCompatibility = "${javaVersion}"
     targetCompatibility = "${javaVersion}"
 
-    //noinspection GroovyAssignabilityCheck
     tasks.withType(JavaCompile) {
         options.encoding = 'UTF-8'
     }
@@ -143,81 +138,58 @@ subprojects {
     }
 
     tasks.whenTaskAdded { task ->
-        if (task.name.contains('uploadArchives') || task.name.contains("signArchives")) {
+        if (task.name.contains('signMavenJavaPublication')) {
             task.enabled = new File(project.property('signing.secretKeyRingFile') as String).isFile()
         }
     }
 
-    signing {
-        sign configurations.archives
-    }
 
-    install {
-        repositories.mavenInstaller {
-            pom.whenConfigured { generatedPom ->
-                generatedPom.dependencies.removeAll { dep ->
-                    dep.scope == "test"
-                }
-                generatedPom.dependencies = generatedPom.dependencies.sort { dep ->
-                    "$dep.scope:$dep.groupId:$dep.artifactId"
-                }
-            }
-        }
-    }
-    
-    // gradle clean build uploadArchives -Dun=用户名 -Dps=密码 -x test
-    uploadArchives {
-        repositories {
-            mavenDeployer {
-                beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
-                def userName = System.getProperty("un")
-                def passWord = System.getProperty("ps")
-                repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
-                    //noinspection GroovyAssignabilityCheck
-                    authentication(userName: userName, password: passWord)
-                }
+    publishing {
+        publications {
+            mavenJava(MavenPublication) {
+                from components.java
 
-                snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
-                    //noinspection GroovyAssignabilityCheck
-                    authentication(userName: userName, password: passWord)
-                }
+                artifact sourcesJar
+                artifact javadocJar
 
-                pom.version = "$project.version"
-                pom.artifactId = "$project.name"
-                pom.groupId = "$project.group"
-                pom.project {
-                    //noinspection GroovyAssignabilityCheck
-                    name 'mybatis-plus'
+                pom {
+                    name = 'mybatis-plus'
                     packaging 'jar'
-                    description 'An enhanced toolkit of Mybatis to simplify development.'
-                    url 'https://github.com/baomidou/mybatis-plus'
-
+                    description = 'An enhanced toolkit of Mybatis to simplify development.'
+                    url =  'https://github.com/baomidou/mybatis-plus'
+                    licenses {
+                        license {
+                            name = 'The Apache License, Version 2.0'
+                            url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
+                        }
+                    }
                     scm {
-                        connection 'scm:git@github.com:Codearte/gradle-nexus-staging-plugin.git'
-                        developerConnection 'scm:git@github.com:Codearte/gradle-nexus-staging-plugin.git'
-                        url 'https://github.com/baomidou/mybatis-plus'
+                        connection = 'scm:git@github.com:Codearte/gradle-nexus-staging-plugin.git'
+                        developerConnection = 'scm:git@github.com:Codearte/gradle-nexus-staging-plugin.git'
+                        url = 'https://github.com/baomidou/mybatis-plus'
                     }
 
                     licenses {
                         license {
-                            //noinspection GroovyAssignabilityCheck
-                            name 'The Apache License, Version 2.0'
-                            url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
+                            name = 'The Apache License, Version 2.0'
+                            url =  'http://www.apache.org/licenses/LICENSE-2.0.txt'
                         }
                     }
 
                     developers {
                         developer {
-                            id 'baomidou'
-                            //noinspection GroovyAssignabilityCheck
-                            name 'hubin'
-                            email 'jobob@qq.com'
+                            id = 'baomidou'
+                            name = 'hubin'
+                            email = 'jobob@qq.com'
                         }
                     }
                 }
             }
         }
+
+        signing {
+            sign publishing.publications.mavenJava
+        }
     }
 
-    compileJava.dependsOn(processResources)
 }

+ 1 - 1
mybatis-plus-boot-starter/build.gradle

@@ -2,5 +2,5 @@ dependencies {
     compile project(":mybatis-plus")
     compile rootProject.ext.dependencies["springboot-autoconfigure"]
     compile rootProject.ext.dependencies["springboot-starter-jdbc"]
-    optional rootProject.ext.dependencies["springboot-configuration-processor"]
+    compile rootProject.ext.dependencies["springboot-configuration-processor"],optional
 }

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

@@ -1,8 +1,8 @@
 dependencies {
     compile project(":mybatis-plus-extension")
 
-    optional rootProject.ext.dependencies["velocity"]
-    optional rootProject.ext.dependencies["freemarker"]
+    compile rootProject.ext.dependencies["velocity"],optional
+    compile rootProject.ext.dependencies["freemarker"],optional
 
     testCompile rootProject.ext.dependencies["sqlserver"]
     testCompile rootProject.ext.dependencies["postgresql"]

+ 0 - 4
mybatis-plus/build.gradle

@@ -5,10 +5,6 @@ dependencies {
     testCompile rootProject.ext.dependencies["spring-web"]
     testCompile rootProject.ext.dependencies["javax.servlet-api"]
 
-    testCompile rootProject.ext.dependencies["spring-aop"]
-    testCompile rootProject.ext.dependencies["spring-context-support"]
-    testCompile rootProject.ext.dependencies["spring-tx"]
-    testCompile rootProject.ext.dependencies["spring-jdbc"]
     testCompile rootProject.ext.dependencies["spring-test"]
     testCompile rootProject.ext.dependencies["fastjson"]