我的一个旧应用程序是 Java 8 Enterprise mololith,我想迁移它。
我想通过使用连接面将其迁移到包括primefaces、myfaces和omnifaces的spring boot项目中,并将其拆分为更小的部分(多模块项目)以便更好地维护。
所以我将项目分成以下模块,成为一个工作原型:
模块的简短描述:
- Common / ComDb :这里只生成 JPA 实体/直接从数据库分类,所有模块都可以使用哪些类
- Libraries / LibPrimeFaces :这里只是最新的 primefaces 精英 JAR,应该在 SpringBoot 中使用
- Libraries / LibPrimeFacesTheme :这是一个购买的 primefaces 主题,将捆绑并包含在生成的 JAR 中。
- Services / * :应该使用的每个spring boot服务都位于这里,因此可以在主应用程序中使用,也可以通过REST从外部服务中使用
- 应用程序:这是 Spring Boot 应用程序,它应该包括上述所有内容 - 最后甚至是一个可运行的 jar 文件
现在对我来说的问题是 gradle 的使用,这对我来说是全新的:
我不知道如何使用 gradle 将 joinfaces 与我从精英订阅、omnifaces 3 和 myfaces 购买的 primefaces-8.0.5.jar 结合起来。
大多数手册适用于 maven,但如果我转换脚本,它们似乎不适用于 gradle。
目前整个项目编译并启动没有任何错误,但现在我找不到在像我这样的多模块环境中使用连接面和 gradle 的工作示例。
以下是主要的 gradle 脚本:
根脚本:
gradle.properties(保存版本):
VersionSpringBoot=2.3.5.RELEASE
VersionSpringDependencyManagement=1.0.10.RELEASE
VersionPrimeFaces=8.0.5
settings.gradle(包括和名称):
rootProject.name = 'EcoCalcDD4Web'
include 'Common:ComDb'
include 'Libraries:LibPrimeFaces'
include 'Services:ServiceConfigWebManagement'
include 'Application'
build.gradle(主构建文件):
buildscript {
repositories {
mavenCentral()
maven {
url './Libraries/LibPrimeFaces'
}
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${VersionSpringBoot}")
}
}
allprojects {
group = 'com.skf.rocket'
version = '1.0.0'
repositories {
mavenCentral()
maven {
url './Libraries/LibPrimeFaces'
}
}
}
subprojects {
apply plugin: 'java-library'
apply plugin: 'io.spring.dependency-management'
repositories {
mavenCentral()
maven {
url './Libraries/LibPrimeFaces'
}
}
dependencyManagement {
imports {
mavenBom("org.springframework.boot:spring-boot-dependencies:${VersionSpringBoot}")
}
}
dependencies {
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}
}
这里是应用程序 build.gradle - JoinFaces 应该与我的 primefaces、omnifaces 和 myfaces 一起使用的文件。在这里,我不知道要添加什么才能开始使用 joinfaces:
apply plugin: 'org.springframework.boot'
bootJar {
mainClassName = "com.skf.rocket.EcoCalcDd4WebRocket"
}
// Maven dependencies
dependencies {
// Internal dependencies
api project(':Common:ComDb')
// Implementation project('Libraries:LibPrimeFacesTheme')
api project(':Services:ServiceConfigWebManagement')
// External dependencies
// JoinFaces + MyFaces + PrimeFaces - TODO ??
// Development tools with HotReDeploy
developmentOnly 'org.springframework.boot:spring-boot-devtools'
// Automatically configuration
annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor'
// Lombok - Utility
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
// Global cache
implementation 'org.springframework.boot:spring-boot-starter-cache'
// Data access + MS SQL driver
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
runtimeOnly 'com.microsoft.sqlserver:mssql-jdbc'
// Data validation
implementation 'org.springframework.boot:spring-boot-starter-validation'
// Web + RestService
implementation 'org.springframework.boot:spring-boot-starter-web'
// Session management
implementation 'org.springframework.session:spring-session-core'
// Boot Acturator - Application monitoring and alive checks
compile group: 'org.springframework.boot', name: 'spring-boot-starter-actuator'
// Unit test
testImplementation('org.springframework.boot:spring-boot-starter-test') {
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}
}
test {
useJUnitPlatform()
}