title: Package war of angular and spring boot application gradle
body: <p>I am working on a spring boot angular application. I have created a Get rest method on backend and for the front end I have use angular to show the result.</p>
  <p>Here is the structure of the project.</p>
  <p><a href="https://i.stack.imgur.com/awqBU.jpg" rel="nofollow noreferrer">Project structure</a></p>
  <p>I have to package the application as a war (spring boot + angular). I have managed to create the war and deploy it on Weblogic server but only the REST Get method works, I can not display the front end.</p>
  <p>Here is my build.gradle file:</p>
  <pre><code>plugins {
  id 'org.springframework.boot' version '2.3.3.RELEASE'
  id 'io.spring.dependency-management' version '1.0.10.RELEASE'
  id 'java'
  id 'war'
  }
  
  group = 'com.dannti'
  version = '0.0.1-SNAPSHOT'
  sourceCompatibility = '1.8'
  
  repositories {
  mavenCentral()
  }
  
  war {
    enabled=true
  }
  
  dependencies {
  implementation 'org.springframework.boot:spring-boot-starter-web'
  implementation 'org.springframework.boot:spring-boot-starter-websocket'
  providedRuntime 'org.springframework.boot:spring-boot-starter-tomcat'
  testImplementation('org.springframework.boot:spring-boot-starter-test') {
      exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
  }
  }
  
  test {
  useJUnitPlatform()
   }
  
   def webappDir = &quot;$projectDir/src/main/webapp&quot;
  
  processResources {
  dependsOn &quot;buildAngular&quot;
  }
  
  task buildAngular(type:Exec) {
  // installAngular should be run prior to this task
  dependsOn &quot;installAngular&quot;
  workingDir &quot;$webappDir&quot;
  inputs.dir &quot;$webappDir&quot;
  // Add task to the standard build group
  group = BasePlugin.BUILD_GROUP
  // ng doesn't exist as a file in windows -&gt; ng.cmd
  if (System.getProperty(&quot;os.name&quot;).toUpperCase().contains(&quot;WINDOWS&quot;)){
      commandLine &quot;ng.cmd&quot;, &quot;build&quot;
    } else {
      commandLine &quot;ng&quot;, &quot;build&quot;
    }
  }
  
  task installAngular(type:Exec) {
   workingDir &quot;$webappDir&quot;
  inputs.dir &quot;$webappDir&quot;
  group = BasePlugin.BUILD_GROUP
  if (System.getProperty(&quot;os.name&quot;).toUpperCase().contains(&quot;WINDOWS&quot;)){
      commandLine &quot;npm.cmd&quot;, &quot;install&quot;
  } else {
      commandLine &quot;npm&quot;, &quot;install&quot;
  }
  }
  </code></pre>
  <p>I think I should add something on build.gradle file but I do not know how to do it and I did not manage to find examples</p>
  <p>EDIT:</p>
  <p>I have added a modification in file by changing the directory where the result of angular build to &quot;../resources/static&quot;</p>
  <pre><code>          &quot;builder&quot;: &quot;@angular-devkit/build-angular:browser&quot;,
        &quot;options&quot;: {
          &quot;outputPath&quot;: &quot;../resources/static&quot;,
          &quot;index&quot;: &quot;src/index.html&quot;,
          &quot;main&quot;: &quot;src/main.ts&quot;,
          &quot;polyfills&quot;: &quot;src/polyfills.ts&quot;,
          &quot;tsConfig&quot;: &quot;tsconfig.app.json&quot;,
  </code></pre>
  <p>But now I have an error that the js files of the angular application are not found.<br />
  Thank you.</p>