Skip to content

Commit

Permalink
Upgrade to Java 11 and use jakarta instead of javax
Browse files Browse the repository at this point in the history
  • Loading branch information
thewaterfall committed Feb 1, 2025
1 parent 5ff299e commit b94fd2a
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 16 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Ip4j

Ip4j is a small, simple and zero dependencies Java 8+ library for retrieving a request IP address from an
Ip4j is a small, simple and zero dependencies Java 11+ library for retrieving a request IP address from an
`HttpServletRequest`. It supports various headers commonly used in web applications to forward client IP addresses.

## Features
Expand Down
19 changes: 10 additions & 9 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ group 'org.waterfallio'
version '1.0.0'

java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

tasks.withType(JavaCompile) {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
options.release = 11
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

publishing {
Expand All @@ -26,7 +27,7 @@ publishing {

pom {
name = 'Ip4J'
description = 'Ip4j is a small and simple Java 8+ library for retrieving an IP address from request'
description = 'Ip4j is a small and simple Java 11+ library for retrieving an IP address from request'

licenses {
license {
Expand All @@ -44,13 +45,13 @@ repositories {
}

dependencies {
compileOnly 'javax.servlet:javax.servlet-api:4.0.1'
compileOnly 'jakarta.servlet:jakarta.servlet-api:6.0.0'

testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1'
testImplementation 'javax.servlet:javax.servlet-api:4.0.1'
testImplementation 'jakarta.servlet:jakarta.servlet-api:6.0.0'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1'
testImplementation 'org.mockito:mockito-junit-jupiter:4.11.0'
testImplementation 'org.mockito:mockito-core:4.11.0'
testImplementation 'org.mockito:mockito-junit-jupiter:5.11.0'
testImplementation 'org.mockito:mockito-core:5.11.0'
}

test {
Expand Down
5 changes: 5 additions & 0 deletions jitpack.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
jdk:
- openjdk11
before_install:
- sdk install java 11.0.23-tem
- sdk use java 11.0.23-tem
3 changes: 2 additions & 1 deletion src/main/java/org/waterfallio/ip4j/Extractors.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.waterfallio.ip4j;

import javax.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletRequest;

import java.util.regex.Pattern;

public class Extractors {
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/waterfallio/ip4j/Ip4j.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package org.waterfallio.ip4j;


import javax.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletRequest;

import java.util.Arrays;
import java.util.List;
import java.util.function.Function;
Expand Down
3 changes: 1 addition & 2 deletions src/test/java/org/waterfallio/ip4j/ExtractorsTest.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
package org.waterfallio.ip4j;

import jakarta.servlet.http.HttpServletRequest;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;

import javax.servlet.http.HttpServletRequest;

import static org.junit.jupiter.api.Assertions.*;
import static org.mockito.Mockito.when;

Expand Down
3 changes: 1 addition & 2 deletions src/test/java/org/waterfallio/ip4j/Ip4jTest.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
package org.waterfallio.ip4j;

import jakarta.servlet.http.HttpServletRequest;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;

import javax.servlet.http.HttpServletRequest;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.when;
Expand Down

0 comments on commit b94fd2a

Please sign in to comment.