修改net-paoding项目的build.gradle文件,使用gradle install发布到本地maven仓库

subprojects {
    apply plugin: 'java'
    apply plugin: 'maven'
    apply plugin: 'eclipse'
    
    group = "net.paoding"
    version = "1.2-SNAPSHOT"

    sourceCompatibility = 1.6
    [compileJava, compileTestJava]*.options*.encoding = 'UTF-8'

    repositories {

        maven {

url "http://localhost:8081/nexus/content/groups/public"

}

        mavenCentral()
    }

    uploadArchives {
        repositories {

            mavenDeployer {

repository(url: "http://localhost:8081/nexus/content/repositories/snapshots") {
               authentication(userName: "admin", password: "admin123")
  }

                mavenLocal()
            }
        }
    }

    dependencies {
    }

    jar {
        manifest.attributes "Implementation-Title": "paoding-rose", "Implementation-Version": version
    }
}

project(':context') {
    archivesBaseName = "context"
    dependencies {
        testCompile "junit:junit:4.7"
        compile "javax.servlet:servlet-api:2.4"
        compile "commons-logging:commons-logging:1.1.1"
        compile "commons-lang:commons-lang:2.6"
        compile "commons-collections:commons-collections:3.2.1"
        compile "org.springframework:spring-context:3.1.2.RELEASE"
        compile "org.springframework:spring-web:3.1.2.RELEASE"
    }
}

project(':rose') {
    project.metaClass.getName {"rose"}
    archivesBaseName = "paoding-rose"
    dependencies {
        compile project(':context')
           testCompile "junit:junit:4.7"
           compile "javax.servlet:servlet-api:2.4"
           compile "commons-logging:commons-logging:1.1.1"
           compile "commons-lang:commons-lang:2.6"
           compile "commons-collections:commons-collections:3.2.1"
           compile "org.springframework:spring-context:3.1.2.RELEASE"
           compile "org.springframework:spring-web:3.1.2.RELEASE"
           compile "log4j:log4j:1.2.17"
           compile "javax.servlet:jsp-api:2.0"
           compile "commons-fileupload:commons-fileupload:1.2.2"
           compile "org.springframework:spring-webmvc:3.1.2.RELEASE"
           testCompile "org.springframework:spring-mock:2.0.8"
           compile "org.apache.velocity:velocity:1.7"
           compile "org.apache.velocity:velocity-tools:2.0"

    }
}

project(':jade') {
    archivesBaseName = "jade"
    dependencies {
        compile project(':context')
        testCompile "junit:junit:4.7"
        compile "javax.servlet:servlet-api:2.4"
        compile "commons-logging:commons-logging:1.1.1"
        compile "commons-lang:commons-lang:2.6"
        compile "commons-jexl:commons-jexl:1.1"
        compile "commons-collections:commons-collections:3.2.1"
        compile "org.springframework:spring-context:3.1.2.RELEASE"
        compile "org.springframework:spring-jdbc:3.1.2.RELEASE"
        testCompile "org.hsqldb:hsqldb:2.2.8"
    }
}

project(':pipe') {
    archivesBaseName = "pipe"
    dependencies {
        compile project(':rose')
        testCompile "junit:junit:4.7"
        compile "javax.servlet:servlet-api:2.4"
        compile "javax.servlet:jsp-api:2.0"
        compile "com.metaparadigm:json-rpc:1.0"
    }
}

subprojects{
    configure(install.repositories.mavenInstaller) {
    pom.project {
        groupId 'net.paoding'
        artifactId project.name
        packaging 'jar'
        }
    }

task sourcesJar(type: Jar, dependsOn:classes) {
    classifier = 'sources'
    from sourceSets.main.allSource
}

task javadocJar(type: Jar, dependsOn:javadoc) {
    classifier = 'javadoc'
    from javadoc.destinationDir
}

artifacts {
    archives sourcesJar
    archives javadocJar
}

}


说明:
  先执行gradle install
  然后执行gradle uload或者 gradle  uploadArchives


你可能感兴趣的:(java技术)