https://github.com/eitansuez/boot-gradle-target
Simple example illustrating control over java version with gradle sourceCompatibility and targetCompatibility flags.
https://github.com/eitansuez/boot-gradle-target
Last synced: 9 months ago
JSON representation
Simple example illustrating control over java version with gradle sourceCompatibility and targetCompatibility flags.
- Host: GitHub
- URL: https://github.com/eitansuez/boot-gradle-target
- Owner: eitansuez
- Created: 2018-12-31T23:50:53.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-12-31T23:51:09.000Z (over 7 years ago)
- Last Synced: 2025-01-08T14:43:24.961Z (over 1 year ago)
- Language: Java
- Homepage:
- Size: 53.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Example boot project illustrating use of sourceCompatibility.
## Assumptions
* You have openjdk-11 installed on your machine and `$JAVA_HOME/bin` is in your `$PATH`
## java 8 compatibility
#### Given
Note in `build.gradle` the following line:
```
sourceCompatibility = 1.8
```
### When
Build the project:
```
$ gradle clean build
```
### Then
Test the java version of a generated class file:
```
javap -v ./build/classes/java/main/com/eitan/bootgradletarget/HelloController.class | grep major
```
The output should be:
```
major version: 52
```
## java 11 compatibility
Edit `build.gradle` and set `sourceCompatibility` to `1.11`, and repeat the above steps:
1. do a clean build
2. re-run javap
3. the output should now state `major version: 55`