From ed9723bcee6a73e5edbe980c1510f9e47ac82353 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Valentin=20Bo=CC=88hm?= Date: Mon, 26 Feb 2024 17:44:33 +0100 Subject: [PATCH] Migrate to Angular Application builder --- angular.json | 7 +++---- gradle/profile_dev.gradle | 2 +- gradle/war.gradle | 2 +- src/main/java/de/tum/cit/ase/config/WebConfigurer.java | 2 +- src/test/java/de/tum/cit/ase/config/WebConfigurerTest.java | 2 +- 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/angular.json b/angular.json index 3d6c310f..db28d094 100644 --- a/angular.json +++ b/angular.json @@ -18,12 +18,12 @@ "prefix": "jhi", "architect": { "build": { - "builder": "@angular-devkit/build-angular:browser-esbuild", + "builder": "@angular-devkit/build-angular:application", "options": { "allowedCommonJsDependencies": ["sockjs-client", "webstomp-client"], "outputPath": "build/resources/main/static/", "index": "src/main/webapp/index.html", - "main": "src/main/webapp/main.ts", + "browser": "src/main/webapp/main.ts", "polyfills": ["./src/main/webapp/sockjs-client.polyfill", "zone.js"], "tsConfig": "tsconfig.app.json", "inlineStyleLanguage": "scss", @@ -43,8 +43,7 @@ "sourceMap": false, "namedChunks": true, "extractLicenses": true, - "serviceWorker": true, - "ngswConfigPath": "ngsw-config.json", + "serviceWorker": "ngsw-config.json", "budgets": [ { "type": "initial", diff --git a/gradle/profile_dev.gradle b/gradle/profile_dev.gradle index b1415891..3fc82af0 100644 --- a/gradle/profile_dev.gradle +++ b/gradle/profile_dev.gradle @@ -45,7 +45,7 @@ task webapp(type: NpmTask) { inputs.dir("src/main/webapp/") .withPropertyName("webapp-source-dir") .withPathSensitivity(PathSensitivity.RELATIVE) - outputs.dir("build/resources/main/static/") + outputs.dir("build/resources/main/static/browser/") .withPropertyName("webapp-build-dir") dependsOn npmInstall diff --git a/gradle/war.gradle b/gradle/war.gradle index 28c0706e..85b0963d 100644 --- a/gradle/war.gradle +++ b/gradle/war.gradle @@ -7,7 +7,7 @@ bootWar { } war { - webAppDirName = "build/resources/main/static/" + webAppDirName = "build/resources/main/static/browser/" webXml = file("${project.rootDir}/src/main/webapp/WEB-INF/web.xml") enabled = true archiveExtension = "war.original" diff --git a/src/main/java/de/tum/cit/ase/config/WebConfigurer.java b/src/main/java/de/tum/cit/ase/config/WebConfigurer.java index a0bbbd4f..6c85b860 100644 --- a/src/main/java/de/tum/cit/ase/config/WebConfigurer.java +++ b/src/main/java/de/tum/cit/ase/config/WebConfigurer.java @@ -59,7 +59,7 @@ private void setLocationForStaticAssets(WebServerFactory server) { if (server instanceof ConfigurableServletWebServerFactory servletWebServer) { File root; String prefixPath = resolvePathPrefix(); - root = new File(prefixPath + "build/resources/main/static/"); + root = new File(prefixPath + "build/resources/main/static/browser/"); if (root.exists() && root.isDirectory()) { servletWebServer.setDocumentRoot(root); } diff --git a/src/test/java/de/tum/cit/ase/config/WebConfigurerTest.java b/src/test/java/de/tum/cit/ase/config/WebConfigurerTest.java index 7d07406c..b94c4309 100644 --- a/src/test/java/de/tum/cit/ase/config/WebConfigurerTest.java +++ b/src/test/java/de/tum/cit/ase/config/WebConfigurerTest.java @@ -57,7 +57,7 @@ void shouldCustomizeServletContainer() { assertThat(container.getMimeMappings().get("html")).isEqualTo("text/html"); assertThat(container.getMimeMappings().get("json")).isEqualTo("application/json"); if (container.getDocumentRoot() != null) { - assertThat(container.getDocumentRoot()).isEqualTo(new File("build/resources/main/static/")); + assertThat(container.getDocumentRoot()).isEqualTo(new File("build/resources/main/static/browser/")); } }