opendevstack / ods-project-quickstarters

CAUTION! This repo is DEPRECATED. For ODS 2+, please see ods-quickstarters repository.
Apache License 2.0
10 stars 19 forks source link

spring boot qs latest (2.x) - generates 4.10 build.gradle - leads to compile failure(s) - missing params .. #131

Closed clemensutschig closed 5 years ago

clemensutschig commented 5 years ago

[cleke-cd-be-spring-boot-test] Running shell script

Welcome to Gradle 4.10.2!

Here are the highlights of this release:

For more details see https://docs.gradle.org/4.10.2/release-notes.html

FAILURE: Build failed with an exception.


This is because of https://github.com/opendevstack/ods-project-quickstarters/blob/master/boilerplates/be-springboot/init.sh#L55

which generates the needed lines

the build gradle generated now ...

plugins {
    id 'org.asciidoctor.convert' version '1.5.3'
    id 'org.springframework.boot' version '2.1.3.RELEASE'
    id 'java'
}

apply plugin: 'io.spring.dependency-management'

group = 'cleke'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'

looks like the whole ext {} section with "springBootVersion = '1.5.15.RELEASE'" is missing when you generate with spring boot 2.0.2 ...

code to generate:

springboot init --build=gradle --java-version=1.8 --groupId=cleke --artifactId=be-spring-boot --package-name=com.bix_digital.cleke.be_spring_boot --packaging=jar --dependencies=web,jersey,data-jpa,h2,lombok,data-rest,restdocs,security be-spring-boot

clemensutschig commented 5 years ago

@stitakis - can you please look into that asap...?!

clemensutschig commented 5 years ago

it looks like the sed replace to generate the nexus lines is not working anymore .. below is a working example

    ext {
        springBootVersion = '1.5.15.RELEASE'
        // fix for not set system variable
        nexus_url =  "${project.findProperty('nexus_url') ?: System.getenv('NEXUS_HOST')}"
        nexus_user =  "${project.findProperty('nexus_user') ?: System.getenv('NEXUS_USERNAME')}"
        nexus_pw =  "${project.findProperty('nexus_pw') ?: System.getenv('NEXUS_PASSWORD')}"
    }
clemensutschig commented 5 years ago

after adding a project.ext {} block with nexus params - mavenDeployer unknown

` A problem occurred evaluating root project 'be-spring-boot'.

Could not find method mavenDeployer() for arguments [build_8zfjksubn6d5jf11d54agj8rz$_run_closure5$_closure12$_closure13@48a46b0f] on repository container of type org.gradle.api.internal.artifacts.dsl.DefaultRepositoryHandler. `

and then

test {
    outputs.dir snippetsDir
}

asciidoctor {
    inputs.dir snippetsDir
    dependsOn test
}

failing with `

clemensutschig commented 5 years ago

An approach "could be" - to check for the version that is generated ... and for 4.10 copy a template from the context ... and replace group id etc. and leave for 4.9 as is ...

ods-provisioning-app/gradle/wrapper (production_BI_PROD) $ version=$(grep /gradle-. gradle-wrapper.properties | cut -d "-" -f2) $ echo $version 4.9

$ if [ "$version" == 4.10 ]; then echo "4.10"; else echo "not"; fi not

@michaelsauter / @stitakis - thoughts?

stitakis commented 5 years ago

I had a look at this... to fix the missing variable definition of "snippetsDir", we need to define the variable and add restdocs dependencies to the dependencies block... this worked for my in test project:

  1. define the variable snippetsDir adn version of restdocs
    
    ext { 
    snippetsDir = file('build/generated-snippets')
    }

ext['spring-restdocs.version'] = '2.0.2.RELEASE'

repositories { ... }

2. add in dependencies definition:

testCompile "org.springframework.restdocs:spring-restdocs-webtestclient:${project.ext['spring-restdocs.version']}" asciidoctor "org.springframework.restdocs:spring-restdocs-asciidoctor:${project.ext['spring-restdocs.version']}"

clemensutschig commented 5 years ago

@michaelsauter @stitakis maybe you can grab the branch quickly onto BI X .. and test there (with 4.9)..