Skip to content

Commit

Permalink
Create separate sub-module for WAR build
Browse files Browse the repository at this point in the history
  • Loading branch information
vidakovic authored and ptuomola committed Jan 2, 2022
1 parent c91113b commit b2dbbe6
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 41 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ The tenants database connection details are configured [via environment variable
Instructions to build a WAR file
============
1. Clone the repository or download and extract the archive file to your local directory.
2. Run `./gradlew clean war` to build a traditional WAR file which will be created at `build/libs` directory.
2. Run `./gradlew :fineract-war:clean :fineract-war:war` to build a traditional WAR file which will be created at `fineract-war/build/libs` directory.
3. Deploy this WAR to your Tomcat v9 Servlet Container.

We recommend using the JAR instead of the WAR file deployment, because it's much easier.
Expand Down
32 changes: 1 addition & 31 deletions fineract-provider/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ description = 'Fineract Provider'

apply plugin: 'org.zeroturnaround.gradle.jrebel'
apply plugin: 'java'
apply plugin: 'war'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
apply plugin: 'openjpa'
Expand Down Expand Up @@ -154,30 +153,6 @@ compileJava {
finalizedBy resolve
}

war {
from("$rootDir/licenses/") {
// notice the parens
into "WEB-INF/licenses/" // no leading slash
}
from("$rootDir/LICENSE_RELEASE") {
// notice the parens
into "WEB-INF/" // no leading slash
}
from("$rootDir/NOTICE_RELEASE") {
// notice the parens
into "WEB-INF/" // no leading slash
}
rename ('LICENSE_RELEASE', 'LICENSE')
rename ('NOTICE_RELEASE', 'NOTICE')

from("$rootDir/DISCLAIMER") {
// notice the parens
into "WEB-INF/" // no leading slash
}
enabled = true
classifier = ''
}

// If we are running Gradle within Eclipse to enhance classes with OpenJPA,
// set the classes directory to point to Eclipse's default build directory
if (project.hasProperty('env') && project.getProperty('env') == 'eclipse')
Expand Down Expand Up @@ -271,10 +246,6 @@ bootJar {
classifier = ''
}

bootWar {
enabled = false
}

tasks.withType(Tar) {
compression Compression.GZIP
extension 'tar.gz'
Expand All @@ -289,7 +260,7 @@ distributions {
}
contents {
from bootJar
from war
// TODO: @vidakovic add war
// TODO: @vidakovic add client library
from("$rootDir/licenses/") {
into "licenses/"
Expand Down Expand Up @@ -374,6 +345,5 @@ processResources.dependsOn generateGitProperties
checkstyleMain.dependsOn resolve
checkstyleTest.dependsOn resolve
licenseMain.dependsOn processResources, generateGitProperties
war.dependsOn resolve
spotbugsTest.dependsOn resolve
test.dependsOn resolve
50 changes: 50 additions & 0 deletions fineract-war/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
description = 'Fineract WAR'

apply plugin: 'war'

war {
archiveFileName = 'fineract-provider.war'
from("$rootDir/licenses/binary/") {
// notice the parens
into "WEB-INF/licenses/binary/" // no leading slash
}
from("$rootDir/LICENSE_RELEASE") {
// notice the parens
into "WEB-INF/" // no leading slash
}
from("$rootDir/NOTICE_RELEASE") {
// notice the parens
into "WEB-INF/" // no leading slash
}
rename ('LICENSE_RELEASE', 'LICENSE')
rename ('NOTICE_RELEASE', 'NOTICE')

from("$rootDir/DISCLAIMER") {
// notice the parens
into "WEB-INF/" // no leading slash
}
enabled = true
classifier = ''
}

dependencies {
implementation project(':fineract-provider')
}
6 changes: 3 additions & 3 deletions integration-tests/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ cargo {

// looks like Cargo doesn't detect the WAR file automatically in the multi-module setup
deployable {
file = file("$rootDir/fineract-provider/build/libs/fineract-provider.war")
file = file("$rootDir/fineract-war/build/libs/fineract-provider.war")
context = 'fineract-provider'
}

Expand All @@ -56,8 +56,8 @@ cargo {
}
}

cargoRunLocal.dependsOn ':fineract-provider:war'
cargoStartLocal.dependsOn ':fineract-provider:war'
cargoRunLocal.dependsOn ':fineract-war:war'
cargoStartLocal.dependsOn ':fineract-war:war'
cargoStartLocal.mustRunAfter 'testClasses'

test {
Expand Down
6 changes: 3 additions & 3 deletions oauth2-tests/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ cargo {

// looks like Cargo doesn't detect the WAR file automatically in the multi-module setup
deployable {
file = file("$rootDir/fineract-provider/build/libs/fineract-provider.war")
file = file("$rootDir/fineract-war/build/libs/fineract-provider.war")
context = 'fineract-provider'
}

Expand All @@ -57,8 +57,8 @@ cargo {
}
}

cargoRunLocal.dependsOn ':fineract-provider:war'
cargoStartLocal.dependsOn ':fineract-provider:war'
cargoRunLocal.dependsOn ':fineract-war:war'
cargoStartLocal.dependsOn ':fineract-war:war'
cargoStartLocal.mustRunAfter 'testClasses'

test {
Expand Down
1 change: 1 addition & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/
rootProject.name='fineract'
include ':fineract-provider'
include ':fineract-war'
include ':integration-tests'
include ':twofactor-tests'
include ':oauth2-tests'
Expand Down
6 changes: 3 additions & 3 deletions twofactor-tests/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ cargo {

// looks like Cargo doesn't detect the WAR file automatically in the multi-module setup
deployable {
file = file("$rootDir/fineract-provider/build/libs/fineract-provider.war")
file = file("$rootDir/fineract-war/build/libs/fineract-provider.war")
context = 'fineract-provider'
}

Expand All @@ -57,8 +57,8 @@ cargo {
}
}

cargoRunLocal.dependsOn ':fineract-provider:war'
cargoStartLocal.dependsOn ':fineract-provider:war'
cargoRunLocal.dependsOn ':fineract-war:war'
cargoStartLocal.dependsOn ':fineract-war:war'
cargoStartLocal.mustRunAfter 'testClasses'

test {
Expand Down

0 comments on commit b2dbbe6

Please sign in to comment.