Как создавать многомодульные проекты Gradle для развертывания на weblogic - PullRequest
0 голосов
/ 15 января 2019

У меня есть 3 модуля проекта, как показано ниже: Мне нужно включить развертывание weblogic 12c Я искал решение в Интернете, но ни один из них не работал

  • проект-модель
    • build.gradle
    • settings.gradle
  • проект-ухо
    • build.gradle
    • settings.gradle
  • проект-апи
    • build.gradle
    • settings.gradle

модель проекта -> build.gradle

apply plugin: 'maven'
apply plugin: 'java'

sourceCompatibility = 1.8
targetCompatibility = 1.8
tasks.withType(JavaCompile) {
    options.encoding = 'UTF-8'
}

repositories {
    mavenLocal()
    mavenCentral()
}

dependencies {

    testCompile 'junit:junit:4.12'
    compile 'junit:junit:4.12'
    testImplementation('org.junit.jupiter:junit-jupiter-api:5.2.0')
    testCompile('org.junit.jupiter:junit-jupiter-params:5.2.0')
    testRuntime('org.junit.jupiter:junit-jupiter-engine:5.2.0')
    testCompile "org.mockito:mockito-core:2.+"
    testCompile('org.mockito:mockito-junit-jupiter:2.18.3')

    compileOnly group: 'javax', name: 'javaee-api', version:'7.0'

}

jar {
    archiveName = baseName + '.' + extension
}

project-ear -> build.gradle

apply plugin: 'ear'
apply plugin: 'maven'
apply plugin: 'eclipse-wtp'

apply plugin: 'java'

sourceCompatibility = 1.8
targetCompatibility = 1.8

repositories {
    mavenLocal()
    mavenCentral()
}

description = 'EAR Module'

dependencies {
    deploy project(':proj-api')
    deploy project(path:':proj-api', configuration:'archives')
    testCompile group: 'commons-httpclient', name: 'commons-httpclient', version:'3.1'
    testCompile group: 'junit', name: 'junit', version:'4.12'

}

ear {
    archiveName = baseName + '.' + extension
}

task integrationTest(type: Test) {
    group 'Verification'
    description 'Runs the integration tests.'
    reports.html.destination = file("$buildDir/reports/it")
    reports.junitXml.destination = file("$buildDir/test-results/it")
    include '**///it/**'
    //exclude '**/unit/**'

project-api -> build.gradle

apply plugin: 'maven'
apply plugin: 'java'
apply plugin: 'war'
apply plugin: 'eclipse-wtp'

sourceCompatibility = 1.8
targetCompatibility = 1.8

tasks.withType(JavaCompile) {
    options.encoding = 'UTF-8'
}

repositories {
    mavenLocal()
    mavenCentral()
}

eclipse.wtp.facet {
    facets = []
    facet name: "jst.java", version:"1.8"
    facet name: "jst.web", version: "3.0"
}

jar.enabled = false
description = 'WAR Module'
dependencies {
    compile group: 'javax.ws.rs', name: 'javax.ws.rs-api', version: '2.1'
    //compile group: 'org.glassfish.jersey.core', name: 'jersey-client', version: '2.6'

    testImplementation('org.junit.jupiter:junit-jupiter-api:5.2.0')
    testCompile('org.junit.jupiter:junit-jupiter-params:5.2.0')
    testRuntime('org.junit.jupiter:junit-jupiter-engine:5.2.0')
    testCompile "org.mockito:mockito-core:2.+"
    testCompile('org.mockito:mockito-junit-jupiter:2.18.3')

    testCompile group: 'junit', name: 'junit', version:'4.12'
    providedCompile group: 'javax', name: 'javaee-api', version:'7.0'

    providedCompile project(':proj-model')
    testCompile 'io.rest-assured:rest-assured:3.2.0'

}

war {
    archiveName = baseName + '.' + extension
}

project-api -> settings.gradle

rootProject.name = 'proj-api'

include ':proj-model'
project(':proj-model').projectDir = new File(settingsDir, '../proj-model')

project-ear -> settings.gradle

rootProject.name = 'proj-ear'

include ':proj-model'
include ':proj-api'

project(':proj-model').projectDir = new File('../proj-model')
project(':proj-api').projectDir = new File('../proj-api')

проект-модель -> settings.gradle

rootProject.name = 'proj-model'
...