FINERACT-1480: Fix Swagger UI broken by incremental build

This commit is contained in:
Petri Tuomola
2022-01-06 12:49:10 +08:00
committed by Petri Tuomola
parent ab6323e474
commit 4d879eddc4
4 changed files with 13 additions and 5 deletions
+10
View File
@@ -247,6 +247,8 @@ bootRun {
dependencies { dependencies {
implementation 'org.mariadb.jdbc:mariadb-java-client:2.7.3' implementation 'org.mariadb.jdbc:mariadb-java-client:2.7.3'
} }
classpath += files("build/generated/swagger-ui")
} }
springBoot { springBoot {
@@ -266,6 +268,14 @@ bootJar {
} }
} }
jar {
from('build/generated/swagger-ui') {
include '*'
}
}
jar.dependsOn resolve
jib { jib {
from { from {
image = 'azul/zulu-openjdk-alpine:17' image = 'azul/zulu-openjdk-alpine:17'
@@ -46,7 +46,8 @@ public class WebFrontEndConfiguration implements WebMvcConfigurer {
LOG.info("Found Swagger UI at {}", fullPathToSwaggerUiJs); LOG.info("Found Swagger UI at {}", fullPathToSwaggerUiJs);
String fullPathToSwaggerUi = fullPathToSwaggerUiJs.substring(0, fullPathToSwaggerUiJs.lastIndexOf("/") + 1); String fullPathToSwaggerUi = fullPathToSwaggerUiJs.substring(0, fullPathToSwaggerUiJs.lastIndexOf("/") + 1);
final String[] swaggerResourceLocations = { "classpath:/static/swagger-ui/", "classpath:" + fullPathToSwaggerUi }; final String[] swaggerResourceLocations = { "classpath:/static/swagger-ui/", "classpath:fineract.yaml",
"classpath:" + fullPathToSwaggerUi };
registry.addResourceHandler("/swagger-ui/**").addResourceLocations(swaggerResourceLocations); registry.addResourceHandler("/swagger-ui/**").addResourceLocations(swaggerResourceLocations);
} }
-4
View File
@@ -43,10 +43,6 @@ war {
} }
enabled = true enabled = true
classifier = '' classifier = ''
from('$rootDir/fineract-provider/build/generated/swagger-ui') {
into 'BOOT-INF/classes/static/swagger-ui'
}
} }
dependencies { dependencies {
@@ -46,6 +46,7 @@ public class SwaggeruiTest {
public void testSwaggeruiAccess() { public void testSwaggeruiAccess() {
Utils.performServerGet(requestSpec, responseSpec, "/fineract-provider/swagger-ui", null); Utils.performServerGet(requestSpec, responseSpec, "/fineract-provider/swagger-ui", null);
Utils.performServerGet(requestSpec, responseSpec, "/fineract-provider/swagger-ui/index.html", null); Utils.performServerGet(requestSpec, responseSpec, "/fineract-provider/swagger-ui/index.html", null);
Utils.performServerGet(requestSpec, responseSpec, "/fineract-provider/swagger-ui/fineract.yaml", null);
} }
} }