diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
new file mode 100644
index 0000000..96d3da8
--- /dev/null
+++ b/.github/workflows/publish.yml
@@ -0,0 +1,45 @@
+# References:
+# - https://docs.github.com/en/actions/use-cases-and-examples/publishing-packages/publishing-java-packages-with-maven
+
+name: "Publish to Maven Central"
+
+on:
+ push:
+ tags:
+ - "*"
+
+jobs:
+ publish-to-maven-central:
+ runs-on: ubuntu-latest
+ name: Publish to Maven Central
+
+ steps:
+ - uses: actions/checkout@v4
+ with:
+ submodules: recursive
+ - uses: actions/setup-java@v4
+ with:
+ distribution: adopt
+ java-version: 21
+ server-id: central
+ server-username: MAVEN_USERNAME
+ server-password: MAVEN_PASSWORD
+
+ - id: install-secret-key
+ name: Install gpg secret key
+ run: |
+ # Install gpg secret key
+ cat <(echo -e "${{ secrets.OSSRH_GPG_SECRET_KEY }}") | gpg --batch --import
+ # Verify gpg secret key
+ gpg --list-secret-keys --keyid-format LONG
+ - id: publish-to-central
+ name: Publish to Central Repository
+ env:
+ MAVEN_USERNAME: ${{ vars.OSSRH_USERNAME }}
+ MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
+ run: |
+ mvn \
+ --no-transfer-progress \
+ --batch-mode \
+ -Dgpg.passphrase=${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }} \
+ clean deploy -P release
diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml
index 4399b06..f3af111 100644
--- a/.github/workflows/run-tests.yml
+++ b/.github/workflows/run-tests.yml
@@ -12,7 +12,7 @@ jobs:
strategy:
matrix:
- java: [ "11", "17", "21" ]
+ java: [ "8", "11", "17", "21" ]
distribution: [ "zulu", "adopt" ]
steps:
diff --git a/pom.xml b/pom.xml
index 356d458..2f43f53 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
com.flagsmith
flagsmith-java-client
- 7.4.0
+ 7.4.3
jar
Flagsmith Java Client
@@ -181,6 +181,16 @@
flagsmith-java-client-${project.version}
+
+ org.sonatype.central
+ central-publishing-maven-plugin
+ 0.6.0
+ true
+
+ central
+ true
+
+
org.apache.maven.plugins
maven-compiler-plugin
diff --git a/src/main/java/com/flagsmith/config/FlagsmithConfig.java b/src/main/java/com/flagsmith/config/FlagsmithConfig.java
index e822d48..e2ea1a8 100644
--- a/src/main/java/com/flagsmith/config/FlagsmithConfig.java
+++ b/src/main/java/com/flagsmith/config/FlagsmithConfig.java
@@ -292,7 +292,7 @@ public FlagsmithConfig build() {
}
// This enum prevents leakage of the underlying HTTP client implementation details.
- enum Protocol {
+ public enum Protocol {
HTTP_1_1(okhttp3.Protocol.HTTP_1_1),
HTTP_2(okhttp3.Protocol.HTTP_2);
diff --git a/src/main/java/com/flagsmith/utils/ModelUtils.java b/src/main/java/com/flagsmith/utils/ModelUtils.java
index 4fad2d2..7128d38 100644
--- a/src/main/java/com/flagsmith/utils/ModelUtils.java
+++ b/src/main/java/com/flagsmith/utils/ModelUtils.java
@@ -3,6 +3,7 @@
import com.flagsmith.flagengine.identities.traits.TraitModel;
import com.flagsmith.models.SdkTraitModel;
import com.flagsmith.models.TraitConfig;
+import java.util.AbstractMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
@@ -46,12 +47,8 @@ private static Stream> getTraitConfigStreamFromTraitM
Map traits
) {
return traits.entrySet().stream().map(
- (row) -> {
- return Map.entry(
- row.getKey(),
- TraitConfig.fromObject(row.getValue())
- );
- }
+ row -> new AbstractMap.SimpleEntry<>(
+ row.getKey(), TraitConfig.fromObject(row.getValue()))
);
}