Skip to content

Commit

Permalink
[ANCHOR-857] [legacy/core-1.0] Migrate javax to jakarta and upgrade t…
Browse files Browse the repository at this point in the history
…o JDK-17 (#1578)

### Description

- Migrate `javax` to `jakarta` and upgrade to JDK-17
  • Loading branch information
lijamie98 authored Nov 19, 2024
2 parents 5459846 + b0feea8 commit ce50d4e
Show file tree
Hide file tree
Showing 20 changed files with 79 additions and 175 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
java-version: '11'
java-version: '17'
distribution: 'adopt'
- name: Clean
run: ./gradlew clean
Expand Down
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,14 @@

## Unreleased

## 1.0.13
## 1.0.21
* Add new field to the JWT token [#885](https://github.com/stellar/java-stellar-anchor-sdk/pull/885)

## 1.0.13
* Upgrade to JDK-17
* Migrate `javax` to `jakarta` packages


## 1.0.12

### Updates
Expand Down
22 changes: 20 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
java
id("com.diffplug.spotless") version "6.2.1"
id("com.diffplug.spotless") version "6.24.0"
}

subprojects {
Expand All @@ -13,15 +13,33 @@ subprojects {
repositories {
mavenLocal()
mavenCentral()
maven { url = uri("https://packages.confluent.io/maven") }
maven { url = uri("https://repository.mulesoft.org/nexus/content/repositories/public/") }
maven { url = uri("https://jitpack.io") }
}

/** Specifies JDK-11 */
/** Specifies JDK-17 */
java { toolchain { languageVersion.set(JavaLanguageVersion.of(17)) } }

/** Enforces google-java-format at Java compilation. */
tasks.named("compileJava") { this.dependsOn("spotlessApply") }

spotless {
val javaVersion = System.getProperty("java.version")

if (javaVersion < "11") {
throw GradleException("Java 11 or greater is required for spotless Gradle plugin.")
}

java {
importOrder("java", "javax", "org.stellar")
removeUnusedImports()
googleJavaFormat()
}

kotlin { ktfmt("0.30").googleStyle() }
}

dependencies {
// The common dependencies are declared here because we would like to have a uniform unit
// testing across all subprojects.
Expand Down
18 changes: 8 additions & 10 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,18 @@ plugins {
id("org.jetbrains.kotlin.jvm") version "1.6.10"
}

version = "1.0.20"
version = "1.0.21"

dependencies {
compileOnly(libs.servlet.api)

compileOnly(libs.slf4j.api)
api(libs.lombok)

annotationProcessor(libs.lombok)

compileOnly(libs.servlet.api)

implementation(libs.apache.commons.lang3)
implementation(libs.log4j.core)
implementation(libs.httpclient)
Expand All @@ -22,11 +26,8 @@ dependencies {
implementation(libs.commons.codec)
implementation(libs.jjwt)
implementation(libs.reactor.core)
implementation(libs.javax.jaxb.api)
implementation("com.github.stellar:java-stellar-sdk:0.42.0")

// Lombok should be used by all sub-projects to reduce Java verbosity
annotationProcessor(libs.lombok)
implementation(libs.jakarta.xml.bind.api)
implementation(libs.java.stellar.sdk)

testImplementation(libs.servlet.api)
testImplementation(libs.slf4j.api)
Expand Down Expand Up @@ -95,8 +96,5 @@ publishing {
}

apply<SigningPlugin>()
configure<SigningExtension> {
useGpgCmd()
sign(publishing.publications)
}
configure<SigningExtension> { sign(publishing.publications) }
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import jakarta.servlet.*;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException;
import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import lombok.SneakyThrows;
import org.apache.http.HttpStatus;
import org.stellar.anchor.dto.SepExceptionResponse;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
@Data
public class Balance {
String amount;

/**
* The name of the currency that will be ultimately credited into the beneficiary user account. It
* should obey the {scheme}:{identifier} format described in <a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public class Payment {
String idTag;
Account sourceAccount;
Account destinationAccount;

/** The balance currency name contains the scheme of the destination network of the payment. */
Balance balance;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,9 @@ public ChallengeResponse createChallenge(ChallengeRequest challengeRequest) thro
}

public ValidationResponse validateChallenge(ValidationRequest validationRequest)
throws IOException, InvalidSep10ChallengeException, URISyntaxException,
throws IOException,
InvalidSep10ChallengeException,
URISyntaxException,
SepValidationException {
if (validationRequest == null || validationRequest.getTransaction() == null) {
throw new SepValidationException("{transaction} is required.");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package org.stellar.anchor.filter

import io.mockk.*
import javax.servlet.FilterChain
import javax.servlet.ServletException
import javax.servlet.ServletRequest
import javax.servlet.ServletResponse
import javax.servlet.http.HttpServletRequest
import javax.servlet.http.HttpServletResponse
import jakarta.servlet.FilterChain
import jakarta.servlet.ServletException
import jakarta.servlet.ServletRequest
import jakarta.servlet.ServletResponse
import jakarta.servlet.http.HttpServletRequest
import jakarta.servlet.http.HttpServletResponse
import org.apache.http.HttpStatus
import org.junit.jupiter.api.*
import org.junit.jupiter.api.Assertions.assertEquals
Expand Down
5 changes: 3 additions & 2 deletions data-spring-jdbc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
plugins {
`java-library`
id("org.springframework.boot") version "2.6.3"
id("io.spring.dependency-management") version "1.0.11.RELEASE"
id("org.springframework.boot") version "3.2.4"
id("io.spring.dependency-management") version "1.1.0"
}

dependencies {
Expand All @@ -11,6 +11,7 @@ dependencies {
implementation("org.springframework.boot:spring-boot")
implementation("org.springframework.boot:spring-boot-starter-data-jpa")


annotationProcessor(libs.lombok)

// From projects
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package org.stellar.anchor.server.data;

import com.google.gson.annotations.SerializedName;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import lombok.Data;
import org.stellar.anchor.model.Sep24Transaction;

Expand Down

This file was deleted.

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.5.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
11 changes: 8 additions & 3 deletions platform/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
plugins {
application
id("org.springframework.boot") version "2.6.3"
id("io.spring.dependency-management") version "1.0.11.RELEASE"
id("org.jetbrains.kotlin.jvm") version "1.6.10"
id("org.springframework.boot") version "3.2.4"
id("io.spring.dependency-management") version "1.1.0"
id("org.jetbrains.kotlin.jvm") version "1.9.10"
}

dependencies {
Expand All @@ -19,6 +19,11 @@ dependencies {
annotationProcessor(libs.lombok)
annotationProcessor("org.springframework.boot:spring-boot-configuration-processor")

// https://mvnrepository.com/artifact/jakarta.servlet/jakarta.servlet-api
implementation("jakarta.servlet:jakarta.servlet-api:6.1.0")



// From projects
implementation(project(":core"))
implementation(project(":payment-circle"))
Expand Down
1 change: 0 additions & 1 deletion platform/example.anchor-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ app-config:
# Spring Data JDBC settings
#
data-spring-jdbc-settings:
spring.jpa.database-platform: org.stellar.anchor.server.sqlite.SQLiteDialect
spring.jpa.hibernate.ddl-auto: update
spring.jpa.generate-ddl: true
spring.jpa.hibernate.show_sql: false
Expand Down
Loading

0 comments on commit ce50d4e

Please sign in to comment.