groupe-sii / ogham

Sending email, sms or whatever is a piece of cake
https://groupe-sii.github.io/ogham/
Apache License 2.0
21 stars 15 forks source link

Add support for all Spring boot versions #65

Closed aurelien-baudet closed 5 years ago

aurelien-baudet commented 5 years ago

Update spring-initializer project to use initializr-web version 0.7.0.RELEASE. Configure application.yml to support new Spring Boot metadata. Add tests to ensure that Ogham works with every Spring Boot version (even old ones).

aurelien-baudet commented 5 years ago

initializr-web version 0.7.0.RELEASE has a restriction on Spring Boot version that is hard coded.

Solutions:

aurelien-baudet commented 5 years ago

It is possible to run spring-initializr to run an old version like this:

./mvnw spring-boot:run -Dspring-boot.version=1.5.21.RELEASE -Dspring-initializr.version=0.4.0.RELEASE -Dspring-boot.run.jvmArguments="-Dspring.profiles.active=older-versions"

With this configuration:

server:
  port: 8052
initializr:
  bootVersions:
    - id: 1.3.8.RELEASE
      name: 1.3.8
      default: false
    - id: 1.4.7.RELEASE
      name: 1.4.7
      default: true
  javaVersions:
    - id: 1.8
      default: true
  languages:
    - name: Java
      id: java
      default: true
  types:
    - name: Maven Project
      id: maven-project
      description: Generate a Maven based project archive
      tags:
        build: maven
        format: project
      default: true
      action: /starter.zip
    - name: Gradle Project
      id: gradle-project
      description: Generate a Gradle based project archive
      tags:
        build: gradle
        format: project
      default: false
      action: /starter.zip
  packagings:
    - name: Jar
      id: jar
      default: true
    - name: War
      id: war
      default: false
  dependencies:
    - name: Core
      content:
        - name: Configuration Processor
          id: configuration-processor
          groupId: org.springframework.boot
          artifactId: spring-boot-configuration-processor
          scope: compileOnly
          description: Generate metadata for your custom configuration keys
          starter: false
        - name: DevTools
          id: devtools
          groupId: org.springframework.boot
          artifactId: spring-boot-devtools
          scope: runtime
          description: Spring Boot Development Tools
          starter: false
        - name: Lombok
          id: lombok
          groupId: org.projectlombok
          artifactId: lombok
          scope: compileOnly
          description: Java annotation library which helps to reduce boilerplate code and code faster
          starter: false
          mappings:
            - versionRange: "[1.3.0.RELEASE,1.4.0.RELEASE)"
              version: 1.16.6
    - name: Web
      content:
        - name: Web
          id: web
          description: Full-stack web development with Tomcat and Spring MVC
          facets:
            - web
    - name: Template Engines
      content:
        - name: Thymeleaf
          id: thymeleaf
          description: Thymeleaf templating engine, including integration with Spring
          facets:
            - web
        - name: Freemarker
          id: freemarker
          description: FreeMarker templating engine
          facets:
            - web
    - name: I/O
      content:
        - name: Mail
          id: mail
          description: javax.mail

And then run ogham-test-classpath with this configuration:

spring-matrix:
  java:
    - 1.8
  build:
    - maven
  spring-boot-version:
#    - 1.3.8.RELEASE
    - 1.4.7.RELEASE
  spring-boot-dependencies:
    -
    - web
    - thymeleaf
    - freemarker
    - mail
    - web+thymeleaf
    - web+freemarker
  ogham-dependencies:
    - spring-boot-autoconfigure
    - spring-boot-starter-email
    - spring-boot-starter-sms
    - spring-boot-starter-all

standalone-matrix:
  java:
    - 1.8
    - 9
    - 10
    - 11
    - 12
  build:
    - maven
  ogham-dependencies:
    - core
    - email-javamail
    - email-sendgrid
    - sms-ovh
    - sms-cloudhopper
    - all
    - spring-boot-autoconfigure+core
    - spring-boot-autoconfigure+email-javamail
    - spring-boot-autoconfigure+email-sendgrid
    - spring-boot-autoconfigure+sms-cloudhopper
    - spring-boot-autoconfigure+sms-ovh
    - spring-boot-autoconfigure+all
    - spring-boot-starter-email
    - spring-boot-starter-sms
    - spring-boot-starter-all

spring.initializer.url: http://localhost:8052/starter.zip

Works

Fails

What to do ?

Decision to make 1) Either spend time to make it work (could be useful to avoid issues for developers that want to use an old Spring Boot version) 2) Or postpone until someone encounters the issue (some developer that would like to run Ogham with Spring Boot 1.4.x) 3) Or drop support for Spring Boot 1.4.x (it is already supported but CI environment fails. Supporting 1.4.x may later lead to other issues that could make development of Ogham more constrained)


Working code is on branch: refactoring/upgrade/support-spring-boot-older-versions (commit: 5b40e26f129ae0ef9af89f0943b33318780d2828)

aurelien-baudet commented 5 years ago

Solution 1 done