Skip to content

Commit

Permalink
Migrate to Java 21 (#119)
Browse files Browse the repository at this point in the history
* Migrate to Java 21
  That way the project benefit from the last java features and keep tech debt under control
* Update docker-compose
  That way it is more independent of the host
  • Loading branch information
sebastienvermeille authored Nov 14, 2023
1 parent 45e518c commit 7b4af2a
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .code/docker-compose/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ services:
# - mqtt-server
# image: cookiecodedev/rika2mqtt
# environment:
# - MQTT_HOST=localhost
# - MQTT_HOST=mqtt-server
# - MQTT_USERNAME=testuser
# - MQTT_PASSWORD=secret
# - RIKA_EMAIL=<your email>
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up JDK 20
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
java-version: '20'
java-version: '21'
distribution: 'temurin'
- name: Check code formatting
run: mvn -B com.spotify.fmt:fmt-maven-plugin:check
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Set up Java for building
uses: actions/setup-java@v3
with:
java-version: '20'
java-version: '21'
distribution: 'temurin'
- name: Set version in pom.xml as github run build number for traceability
run: mvn -B versions:set -DnewVersion=${{github.run_number}} -DgenerateBackupPoms=false
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- name: Set up Java for publishing to Maven Central Repository
uses: actions/setup-java@v3
with:
java-version: '20'
java-version: '21'
distribution: 'temurin'
server-id: ossrh
server-username: MAVEN_USERNAME
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/sonar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ jobs:
name: BUILD_FILES
- name: List files
run: ls
- name: Set up JDK 20
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
java-version: '20'
java-version: '21'
distribution: 'temurin'
- name: SonarCloud Scan on PR
if: github.event.workflow_run.event == 'pull_request'
Expand All @@ -75,10 +75,10 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- name: Set up JDK 20
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
java-version: '20'
java-version: '21'
distribution: 'temurin'
- name: Build on push for sonarscan (not PR branch)
if: github.event.workflow_run.event == 'push' && github.event.workflow_run.head_repository.full_name == github.event.repository.full_name
Expand Down
2 changes: 1 addition & 1 deletion .mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.7/apache-maven-3.8.7-bin.zip
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.4/apache-maven-3.9.4-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@
# THE SOFTWARE.
#

FROM eclipse-temurin:20.0.2_9-jre-jammy
FROM eclipse-temurin:21.0.1_12-jre-jammy

RUN mkdir -p /opt/rika2mqtt

WORKDIR /opt/rika2mqtt
COPY .docker/ .
COPY bridge/target/*.jar rika2mqtt.jar
COPY bridge/target/rika2mqtt.jar rika2mqtt.jar
RUN sh -c 'touch rika2mqtt.jar'

RUN chmod a+x init.sh

# set the startup command to run
ENTRYPOINT ["/opt/rika2mqtt/init.sh"]
ENTRYPOINT ["/opt/rika2mqtt/init.sh"]
19 changes: 19 additions & 0 deletions bridge/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,25 @@
</configuration>
<groupId>org.springframework.boot</groupId>
</plugin>
<plugin>
<groupId>com.coderplus.maven.plugins</groupId>
<artifactId>copy-rename-maven-plugin</artifactId>
<version>1.0</version>
<executions>
<execution>
<id>copy-rename-file</id>
<phase>install</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<!-- copy rika2mqtt-bridge-<version>.jar rika2mqtt.jar file (ease copy from Dockerfile -->
<sourceFile>target/rika2mqtt-bridge-${project.version}.jar</sourceFile>
<destinationFile>target/rika2mqtt.jar</destinationFile>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
<packaging>pom</packaging>

<properties>
<java.sdk.version>20</java.sdk.version>
<java.sdk.version>21</java.sdk.version>
<source.encoding>UTF-8</source.encoding>
<rika2mqtt.root>${basedir}</rika2mqtt.root>
<!-- dependencies version-->
Expand Down
2 changes: 1 addition & 1 deletion scripts/docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ set -e

echo "Building docker image cookiecodedev/rika2mqtt:latest"

docker build . -t cookiecodedev/rika2mqtt:latest
docker build . -t cookiecodedev/rika2mqtt:latest

0 comments on commit 7b4af2a

Please sign in to comment.