From e473ffcbb0519ad7eb716f3c2444c2b670c15515 Mon Sep 17 00:00:00 2001 From: Gaston Thea Date: Thu, 19 Jun 2025 12:48:54 -0300 Subject: [PATCH 1/4] Modified POMs --- client/pom.xml | 10 ++++++---- okhttp-modules/pom.xml | 10 ++++++---- pluggable-storage/pom.xml | 13 ++++++------- pom.xml | 36 +++++++++--------------------------- redis-wrapper/pom.xml | 13 ++++++------- testing/pom.xml | 13 ++++++------- 6 files changed, 39 insertions(+), 56 deletions(-) diff --git a/client/pom.xml b/client/pom.xml index d0ae4a78..eb4ed8bd 100644 --- a/client/pom.xml +++ b/client/pom.xml @@ -19,12 +19,14 @@ - org.sonatype.plugins - nexus-staging-maven-plugin - 1.6.3 + org.sonatype.central + central-publishing-maven-plugin + 0.7.0 true - false + central + false + published diff --git a/okhttp-modules/pom.xml b/okhttp-modules/pom.xml index a8645f9c..f2866272 100644 --- a/okhttp-modules/pom.xml +++ b/okhttp-modules/pom.xml @@ -20,12 +20,14 @@ - org.sonatype.plugins - nexus-staging-maven-plugin - 1.6.3 + org.sonatype.central + central-publishing-maven-plugin + 0.7.0 true - false + central + false + published diff --git a/pluggable-storage/pom.xml b/pluggable-storage/pom.xml index 21b0bdac..7e1dc7e7 100644 --- a/pluggable-storage/pom.xml +++ b/pluggable-storage/pom.xml @@ -21,15 +21,14 @@ - org.sonatype.plugins - nexus-staging-maven-plugin - 1.6.3 + org.sonatype.central + central-publishing-maven-plugin + 0.7.0 true - ossrh - https://oss.sonatype.org/ - true - true + central + false + published diff --git a/pom.xml b/pom.xml index 7b21f1ec..10ba16fd 100644 --- a/pom.xml +++ b/pom.xml @@ -47,16 +47,7 @@ scm:git@github.com:splitio/java-client.git git@github.com:splitio/java-client.git - - - ossrh - https://oss.sonatype.org/content/repositories/snapshots - - - ossrh - https://oss.sonatype.org/content/repositories/releases - - + ossrh @@ -188,16 +179,7 @@ release - - - ossrh - https://oss.sonatype.org/content/repositories/snapshots - - - ossrh - https://oss.sonatype.org/content/repositories/releases - - + @@ -230,16 +212,16 @@ - + - org.sonatype.plugins - nexus-staging-maven-plugin - 1.6.3 + org.sonatype.central + central-publishing-maven-plugin + 0.7.0 true - ossrh - https://oss.sonatype.org/ - true + central + false + published diff --git a/redis-wrapper/pom.xml b/redis-wrapper/pom.xml index 301739ce..61537413 100644 --- a/redis-wrapper/pom.xml +++ b/redis-wrapper/pom.xml @@ -43,15 +43,14 @@ - org.sonatype.plugins - nexus-staging-maven-plugin - 1.6.3 + org.sonatype.central + central-publishing-maven-plugin + 0.7.0 true - ossrh - https://oss.sonatype.org/ - true - true + central + false + published diff --git a/testing/pom.xml b/testing/pom.xml index 0fae6cdf..45479f34 100644 --- a/testing/pom.xml +++ b/testing/pom.xml @@ -31,15 +31,14 @@ - org.sonatype.plugins - nexus-staging-maven-plugin - 1.6.3 + org.sonatype.central + central-publishing-maven-plugin + 0.7.0 true - ossrh - https://oss.sonatype.org/ - true - false + central + false + published From 5a6ee5e0a0e9af62d0b6eab5d6aa69753f259c35 Mon Sep 17 00:00:00 2001 From: Gaston Thea Date: Thu, 19 Jun 2025 15:34:53 -0300 Subject: [PATCH 2/4] Publish to Central Repository --- client/pom.xml | 2 +- okhttp-modules/pom.xml | 2 +- pluggable-storage/pom.xml | 2 +- pom.xml | 2 +- redis-wrapper/pom.xml | 2 +- testing/pom.xml | 2 +- update_maven_settings.sh | 161 ++++++++++++++++++++++++++++++++++++++ 7 files changed, 167 insertions(+), 6 deletions(-) create mode 100755 update_maven_settings.sh diff --git a/client/pom.xml b/client/pom.xml index eb4ed8bd..7a429aed 100644 --- a/client/pom.xml +++ b/client/pom.xml @@ -21,7 +21,7 @@ org.sonatype.central central-publishing-maven-plugin - 0.7.0 + 0.8.0 true central diff --git a/okhttp-modules/pom.xml b/okhttp-modules/pom.xml index f2866272..1081dc20 100644 --- a/okhttp-modules/pom.xml +++ b/okhttp-modules/pom.xml @@ -22,7 +22,7 @@ org.sonatype.central central-publishing-maven-plugin - 0.7.0 + 0.8.0 true central diff --git a/pluggable-storage/pom.xml b/pluggable-storage/pom.xml index 7e1dc7e7..c4f7e76f 100644 --- a/pluggable-storage/pom.xml +++ b/pluggable-storage/pom.xml @@ -23,7 +23,7 @@ org.sonatype.central central-publishing-maven-plugin - 0.7.0 + 0.8.0 true central diff --git a/pom.xml b/pom.xml index 10ba16fd..fe966220 100644 --- a/pom.xml +++ b/pom.xml @@ -216,7 +216,7 @@ org.sonatype.central central-publishing-maven-plugin - 0.7.0 + 0.8.0 true central diff --git a/redis-wrapper/pom.xml b/redis-wrapper/pom.xml index 61537413..6faa8130 100644 --- a/redis-wrapper/pom.xml +++ b/redis-wrapper/pom.xml @@ -45,7 +45,7 @@ org.sonatype.central central-publishing-maven-plugin - 0.7.0 + 0.8.0 true central diff --git a/testing/pom.xml b/testing/pom.xml index 45479f34..5ea099d8 100644 --- a/testing/pom.xml +++ b/testing/pom.xml @@ -33,7 +33,7 @@ org.sonatype.central central-publishing-maven-plugin - 0.7.0 + 0.8.0 true central diff --git a/update_maven_settings.sh b/update_maven_settings.sh new file mode 100755 index 00000000..8bea975f --- /dev/null +++ b/update_maven_settings.sh @@ -0,0 +1,161 @@ +#!/bin/bash + +# Script to update Maven settings.xml with Central Repository credentials using xmlstarlet + +# ANSI color codes +GREEN='\033[0;32m' +YELLOW='\033[0;33m' +BLUE='\033[0;34m' +RED='\033[0;31m' +NC='\033[0m' # No Color + +# Check if xmlstarlet is installed +if ! command -v xmlstarlet &> /dev/null; then + echo -e "${RED}Error: xmlstarlet is not installed.${NC}" + echo "Please install xmlstarlet first:" + echo " macOS: brew install xmlstarlet" + echo " Debian/Ubuntu: sudo apt-get install xmlstarlet" + echo " RHEL/CentOS/Fedora: sudo yum install xmlstarlet" + echo "Then run this script again." + exit 1 +fi + +# Default values +DEFAULT_SETTINGS_PATH="$HOME/.m2/settings.xml" +DEFAULT_SERVER_ID="central" + +echo -e "${BLUE}Maven Settings.xml Update Script${NC}" +echo "This script will update your Maven settings.xml with Central Repository credentials." +echo + +# Ask for settings.xml path or use default +read -p "Path to settings.xml [$DEFAULT_SETTINGS_PATH]: " SETTINGS_PATH +SETTINGS_PATH=${SETTINGS_PATH:-$DEFAULT_SETTINGS_PATH} + +# Variables to store existing values +EXISTING_USERNAME="" +EXISTING_PASSWORD="" + +# Extract existing values if settings.xml exists +if [ -f "$SETTINGS_PATH" ] && command -v xmlstarlet &> /dev/null; then + # Check if the file is valid XML + if xmlstarlet val "$SETTINGS_PATH" &> /dev/null; then + echo -e "${YELLOW}Reading existing settings from ${SETTINGS_PATH}...${NC}" + + # Extract existing server ID + DEFAULT_SERVER_ID=$(xmlstarlet sel -t -v "/settings/servers/server[1]/id" "$SETTINGS_PATH" 2>/dev/null || echo "$DEFAULT_SERVER_ID") + + # Extract existing username and password for the server + EXISTING_USERNAME=$(xmlstarlet sel -t -v "/settings/servers/server[id='$DEFAULT_SERVER_ID']/username" "$SETTINGS_PATH" 2>/dev/null || echo "") + EXISTING_PASSWORD=$(xmlstarlet sel -t -v "/settings/servers/server[id='$DEFAULT_SERVER_ID']/password" "$SETTINGS_PATH" 2>/dev/null || echo "") + fi +fi + +# Ask for server ID or use default/existing +read -p "Server ID [$DEFAULT_SERVER_ID]: " SERVER_ID +SERVER_ID=${SERVER_ID:-$DEFAULT_SERVER_ID} + +# Ask for username (show existing if available) +USERNAME_PROMPT="Username" +if [ -n "$EXISTING_USERNAME" ]; then + USERNAME_PROMPT="Username (current: $EXISTING_USERNAME)" +fi +read -p "$USERNAME_PROMPT: " USERNAME +USERNAME=${USERNAME:-$EXISTING_USERNAME} + +# Ask for password (indicate if existing) +PASSWORD_PROMPT="Password" +if [ -n "$EXISTING_PASSWORD" ]; then + PASSWORD_PROMPT="Password (leave empty to keep current)" +fi +read -s -p "$PASSWORD_PROMPT: " PASSWORD +echo +# Only use existing password if the user didn't enter a new one +if [ -z "$PASSWORD" ] && [ -n "$EXISTING_PASSWORD" ]; then + PASSWORD="$EXISTING_PASSWORD" +fi + +# Create .m2 directory if it doesn't exist +M2_DIR=$(dirname "$SETTINGS_PATH") +mkdir -p "$M2_DIR" + +# No GPG configuration needed + +# Function to create a new settings.xml file +create_new_settings() { + echo -e "${YELLOW}Creating new settings.xml file...${NC}" + cat > "$SETTINGS_PATH" << EOF + + + + + $SERVER_ID + $USERNAME + $PASSWORD + + + +EOF +} + +# Check if settings.xml exists +if [ -f "$SETTINGS_PATH" ]; then + echo -e "${YELLOW}Existing settings.xml found. Backing up to ${SETTINGS_PATH}.bak${NC}" + cp "$SETTINGS_PATH" "${SETTINGS_PATH}.bak" + + # Check if the file is valid XML + if ! xmlstarlet val "$SETTINGS_PATH" &> /dev/null; then + echo -e "${RED}Warning: The existing settings.xml is not valid XML.${NC}" + read -p "Do you want to create a new settings.xml file? (y/n): " CREATE_NEW + if [[ $CREATE_NEW =~ ^[Yy]$ ]]; then + create_new_settings + else + echo -e "${RED}Exiting without making changes.${NC}" + exit 1 + fi + else + # Check if servers element exists + if ! xmlstarlet sel -t -v "/settings/servers" "$SETTINGS_PATH" &> /dev/null; then + echo -e "${YELLOW}No servers section found. Adding servers section...${NC}" + xmlstarlet ed --inplace \ + -s "/settings" -t elem -n "servers" \ + -s "/settings/servers" -t elem -n "server" \ + -s "/settings/servers/server" -t elem -n "id" -v "$SERVER_ID" \ + -s "/settings/servers/server" -t elem -n "username" -v "$USERNAME" \ + -s "/settings/servers/server" -t elem -n "password" -v "$PASSWORD" \ + "$SETTINGS_PATH" + else + # Check if server with this ID already exists + if xmlstarlet sel -t -v "/settings/servers/server[id='$SERVER_ID']" "$SETTINGS_PATH" &> /dev/null; then + echo -e "${YELLOW}Server with ID '$SERVER_ID' already exists. Updating credentials...${NC}" + # Update existing server credentials + xmlstarlet ed --inplace \ + -u "/settings/servers/server[id='$SERVER_ID']/username" -v "$USERNAME" \ + -u "/settings/servers/server[id='$SERVER_ID']/password" -v "$PASSWORD" \ + "$SETTINGS_PATH" + else + echo -e "${YELLOW}Adding new server with ID '$SERVER_ID'...${NC}" + # Add new server to existing servers section + xmlstarlet ed --inplace \ + -s "/settings/servers" -t elem -n "server" \ + -s "/settings/servers/server[last()]" -t elem -n "id" -v "$SERVER_ID" \ + -s "/settings/servers/server[last()]" -t elem -n "username" -v "$USERNAME" \ + -s "/settings/servers/server[last()]" -t elem -n "password" -v "$PASSWORD" \ + "$SETTINGS_PATH" + fi + fi + fi +else + create_new_settings +fi + +# Make sure the file has the right permissions +chmod 600 "$SETTINGS_PATH" + +echo -e "${GREEN}Maven settings.xml updated successfully at $SETTINGS_PATH${NC}" +echo -e "${GREEN}Server ID: $SERVER_ID${NC}" +echo -e "${GREEN}Username: $USERNAME${NC}" +echo -e "${GREEN}Password: ********${NC}" + From 7aa63c62d12f1722679acaca4d89336a0c8b9962 Mon Sep 17 00:00:00 2001 From: Gaston Thea Date: Mon, 23 Jun 2025 18:11:21 -0300 Subject: [PATCH 3/4] Add skip if already published in modules --- client/pom.xml | 5 +++-- okhttp-modules/pom.xml | 1 + pluggable-storage/pom.xml | 1 + pom.xml | 2 +- redis-wrapper/pom.xml | 1 + testing/pom.xml | 3 ++- 6 files changed, 9 insertions(+), 4 deletions(-) diff --git a/client/pom.xml b/client/pom.xml index 7a429aed..d70c9d80 100644 --- a/client/pom.xml +++ b/client/pom.xml @@ -5,9 +5,9 @@ io.split.client java-client-parent - 4.16.0 + 4.16.1-rc1 - 4.16.0 + 4.16.1-rc1 java-client jar Java Client @@ -24,6 +24,7 @@ 0.8.0 true + true central false published diff --git a/okhttp-modules/pom.xml b/okhttp-modules/pom.xml index 1081dc20..3a842c81 100644 --- a/okhttp-modules/pom.xml +++ b/okhttp-modules/pom.xml @@ -25,6 +25,7 @@ 0.8.0 true + true central false published diff --git a/pluggable-storage/pom.xml b/pluggable-storage/pom.xml index c4f7e76f..d5b1a995 100644 --- a/pluggable-storage/pom.xml +++ b/pluggable-storage/pom.xml @@ -26,6 +26,7 @@ 0.8.0 true + true central false published diff --git a/pom.xml b/pom.xml index fe966220..283667c4 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ 4.0.0 io.split.client java-client-parent - 4.16.0 + 4.16.1-rc1 diff --git a/redis-wrapper/pom.xml b/redis-wrapper/pom.xml index 6faa8130..64c5a115 100644 --- a/redis-wrapper/pom.xml +++ b/redis-wrapper/pom.xml @@ -48,6 +48,7 @@ 0.8.0 true + true central false published diff --git a/testing/pom.xml b/testing/pom.xml index 5ea099d8..a6399f78 100644 --- a/testing/pom.xml +++ b/testing/pom.xml @@ -9,7 +9,7 @@ java-client-testing jar - 4.16.0 + 4.16.1-rc1 Java Client For Testing Testing suite for Java SDK for Split @@ -39,6 +39,7 @@ central false published + true From 6d424b7f48b66ec4dec37bc124322fcdbcc3c004 Mon Sep 17 00:00:00 2001 From: Gaston Thea Date: Mon, 23 Jun 2025 18:12:19 -0300 Subject: [PATCH 4/4] Fix versions --- client/pom.xml | 4 ++-- pom.xml | 2 +- testing/pom.xml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/client/pom.xml b/client/pom.xml index d70c9d80..1d4b32f4 100644 --- a/client/pom.xml +++ b/client/pom.xml @@ -5,9 +5,9 @@ io.split.client java-client-parent - 4.16.1-rc1 + 4.16.0 - 4.16.1-rc1 + 4.16.0 java-client jar Java Client diff --git a/pom.xml b/pom.xml index 283667c4..fe966220 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ 4.0.0 io.split.client java-client-parent - 4.16.1-rc1 + 4.16.0 diff --git a/testing/pom.xml b/testing/pom.xml index a6399f78..de58f526 100644 --- a/testing/pom.xml +++ b/testing/pom.xml @@ -9,7 +9,7 @@ java-client-testing jar - 4.16.1-rc1 + 4.16.0 Java Client For Testing Testing suite for Java SDK for Split