我有一个模块化gradle应用程序:一个服务组件(spring boot,kotlin)和一个有角度的前端。
两者都可以单独工作,并且在开发过程中应用程序按预期工作。我创建了顶级构建文件,如下所示:
顶级gradle文件:
plugins {
id 'com.gradle.build-scan' version '1.16'
}
buildScan {
termsOfServiceUrl = 'https://gradle.com/terms-of-service'
termsOfServiceAgree = 'yes'
publishAlways()
}
allprojects {
group = 'my.domain'
version = '0.0.1-SNAPSHOT'
}
UI角度项目中的gradle文件:
plugins {
id 'java'
id 'com.moowork.node' version '1.2.0'
}
node {
version = '10.13.0'
npmVersion = '6.4.1'
download = true
}
jar.dependsOn 'npm_run_build'
jar {
from 'dist/myproject-ui' into 'static'
}
服务中的gradle文件(春季启动项目):
buildscript {
ext {
kotlinVersion = '1.2.71'
springBootVersion = '2.1.0.RELEASE'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}")
classpath("org.jetbrains.kotlin:kotlin-allopen:${kotlinVersion}")
classpath("org.jetbrains.kotlin:kotlin-noarg:${kotlinVersion}")
}
}
plugins {
id "org.jetbrains.kotlin.jvm" version "1.3.10"
id "org.jetbrains.kotlin.plugin.spring" version "1.3.10"
id "org.jetbrains.kotlin.plugin.jpa" version "1.3.10"
id "org.springframework.boot" version "2.1.0.RELEASE"
id "io.spring.dependency-management" version "1.0.6.RELEASE"
}
sourceCompatibility = 1.8
compileKotlin {
kotlinOptions {
freeCompilerArgs = ["-Xjsr305=strict"]
jvmTarget = "1.8"
}
}
compileTestKotlin {
kotlinOptions {
freeCompilerArgs = ["-Xjsr305=strict"]
jvmTarget = "1.8"
}
}
repositories {
mavenCentral()
}
dependencies {
implementation('org.springframework.boot:spring-boot-starter-data-jpa')
implementation('org.springframework.boot:spring-boot-starter-web')
implementation('org.springframework.boot:spring-boot-starter-mail')
implementation('com.fasterxml.jackson.module:jackson-module-kotlin')
implementation('org.flywaydb:flyway-core')
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
implementation("org.jetbrains.kotlin:kotlin-reflect")
implementation("javax.mail:mail:1.5.0-b01")
implementation(project(':myproject-ui'))
runtimeOnly('org.postgresql:postgresql')
testImplementation('org.springframework.boot:spring-boot-starter-test')
}
构建了jar,当我启动jar并转到localhost:8080时,将显示应用程序的UI。好的开始。 但是,如果我使用用户界面中定义的任何路由(例如:localhost:8080 / user / someid)转到应用程序, 我收到未找到的404。正常导航到有角度的应用程序时,这不是问题,该应用程序可以 预期的。
我在做什么错了?