I want to deploy spring boot and angular application as a single war file. I have tried doing it as below,
Created a build.gradle file in angular application
plugins {
id 'java'
id "com.moowork.node" version "1.3.1"
}
// 2
node {
version = '10.15.3'
npmVersion = '6.9.0'
download = true
}
// 3
jar.dependsOn 'npm_run_build'
// 4
jar {
from 'dist/projectName' into 'static'
}
Added the following to the build.gradle file in spring boot project,
implementation(project(':angularProject')
Added the following to settings.gradle file in spring boot project,
include ':angularProject'
project(':angularProject').projectDir = new File('../angularProject')
When I build the spring boot project, I could see the angularProject in the spring boot project location but I want it to automatically display in the static folder in the resources folder in the spring boot project. Am I missing anything? Any help is much appreciated.
Edit:
Now, when building the project I'm getting the following error
Could not determine the dependencies of task ':war'.
> Could not resolve all task dependencies for configuration ':runtimeClasspath'.
> Could not resolve project :frontendProject.
Required by:
project :
> No matching variant of project :frontendProject.was found. The consumer was configured to find a runtime of a library compatible with Java 8, packaged as a jar, and its dependencies declared externally but:
- Variant 'apiElements' capability backendProjectName:frontendProject:unspecified declares a library, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares an API of a component compatible with Java 15 and the consumer needed a runtime of a component compatible with Java 8
- Variant 'runtimeElements' capability backendProjectName:frontendProject:unspecified declares a runtime of a library, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares a component compatible with Java 15 and the consumer needed a component compatible with Java 8
Thank you.