Don't know how to include joinfaces into a multi module gradle build

194 views Asked by At

An old application of mine is a Java 8 Enterprise mololith and i want to migrate it.

I want to migrate it into a spring boot project including primefaces, myfaces and omnifaces by using joinfaces and split it into smaller parts (multi-modules-project) for better maintainance.

So i split the project into the following modules to became an working prototype:

Project overview

Short description of the modules:

  • Common / ComDb : Here are only generated JPA entities / classed directly from the database which classes can be used by all modules
  • Libraries / LibPrimeFaces : Here are only the latest primefaces elite JAR's which should be used in SpringBoot
  • Libraries / LibPrimeFacesTheme : Here are a buyed primefaces theme which will be bundeled and included by a generated JAR.
  • Services / * : Each spring boot service which should be used is located here, so it can be used in the main application or from an external service over REST
  • Application : Here is the spring boot application which should include all of the things above - even a runnable jar-file at last

The problem now for me is the usage of gradle which is completly new for me:

I dont't know how to integrate joinfaces in combination with my buyed primefaces-8.0.5.jar from elite subscription, omnifaces 3 and myfaces by using gradle.

The most manuals are for maven, but it seems that they are not working for gradle if i convert the scripts.

Currently the whole project compiles and start without any errors but now i am at the point where i can't find a working example of using joinfaces and gradle in a multi module environment like mine.

Here are the main gradle-scripts:

The root-scripts:

gradle.properties (Holding the versions):

VersionSpringBoot=2.3.5.RELEASE
VersionSpringDependencyManagement=1.0.10.RELEASE
VersionPrimeFaces=8.0.5

settings.gradle (includes and names):

rootProject.name = 'EcoCalcDD4Web'
include 'Common:ComDb'
include 'Libraries:LibPrimeFaces'
include 'Services:ServiceConfigWebManagement'
include 'Application'

build.gradle (Main build file):

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'
    }
}

And here the application build.gradle - file where JoinFaces should be used with my primefaces, omnifaces and myfaces. Here i don't know what to add to get all started with 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()
}
1

There are 1 answers

0
larsgrefer On

At first, you should have a look at these resources:

To get started with JoinFaces, you need a dependency on org.joinfaces:jsf-spring-boot-starter. Because you want to use MyFaces instead of Mojarra, you have to exclude it and pull MyFaces instead.

I'd start with these dependencies:

    implementation ("org.joinfaces:jsf-spring-boot-starter") {
        exclude module: "mojarra-spring-boot-starter"
    }
    implementation "org.joinfaces:myfaces-spring-boot-starter"
    implementation "org.joinfaces:omnifaces1-spring-boot-starter"