Skip to content

Commit

Permalink
Merge pull request #20 from manoelcampos/dotenv3
Browse files Browse the repository at this point in the history
Upgrade to dotenv-java 3.0.0 with supports JDK 11
  • Loading branch information
paulschwarz authored May 10, 2023
2 parents 9697c60 + 94c51b0 commit 05d9de3
Show file tree
Hide file tree
Showing 16 changed files with 258 additions and 158 deletions.
12 changes: 4 additions & 8 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,18 @@ jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\/v/}
- name: Set up JDK 11
uses: actions/setup-java@v1
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: 11
- name: Cache Gradle packages
uses: actions/cache@v1
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle
cache: 'gradle'
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
Expand Down
18 changes: 6 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,28 @@ name: CI

on:
push:
branches:
- master
branches: [ master, main ]
tags-ignore:
- '**'
pull_request:
branches:
- master
branches: [ master, main ]
tags-ignore:
- '**'

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\/v/}
- name: Set up JDK 11
uses: actions/setup-java@v1
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: 11
- name: Cache Gradle packages
uses: actions/cache@v1
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle
cache: 'gradle'
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
Expand Down
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ It is not always practical to set environment variables on development machines

## Installation

The current version requires JDK 11 or newer.
If you your project depends on an older JDK, use
[spring-dotenv 3.0.0](https://github.com/paulschwarz/spring-dotenv/releases/tag/v3.0.0).

### ... but first!

Add this to .gitignore
Expand Down Expand Up @@ -133,6 +137,15 @@ Prior to version 3, the library expected properties to be prefixed with `env.`.
prefix=env.
```

## Building spring-dotenv

Inside a terminal at the project root directory, type the following command.
Set the release version as you wish (if you are creating a new release) or based on the latest version in GitHub.

```shell
RELEASE_VERSION=0.0.0 ./gradlew build
```

## Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Expand Down
11 changes: 11 additions & 0 deletions examples/spring-app-example/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
## Spring example

## Build and Running

Set the release version as you wish (if you are creating a new release) or based on the latest version in GitHub.

```
export RELEASE_VERSION=0.0.0
../../gradlew build
java -cp build/libs/spring-app-example-$RELEASE_VERSION-all.jar examples.SpringAppDemoApplication
```
20 changes: 14 additions & 6 deletions examples/spring-app-example/build.gradle
Original file line number Diff line number Diff line change
@@ -1,20 +1,28 @@
plugins {
id 'application'
id 'com.github.johnrengelman.shadow' version '7.0.0'
}

mainClassName = 'example.SpringDemoApplication'
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11

jar {
enabled = false
enabled = true
}

shadowJar {
version = prop('release.version', 'RELEASE_VERSION')
manifest {
attributes 'Main-Class': 'examples.SpringAppDemoApplication'
}
}

dependencies {
implementation project(':spring-dotenv')
implementation platform('org.springframework:spring-framework-bom:5.3.24')
implementation 'org.springframework:spring-context'
implementation 'org.slf4j:slf4j-api:2.0.3'
runtimeOnly 'org.apache.logging.log4j:log4j-slf4j2-impl:2.19.0'
runtimeOnly 'org.apache.logging.log4j:log4j-core:2.19.0'
implementation 'org.slf4j:slf4j-api:2.0.7'
runtimeOnly 'org.apache.logging.log4j:log4j-slf4j2-impl:2.20.0'
runtimeOnly 'org.apache.logging.log4j:log4j-core:2.20.0'
}
9 changes: 9 additions & 0 deletions examples/spring-boot-example/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
## Spring boot example

## Running

Set the release version as you wish (if you are creating a new release) or based on the latest version in GitHub.

```
RELEASE_VERSION=0.0.0 ../../gradlew bootRun
```
4 changes: 2 additions & 2 deletions examples/spring-boot-example/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ bootJar {
enabled = false
}

sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11

dependencies {
implementation project(':spring-dotenv')
Expand Down
8 changes: 8 additions & 0 deletions examples/spring-jakarta-webapp-example/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## Spring framework example with Jakarta EE

Does not work and not expected to work until Spring supports Jakarta EE.

## Running

Set the release version as you wish (if you are creating a new release) or based on the latest version in GitHub.

```
RELEASE_VERSION=0.0.0 ../../gradlew appRun
```
10 changes: 5 additions & 5 deletions examples/spring-jakarta-webapp-example/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ plugins {
id 'org.gretty' version '4.0.3'
}

sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11

jar {
enabled = false
Expand All @@ -18,7 +18,7 @@ dependencies {
implementation project(':spring-dotenv')
implementation platform('org.springframework:spring-framework-bom:5.3.24')
implementation 'org.springframework:spring-webmvc'
implementation 'org.slf4j:slf4j-api:2.0.3'
runtimeOnly 'org.apache.logging.log4j:log4j-slf4j2-impl:2.19.0'
runtimeOnly 'org.apache.logging.log4j:log4j-core:2.19.0'
implementation 'org.slf4j:slf4j-api:2.0.7'
runtimeOnly 'org.apache.logging.log4j:log4j-slf4j2-impl:2.20.0'
runtimeOnly 'org.apache.logging.log4j:log4j-core:2.20.0'
}
6 changes: 5 additions & 1 deletion examples/spring-javaee-webapp-example/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
## Spring framework example with Java EE

## Running

Set the release version as you wish (if you are creating a new release) or based on the latest version in GitHub.

```
./gradlew appRun
RELEASE_VERSION=0.0.0 ../../gradlew appRun
```
12 changes: 6 additions & 6 deletions examples/spring-javaee-webapp-example/build.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
plugins {
id 'java'
id 'org.gretty' version '3.1.0'
id 'org.gretty' version '4.0.3'
}

sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11

jar {
enabled = false
Expand All @@ -18,7 +18,7 @@ dependencies {
implementation project(':spring-dotenv')
implementation platform('org.springframework:spring-framework-bom:5.3.24')
implementation 'org.springframework:spring-webmvc'
implementation 'org.slf4j:slf4j-api:2.0.3'
runtimeOnly 'org.apache.logging.log4j:log4j-slf4j2-impl:2.19.0'
runtimeOnly 'org.apache.logging.log4j:log4j-core:2.19.0'
implementation 'org.slf4j:slf4j-api:2.0.7'
runtimeOnly 'org.apache.logging.log4j:log4j-slf4j2-impl:2.20.0'
runtimeOnly 'org.apache.logging.log4j:log4j-core:2.20.0'
}
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 05d9de3

Please sign in to comment.