From ea7bc511957248ea8e9b8a9c195d36c86a16d5e1 Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Mon, 27 Jan 2025 16:09:04 +0100 Subject: [PATCH 01/49] Prepare next release 5.5.0-SNAPSHOT --- commons-datastore/commons-datastore-core/pom.xml | 2 +- commons-datastore/commons-datastore-mongodb/pom.xml | 2 +- commons-datastore/commons-datastore-solr/pom.xml | 2 +- commons-datastore/pom.xml | 2 +- commons-lib/pom.xml | 2 +- pom.xml | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/commons-datastore/commons-datastore-core/pom.xml b/commons-datastore/commons-datastore-core/pom.xml index 1a79fcf9f..5e7d7ab45 100644 --- a/commons-datastore/commons-datastore-core/pom.xml +++ b/commons-datastore/commons-datastore-core/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons-datastore - 5.4.0 + 5.5.0-SNAPSHOT ../pom.xml diff --git a/commons-datastore/commons-datastore-mongodb/pom.xml b/commons-datastore/commons-datastore-mongodb/pom.xml index 080f1c8a0..de158647e 100644 --- a/commons-datastore/commons-datastore-mongodb/pom.xml +++ b/commons-datastore/commons-datastore-mongodb/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons-datastore - 5.4.0 + 5.5.0-SNAPSHOT ../pom.xml diff --git a/commons-datastore/commons-datastore-solr/pom.xml b/commons-datastore/commons-datastore-solr/pom.xml index 555a4e9ff..eabb18a76 100644 --- a/commons-datastore/commons-datastore-solr/pom.xml +++ b/commons-datastore/commons-datastore-solr/pom.xml @@ -22,7 +22,7 @@ org.opencb.commons commons-datastore - 5.4.0 + 5.5.0-SNAPSHOT ../pom.xml diff --git a/commons-datastore/pom.xml b/commons-datastore/pom.xml index d883cfbf8..094fb5429 100644 --- a/commons-datastore/pom.xml +++ b/commons-datastore/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons - 5.4.0 + 5.5.0-SNAPSHOT ../pom.xml diff --git a/commons-lib/pom.xml b/commons-lib/pom.xml index 0857a23ad..d356f8d80 100644 --- a/commons-lib/pom.xml +++ b/commons-lib/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons - 5.4.0 + 5.5.0-SNAPSHOT ../pom.xml diff --git a/pom.xml b/pom.xml index 9ffb79dbd..e2402ef82 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons - 5.4.0 + 5.5.0-SNAPSHOT pom OpenCB commons project From 30c341ffdbf58e7e97146f4442f625e118ff4377 Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Mon, 14 Apr 2025 15:34:49 +0200 Subject: [PATCH 02/49] Prepare release 6.1.0 XB-3.1.0 #TASK-7456 --- commons-datastore/commons-datastore-core/pom.xml | 2 +- commons-datastore/commons-datastore-mongodb/pom.xml | 2 +- commons-datastore/commons-datastore-solr/pom.xml | 2 +- commons-datastore/pom.xml | 2 +- commons-lib/pom.xml | 2 +- pom.xml | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/commons-datastore/commons-datastore-core/pom.xml b/commons-datastore/commons-datastore-core/pom.xml index 048cefef5..218ad74c0 100644 --- a/commons-datastore/commons-datastore-core/pom.xml +++ b/commons-datastore/commons-datastore-core/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons-datastore - 6.0.0 + 6.1.0-SNAPSHOT ../pom.xml diff --git a/commons-datastore/commons-datastore-mongodb/pom.xml b/commons-datastore/commons-datastore-mongodb/pom.xml index f78eccbf1..4d3c30c85 100644 --- a/commons-datastore/commons-datastore-mongodb/pom.xml +++ b/commons-datastore/commons-datastore-mongodb/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons-datastore - 6.0.0 + 6.1.0-SNAPSHOT ../pom.xml diff --git a/commons-datastore/commons-datastore-solr/pom.xml b/commons-datastore/commons-datastore-solr/pom.xml index 38e8cef91..8077f5332 100644 --- a/commons-datastore/commons-datastore-solr/pom.xml +++ b/commons-datastore/commons-datastore-solr/pom.xml @@ -22,7 +22,7 @@ org.opencb.commons commons-datastore - 6.0.0 + 6.1.0-SNAPSHOT ../pom.xml diff --git a/commons-datastore/pom.xml b/commons-datastore/pom.xml index 7576fbf3a..64d7216f4 100644 --- a/commons-datastore/pom.xml +++ b/commons-datastore/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons - 6.0.0 + 6.1.0-SNAPSHOT ../pom.xml diff --git a/commons-lib/pom.xml b/commons-lib/pom.xml index 9b29a364f..6dd595870 100644 --- a/commons-lib/pom.xml +++ b/commons-lib/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons - 6.0.0 + 6.1.0-SNAPSHOT ../pom.xml diff --git a/pom.xml b/pom.xml index 3c0bb460d..c59a33671 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons - 6.0.0 + 6.1.0-SNAPSHOT pom OpenCB commons project From 355e2739e568ba5daf05f1c598c10ee90bb86ecf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacobo=20Coll=20Morag=C3=B3n?= Date: Fri, 9 May 2025 10:05:20 +0100 Subject: [PATCH 03/49] lib: Add async command execution. Allow stdin forwarding. #TASK-7524 --- .../java/org/opencb/commons/exec/Command.java | 172 +++++++++++------- .../commons/exec/NamedThreadFactory.java | 60 ++++++ .../opencb/commons/exec/RunnableProcess.java | 2 +- .../opencb/commons/exec/SingleProcess.java | 2 +- .../org/opencb/commons/exec/CommandTest.java | 35 ++++ 5 files changed, 207 insertions(+), 64 deletions(-) create mode 100644 commons-lib/src/main/java/org/opencb/commons/exec/NamedThreadFactory.java create mode 100644 commons-lib/src/test/java/org/opencb/commons/exec/CommandTest.java diff --git a/commons-lib/src/main/java/org/opencb/commons/exec/Command.java b/commons-lib/src/main/java/org/opencb/commons/exec/Command.java index efcbf7f2f..0e2294ac7 100755 --- a/commons-lib/src/main/java/org/opencb/commons/exec/Command.java +++ b/commons-lib/src/main/java/org/opencb/commons/exec/Command.java @@ -20,6 +20,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.io.DataOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; @@ -27,6 +28,10 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; import java.util.stream.Collectors; public class Command extends RunnableProcess { @@ -35,6 +40,7 @@ public class Command extends RunnableProcess { // protected String pathScript; // protected String outDir; // protected Arguments arguments; + private static final int STDIN_BUFFER_SIZE = 128 * 1024; private String commandLine; private Map environment; @@ -47,6 +53,10 @@ public class Command extends RunnableProcess { private OutputStream outputOutputStream = null; private OutputStream errorOutputStream = null; + private static final ExecutorService EXECUTOR_SERVICE = Executors.newCachedThreadPool( + new NamedThreadFactory("command") + .setDaemon(true)); + private final String[] cmdArray; private boolean printOutput = true; @@ -73,8 +83,16 @@ public Command(String[] cmdArray, Map environment) { this.environment = environment; } + public Future async() { + return run(true); + } + @Override public void run() { + run(false); + } + + public Future run(boolean background) { try { startTime(); logger.debug(Commandline.describeCommand(cmdArray)); @@ -92,32 +110,19 @@ public void run() { } setStatus(Status.RUNNING); - InputStream is = proc.getInputStream(); - // Thread out = readOutputStream(is); - Thread readOutputStreamThread = readOutputStream(is); - InputStream es = proc.getErrorStream(); - // Thread err = readErrorStream(es); - Thread readErrorStreamThread = readErrorStream(es); - - proc.waitFor(); - readOutputStreamThread.join(); - readErrorStreamThread.join(); - endTime(); - - setExitValue(proc.exitValue()); - if (proc.exitValue() != 0) { - status = Status.ERROR; - // output = IOUtils.toString(proc.getInputStream()); - // error = IOUtils.toString(proc.getErrorStream()); - output = outputBuffer.toString(); - error = errorBuffer.toString(); - } - if (status != Status.KILLED && status != Status.TIMEOUT && status != Status.ERROR) { - status = Status.DONE; - // output = IOUtils.toString(proc.getInputStream()); - // error = IOUtils.toString(proc.getErrorStream()); - output = outputBuffer.toString(); - error = errorBuffer.toString(); + InputStream stdout = proc.getInputStream(); + Future readOutputStreamThread = readOutputStream(stdout); + InputStream stderr = proc.getErrorStream(); + Future readErrorStreamThread = readErrorStream(stderr); + + if (background) { + // Wait in the background + return EXECUTOR_SERVICE.submit(() -> { + waitFor(readOutputStreamThread, readErrorStreamThread); + return getStatus(); + }); + } else { + waitFor(readOutputStreamThread, readErrorStreamThread); } } catch (RuntimeException | IOException | InterruptedException e) { @@ -129,67 +134,97 @@ public void run() { exitValue = -1; logger.error("Exception occurred while executing Command " + exception, e); } + return null; + } + + private void waitFor(Future readOutputStreamThread, Future readErrorStreamThread) throws InterruptedException { + proc.waitFor(); + try { + readOutputStreamThread.get(); + readErrorStreamThread.get(); + } catch (ExecutionException e) { + throw new RuntimeException(e); + } + endTime(); + + setExitValue(proc.exitValue()); + if (proc.exitValue() != 0) { + status = Status.ERROR; + // output = IOUtils.toString(proc.getInputStream()); + // error = IOUtils.toString(proc.getErrorStream()); + output = outputBuffer.toString(); + error = errorBuffer.toString(); + } + if (status != Status.KILLED && status != Status.TIMEOUT && status != Status.ERROR) { + status = Status.DONE; + // output = IOUtils.toString(proc.getInputStream()); + // error = IOUtils.toString(proc.getErrorStream()); + output = outputBuffer.toString(); + error = errorBuffer.toString(); + } } @Override public void destroy() { - if (proc != null) { + if (proc != null && proc.isAlive()) { proc.destroy(); setStatus(Status.KILLED); } } - private Thread readOutputStream(InputStream ins) throws IOException { + private Future readOutputStream(InputStream ins) throws IOException { return readStream("stdout", outputOutputStream, outputBuffer, ins); } - private Thread readErrorStream(InputStream ins) throws IOException { + private Future readErrorStream(InputStream ins) throws IOException { return readStream("stderr", errorOutputStream, errorBuffer, ins); } - private Thread readStream(String outputName, OutputStream outputStream, StringBuffer stringBuffer, InputStream in) { - Thread thread = new Thread(() -> { + private Future readStream(String outputName, OutputStream outputStream, StringBuffer stringBuffer, InputStream in) { + return EXECUTOR_SERVICE.submit(() -> { try { - int bytesRead = 0; - int bufferLength; - byte[] buffer; + int bytesRead = 0; + int bufferLength; + byte[] buffer; - while (bytesRead != -1) { - // int x=in.available(); - // if (x<=0) - // continue ; + while (bytesRead != -1) { + // int x=in.available(); + // if (x<=0) + // continue ; - bufferLength = in.available(); - bufferLength = Math.max(bufferLength, 1); + bufferLength = in.available(); + bufferLength = Math.max(bufferLength, 1); - buffer = new byte[bufferLength]; - bytesRead = in.read(buffer, 0, bufferLength); + buffer = new byte[bufferLength]; + bytesRead = in.read(buffer, 0, bufferLength); - if (bytesRead == 0) { - Thread.sleep(500); + if (bytesRead == 0) { + Thread.sleep(500); + if (logger.isTraceEnabled()) { logger.trace(outputName + " - Sleep"); - } else if (bytesRead > 0) { + } + } else if (bytesRead > 0) { + if (logger.isTraceEnabled()) { logger.trace(outputName + " - last bytesRead = {})", bytesRead); - if (printOutput) { - System.err.print(new String(buffer)); - } - - if (outputStream == null) { - stringBuffer.append(new String(buffer)); - } else { - outputStream.write(buffer); - outputStream.flush(); - } + } + if (printOutput) { + System.err.print(new String(buffer)); + } + + if (outputStream == null) { + stringBuffer.append(new String(buffer)); + } else { + outputStream.write(buffer); + outputStream.flush(); } } - logger.debug("Read {} - Exit while", outputName); - } catch (Exception ex) { - logger.error("Error reading " + outputName, ex); - exception = ex.toString(); } - }, outputName + "_reader"); - thread.start(); - return thread; + logger.debug("Read {} - Exit while", outputName); + } catch (Exception ex) { + logger.error("Error reading " + outputName, ex); + exception = ex.toString(); + } + }); } /** @@ -275,4 +310,17 @@ public Command setPrintOutput(boolean printOutput) { this.printOutput = printOutput; return this; } + + public Process getProc() { + return proc; + } + + public DataOutputStream getStdin() { + if (status == Status.RUNNING) { + return new DataOutputStream(proc.getOutputStream()); + } else { + throw new IllegalStateException("Process is not running. Process status: " + status); + } + } + } diff --git a/commons-lib/src/main/java/org/opencb/commons/exec/NamedThreadFactory.java b/commons-lib/src/main/java/org/opencb/commons/exec/NamedThreadFactory.java new file mode 100644 index 000000000..fee4cb302 --- /dev/null +++ b/commons-lib/src/main/java/org/opencb/commons/exec/NamedThreadFactory.java @@ -0,0 +1,60 @@ +package org.opencb.commons.exec; + +import java.util.concurrent.ThreadFactory; +import java.util.concurrent.atomic.AtomicInteger; + +public class NamedThreadFactory implements ThreadFactory { + + private static final AtomicInteger POOL_NUMBER = new AtomicInteger(1); + private final ThreadGroup group; + private final AtomicInteger threadNumber = new AtomicInteger(1); + private final String prefix; + private Integer priority; + private boolean daemon; + + public NamedThreadFactory(String namePrefix) { + SecurityManager s = System.getSecurityManager(); + group = (s != null) ? s.getThreadGroup() : Thread.currentThread().getThreadGroup(); + prefix = namePrefix + "-" + + POOL_NUMBER.getAndIncrement() + + "-thread-"; + priority = Thread.NORM_PRIORITY; + daemon = false; + } + + public NamedThreadFactory setPriority(Integer priority) { + this.priority = priority; + return this; + } + + /** + * Marks this thread as either a {@linkplain #isDaemon daemon} thread + * or a user thread. The Java Virtual Machine exits when the only + * threads running are all daemon threads. + * + * @param daemon true to mark this thread as a daemon thread; + * @return this thread factory + */ + public NamedThreadFactory setDaemon(boolean daemon) { + this.daemon = daemon; + return this; + } + + public boolean isDaemon() { + return daemon; + } + + @Override + public Thread newThread(Runnable r) { + Thread t = new Thread(group, r, prefix + threadNumber.getAndIncrement()); + + t.setDaemon(daemon); + + if (priority != null) { + if (t.getPriority() != priority) { + t.setPriority(priority); + } + } + return t; + } +} diff --git a/commons-lib/src/main/java/org/opencb/commons/exec/RunnableProcess.java b/commons-lib/src/main/java/org/opencb/commons/exec/RunnableProcess.java index 6897fad4a..0e19f6f30 100755 --- a/commons-lib/src/main/java/org/opencb/commons/exec/RunnableProcess.java +++ b/commons-lib/src/main/java/org/opencb/commons/exec/RunnableProcess.java @@ -28,7 +28,7 @@ public abstract class RunnableProcess implements Runnable { protected String exception; protected int exitValue; - protected Status status; + protected Status status = Status.WAITING; public enum Status {WAITING, RUNNING, DONE, ERROR, TIMEOUT, KILLED} diff --git a/commons-lib/src/main/java/org/opencb/commons/exec/SingleProcess.java b/commons-lib/src/main/java/org/opencb/commons/exec/SingleProcess.java index f5dc7073e..7a641f622 100755 --- a/commons-lib/src/main/java/org/opencb/commons/exec/SingleProcess.java +++ b/commons-lib/src/main/java/org/opencb/commons/exec/SingleProcess.java @@ -22,7 +22,7 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; - +@Deprecated public class SingleProcess { private Logger logger; diff --git a/commons-lib/src/test/java/org/opencb/commons/exec/CommandTest.java b/commons-lib/src/test/java/org/opencb/commons/exec/CommandTest.java new file mode 100644 index 000000000..d1b8fd718 --- /dev/null +++ b/commons-lib/src/test/java/org/opencb/commons/exec/CommandTest.java @@ -0,0 +1,35 @@ +package org.opencb.commons.exec; + +import org.junit.Test; + +import java.io.DataOutputStream; +import java.io.IOException; +import java.util.concurrent.Future; +import java.util.concurrent.TimeUnit; + +import static org.junit.Assert.assertEquals; + +public class CommandTest { + + + @Test + public void testCommand() throws Exception { + // Test the Command class +// String commandLine = "bash -c 'echo Hello World ; echo Error Message >&2 ; cat -'"; +// String commandLine = "cat"; + String commandLine = "bash -c 'cat <(echo -n \"Hello - \") - <(echo -n \" - END\")'"; + Command command = new Command(commandLine); + command.setPrintOutput(false); + + // Execute the command + Future future = command.async(); + DataOutputStream stdin = command.getStdin(); + stdin.write("World from STDIN".getBytes()); + stdin.close(); + future.get(1000, TimeUnit.MILLISECONDS); + assertEquals(RunnableProcess.Status.DONE, command.getStatus()); + assertEquals("Hello - World from STDIN - END", command.getOutput()); + assertEquals("", command.getError()); + } + +} \ No newline at end of file From 64fbb5fa59d3490e250257be0960ded85c9ea998 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacobo=20Coll=20Morag=C3=B3n?= Date: Fri, 9 May 2025 10:09:01 +0100 Subject: [PATCH 04/49] lib: Remove unused constant #TASK-7524 --- commons-lib/src/main/java/org/opencb/commons/exec/Command.java | 1 - 1 file changed, 1 deletion(-) diff --git a/commons-lib/src/main/java/org/opencb/commons/exec/Command.java b/commons-lib/src/main/java/org/opencb/commons/exec/Command.java index 0e2294ac7..dd9e7182e 100755 --- a/commons-lib/src/main/java/org/opencb/commons/exec/Command.java +++ b/commons-lib/src/main/java/org/opencb/commons/exec/Command.java @@ -40,7 +40,6 @@ public class Command extends RunnableProcess { // protected String pathScript; // protected String outDir; // protected Arguments arguments; - private static final int STDIN_BUFFER_SIZE = 128 * 1024; private String commandLine; private Map environment; From c2490e9b28c376946827a0c17314dbcf21e7b26c Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Thu, 5 Jun 2025 12:14:40 +0200 Subject: [PATCH 05/49] Prepare release 5.5.0 --- commons-datastore/commons-datastore-core/pom.xml | 2 +- commons-datastore/commons-datastore-mongodb/pom.xml | 2 +- commons-datastore/commons-datastore-solr/pom.xml | 2 +- commons-datastore/pom.xml | 2 +- commons-lib/pom.xml | 2 +- pom.xml | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/commons-datastore/commons-datastore-core/pom.xml b/commons-datastore/commons-datastore-core/pom.xml index 5e7d7ab45..df9941692 100644 --- a/commons-datastore/commons-datastore-core/pom.xml +++ b/commons-datastore/commons-datastore-core/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons-datastore - 5.5.0-SNAPSHOT + 5.5.0 ../pom.xml diff --git a/commons-datastore/commons-datastore-mongodb/pom.xml b/commons-datastore/commons-datastore-mongodb/pom.xml index de158647e..59595b3e4 100644 --- a/commons-datastore/commons-datastore-mongodb/pom.xml +++ b/commons-datastore/commons-datastore-mongodb/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons-datastore - 5.5.0-SNAPSHOT + 5.5.0 ../pom.xml diff --git a/commons-datastore/commons-datastore-solr/pom.xml b/commons-datastore/commons-datastore-solr/pom.xml index eabb18a76..dc8d82f8c 100644 --- a/commons-datastore/commons-datastore-solr/pom.xml +++ b/commons-datastore/commons-datastore-solr/pom.xml @@ -22,7 +22,7 @@ org.opencb.commons commons-datastore - 5.5.0-SNAPSHOT + 5.5.0 ../pom.xml diff --git a/commons-datastore/pom.xml b/commons-datastore/pom.xml index 094fb5429..03698a2bc 100644 --- a/commons-datastore/pom.xml +++ b/commons-datastore/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons - 5.5.0-SNAPSHOT + 5.5.0 ../pom.xml diff --git a/commons-lib/pom.xml b/commons-lib/pom.xml index d356f8d80..fe66ad77d 100644 --- a/commons-lib/pom.xml +++ b/commons-lib/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons - 5.5.0-SNAPSHOT + 5.5.0 ../pom.xml diff --git a/pom.xml b/pom.xml index e2402ef82..734912815 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons - 5.5.0-SNAPSHOT + 5.5.0 pom OpenCB commons project From 804162d33f9235246754d971c79665f638c27691 Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Thu, 5 Jun 2025 12:14:58 +0200 Subject: [PATCH 06/49] Prepare next release 5.6.0-SNAPSHOT --- commons-datastore/commons-datastore-core/pom.xml | 2 +- commons-datastore/commons-datastore-mongodb/pom.xml | 2 +- commons-datastore/commons-datastore-solr/pom.xml | 2 +- commons-datastore/pom.xml | 2 +- commons-lib/pom.xml | 2 +- pom.xml | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/commons-datastore/commons-datastore-core/pom.xml b/commons-datastore/commons-datastore-core/pom.xml index df9941692..a7688a915 100644 --- a/commons-datastore/commons-datastore-core/pom.xml +++ b/commons-datastore/commons-datastore-core/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons-datastore - 5.5.0 + 5.6.0-SNAPSHOT ../pom.xml diff --git a/commons-datastore/commons-datastore-mongodb/pom.xml b/commons-datastore/commons-datastore-mongodb/pom.xml index 59595b3e4..ea8d77c6e 100644 --- a/commons-datastore/commons-datastore-mongodb/pom.xml +++ b/commons-datastore/commons-datastore-mongodb/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons-datastore - 5.5.0 + 5.6.0-SNAPSHOT ../pom.xml diff --git a/commons-datastore/commons-datastore-solr/pom.xml b/commons-datastore/commons-datastore-solr/pom.xml index dc8d82f8c..10d9baeaa 100644 --- a/commons-datastore/commons-datastore-solr/pom.xml +++ b/commons-datastore/commons-datastore-solr/pom.xml @@ -22,7 +22,7 @@ org.opencb.commons commons-datastore - 5.5.0 + 5.6.0-SNAPSHOT ../pom.xml diff --git a/commons-datastore/pom.xml b/commons-datastore/pom.xml index 03698a2bc..0ad238d50 100644 --- a/commons-datastore/pom.xml +++ b/commons-datastore/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons - 5.5.0 + 5.6.0-SNAPSHOT ../pom.xml diff --git a/commons-lib/pom.xml b/commons-lib/pom.xml index fe66ad77d..b83808599 100644 --- a/commons-lib/pom.xml +++ b/commons-lib/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons - 5.5.0 + 5.6.0-SNAPSHOT ../pom.xml diff --git a/pom.xml b/pom.xml index 734912815..7d9fa84dc 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons - 5.5.0 + 5.6.0-SNAPSHOT pom OpenCB commons project From d993fddeb2a74676babe4b727286b61f445a0dcb Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Wed, 30 Jul 2025 11:09:13 +0200 Subject: [PATCH 07/49] Prepare release 5.6.0 --- commons-datastore/commons-datastore-core/pom.xml | 2 +- commons-datastore/commons-datastore-mongodb/pom.xml | 2 +- commons-datastore/commons-datastore-solr/pom.xml | 2 +- commons-datastore/pom.xml | 2 +- commons-lib/pom.xml | 2 +- pom.xml | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/commons-datastore/commons-datastore-core/pom.xml b/commons-datastore/commons-datastore-core/pom.xml index a7688a915..abf75a057 100644 --- a/commons-datastore/commons-datastore-core/pom.xml +++ b/commons-datastore/commons-datastore-core/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons-datastore - 5.6.0-SNAPSHOT + 5.6.0 ../pom.xml diff --git a/commons-datastore/commons-datastore-mongodb/pom.xml b/commons-datastore/commons-datastore-mongodb/pom.xml index ea8d77c6e..082394e1e 100644 --- a/commons-datastore/commons-datastore-mongodb/pom.xml +++ b/commons-datastore/commons-datastore-mongodb/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons-datastore - 5.6.0-SNAPSHOT + 5.6.0 ../pom.xml diff --git a/commons-datastore/commons-datastore-solr/pom.xml b/commons-datastore/commons-datastore-solr/pom.xml index 10d9baeaa..d2a790bc3 100644 --- a/commons-datastore/commons-datastore-solr/pom.xml +++ b/commons-datastore/commons-datastore-solr/pom.xml @@ -22,7 +22,7 @@ org.opencb.commons commons-datastore - 5.6.0-SNAPSHOT + 5.6.0 ../pom.xml diff --git a/commons-datastore/pom.xml b/commons-datastore/pom.xml index 0ad238d50..777903eea 100644 --- a/commons-datastore/pom.xml +++ b/commons-datastore/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons - 5.6.0-SNAPSHOT + 5.6.0 ../pom.xml diff --git a/commons-lib/pom.xml b/commons-lib/pom.xml index b83808599..fe6f33d92 100644 --- a/commons-lib/pom.xml +++ b/commons-lib/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons - 5.6.0-SNAPSHOT + 5.6.0 ../pom.xml diff --git a/pom.xml b/pom.xml index 7d9fa84dc..93f7a37a2 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons - 5.6.0-SNAPSHOT + 5.6.0 pom OpenCB commons project From 995e70ff49f95e28c6e03df61bbedff25a1f4b2f Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Wed, 30 Jul 2025 11:09:35 +0200 Subject: [PATCH 08/49] Prepare next release 5.7.0-SNAPSHOT --- commons-datastore/commons-datastore-core/pom.xml | 2 +- commons-datastore/commons-datastore-mongodb/pom.xml | 2 +- commons-datastore/commons-datastore-solr/pom.xml | 2 +- commons-datastore/pom.xml | 2 +- commons-lib/pom.xml | 2 +- pom.xml | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/commons-datastore/commons-datastore-core/pom.xml b/commons-datastore/commons-datastore-core/pom.xml index abf75a057..72a55dd74 100644 --- a/commons-datastore/commons-datastore-core/pom.xml +++ b/commons-datastore/commons-datastore-core/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons-datastore - 5.6.0 + 5.7.0-SNAPSHOT ../pom.xml diff --git a/commons-datastore/commons-datastore-mongodb/pom.xml b/commons-datastore/commons-datastore-mongodb/pom.xml index 082394e1e..656fcca4d 100644 --- a/commons-datastore/commons-datastore-mongodb/pom.xml +++ b/commons-datastore/commons-datastore-mongodb/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons-datastore - 5.6.0 + 5.7.0-SNAPSHOT ../pom.xml diff --git a/commons-datastore/commons-datastore-solr/pom.xml b/commons-datastore/commons-datastore-solr/pom.xml index d2a790bc3..81a443632 100644 --- a/commons-datastore/commons-datastore-solr/pom.xml +++ b/commons-datastore/commons-datastore-solr/pom.xml @@ -22,7 +22,7 @@ org.opencb.commons commons-datastore - 5.6.0 + 5.7.0-SNAPSHOT ../pom.xml diff --git a/commons-datastore/pom.xml b/commons-datastore/pom.xml index 777903eea..fdea9ca47 100644 --- a/commons-datastore/pom.xml +++ b/commons-datastore/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons - 5.6.0 + 5.7.0-SNAPSHOT ../pom.xml diff --git a/commons-lib/pom.xml b/commons-lib/pom.xml index fe6f33d92..ba5ab94f4 100644 --- a/commons-lib/pom.xml +++ b/commons-lib/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons - 5.6.0 + 5.7.0-SNAPSHOT ../pom.xml diff --git a/pom.xml b/pom.xml index 93f7a37a2..1206ba080 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons - 5.6.0 + 5.7.0-SNAPSHOT pom OpenCB commons project From eb02517da9bdf483ff90db3ae126112dcc6b5d39 Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Thu, 31 Jul 2025 15:56:34 +0200 Subject: [PATCH 09/49] pom: Update distributionManagement #TASK-7783 --- commons-datastore/commons-datastore-core/pom.xml | 2 +- commons-datastore/commons-datastore-mongodb/pom.xml | 2 +- commons-datastore/commons-datastore-solr/pom.xml | 2 +- commons-datastore/pom.xml | 2 +- commons-lib/pom.xml | 2 +- pom.xml | 6 +++--- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/commons-datastore/commons-datastore-core/pom.xml b/commons-datastore/commons-datastore-core/pom.xml index 72a55dd74..a7688a915 100644 --- a/commons-datastore/commons-datastore-core/pom.xml +++ b/commons-datastore/commons-datastore-core/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons-datastore - 5.7.0-SNAPSHOT + 5.6.0-SNAPSHOT ../pom.xml diff --git a/commons-datastore/commons-datastore-mongodb/pom.xml b/commons-datastore/commons-datastore-mongodb/pom.xml index 656fcca4d..ea8d77c6e 100644 --- a/commons-datastore/commons-datastore-mongodb/pom.xml +++ b/commons-datastore/commons-datastore-mongodb/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons-datastore - 5.7.0-SNAPSHOT + 5.6.0-SNAPSHOT ../pom.xml diff --git a/commons-datastore/commons-datastore-solr/pom.xml b/commons-datastore/commons-datastore-solr/pom.xml index 81a443632..10d9baeaa 100644 --- a/commons-datastore/commons-datastore-solr/pom.xml +++ b/commons-datastore/commons-datastore-solr/pom.xml @@ -22,7 +22,7 @@ org.opencb.commons commons-datastore - 5.7.0-SNAPSHOT + 5.6.0-SNAPSHOT ../pom.xml diff --git a/commons-datastore/pom.xml b/commons-datastore/pom.xml index fdea9ca47..0ad238d50 100644 --- a/commons-datastore/pom.xml +++ b/commons-datastore/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons - 5.7.0-SNAPSHOT + 5.6.0-SNAPSHOT ../pom.xml diff --git a/commons-lib/pom.xml b/commons-lib/pom.xml index ba5ab94f4..b83808599 100644 --- a/commons-lib/pom.xml +++ b/commons-lib/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons - 5.7.0-SNAPSHOT + 5.6.0-SNAPSHOT ../pom.xml diff --git a/pom.xml b/pom.xml index 1206ba080..7bdc64af2 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons - 5.7.0-SNAPSHOT + 5.6.0-SNAPSHOT pom OpenCB commons project @@ -312,11 +312,11 @@ ossrh - https://oss.sonatype.org/service/local/staging/deploy/maven2/ + https://ossrh-staging-api.central.sonatype.com/service/local/ ossrh - https://oss.sonatype.org/content/repositories/snapshots + https://central.sonatype.com/repository/maven-snapshots/ From 55a26036037548d7eed9345bd26f01c8bf69f7d0 Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Thu, 31 Jul 2025 15:58:11 +0200 Subject: [PATCH 10/49] Prepare release 5.6.0 --- commons-datastore/commons-datastore-core/pom.xml | 2 +- commons-datastore/commons-datastore-mongodb/pom.xml | 2 +- commons-datastore/commons-datastore-solr/pom.xml | 2 +- commons-datastore/pom.xml | 2 +- commons-lib/pom.xml | 2 +- pom.xml | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/commons-datastore/commons-datastore-core/pom.xml b/commons-datastore/commons-datastore-core/pom.xml index a7688a915..abf75a057 100644 --- a/commons-datastore/commons-datastore-core/pom.xml +++ b/commons-datastore/commons-datastore-core/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons-datastore - 5.6.0-SNAPSHOT + 5.6.0 ../pom.xml diff --git a/commons-datastore/commons-datastore-mongodb/pom.xml b/commons-datastore/commons-datastore-mongodb/pom.xml index ea8d77c6e..082394e1e 100644 --- a/commons-datastore/commons-datastore-mongodb/pom.xml +++ b/commons-datastore/commons-datastore-mongodb/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons-datastore - 5.6.0-SNAPSHOT + 5.6.0 ../pom.xml diff --git a/commons-datastore/commons-datastore-solr/pom.xml b/commons-datastore/commons-datastore-solr/pom.xml index 10d9baeaa..d2a790bc3 100644 --- a/commons-datastore/commons-datastore-solr/pom.xml +++ b/commons-datastore/commons-datastore-solr/pom.xml @@ -22,7 +22,7 @@ org.opencb.commons commons-datastore - 5.6.0-SNAPSHOT + 5.6.0 ../pom.xml diff --git a/commons-datastore/pom.xml b/commons-datastore/pom.xml index 0ad238d50..777903eea 100644 --- a/commons-datastore/pom.xml +++ b/commons-datastore/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons - 5.6.0-SNAPSHOT + 5.6.0 ../pom.xml diff --git a/commons-lib/pom.xml b/commons-lib/pom.xml index b83808599..fe6f33d92 100644 --- a/commons-lib/pom.xml +++ b/commons-lib/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons - 5.6.0-SNAPSHOT + 5.6.0 ../pom.xml diff --git a/pom.xml b/pom.xml index 7bdc64af2..6fa1d2be3 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons - 5.6.0-SNAPSHOT + 5.6.0 pom OpenCB commons project From 8b84ae655cbd1e24a8e3a5968a5aeee3267ac6df Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Thu, 31 Jul 2025 15:58:32 +0200 Subject: [PATCH 11/49] Prepare next release 5.7.0-SNAPSHOT --- commons-datastore/commons-datastore-core/pom.xml | 2 +- commons-datastore/commons-datastore-mongodb/pom.xml | 2 +- commons-datastore/commons-datastore-solr/pom.xml | 2 +- commons-datastore/pom.xml | 2 +- commons-lib/pom.xml | 2 +- pom.xml | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/commons-datastore/commons-datastore-core/pom.xml b/commons-datastore/commons-datastore-core/pom.xml index abf75a057..72a55dd74 100644 --- a/commons-datastore/commons-datastore-core/pom.xml +++ b/commons-datastore/commons-datastore-core/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons-datastore - 5.6.0 + 5.7.0-SNAPSHOT ../pom.xml diff --git a/commons-datastore/commons-datastore-mongodb/pom.xml b/commons-datastore/commons-datastore-mongodb/pom.xml index 082394e1e..656fcca4d 100644 --- a/commons-datastore/commons-datastore-mongodb/pom.xml +++ b/commons-datastore/commons-datastore-mongodb/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons-datastore - 5.6.0 + 5.7.0-SNAPSHOT ../pom.xml diff --git a/commons-datastore/commons-datastore-solr/pom.xml b/commons-datastore/commons-datastore-solr/pom.xml index d2a790bc3..81a443632 100644 --- a/commons-datastore/commons-datastore-solr/pom.xml +++ b/commons-datastore/commons-datastore-solr/pom.xml @@ -22,7 +22,7 @@ org.opencb.commons commons-datastore - 5.6.0 + 5.7.0-SNAPSHOT ../pom.xml diff --git a/commons-datastore/pom.xml b/commons-datastore/pom.xml index 777903eea..fdea9ca47 100644 --- a/commons-datastore/pom.xml +++ b/commons-datastore/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons - 5.6.0 + 5.7.0-SNAPSHOT ../pom.xml diff --git a/commons-lib/pom.xml b/commons-lib/pom.xml index fe6f33d92..ba5ab94f4 100644 --- a/commons-lib/pom.xml +++ b/commons-lib/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons - 5.6.0 + 5.7.0-SNAPSHOT ../pom.xml diff --git a/pom.xml b/pom.xml index 6fa1d2be3..40e61b4bd 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons - 5.6.0 + 5.7.0-SNAPSHOT pom OpenCB commons project From 68138db3ec9d040d797b9352ac507f263cb1fe83 Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Thu, 31 Jul 2025 16:29:07 +0200 Subject: [PATCH 12/49] pom: Update distributionManagement #TASK-7783 --- commons-datastore/commons-datastore-core/pom.xml | 2 +- commons-datastore/commons-datastore-mongodb/pom.xml | 2 +- commons-datastore/commons-datastore-solr/pom.xml | 2 +- commons-datastore/pom.xml | 2 +- commons-lib/pom.xml | 2 +- pom.xml | 4 ++-- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/commons-datastore/commons-datastore-core/pom.xml b/commons-datastore/commons-datastore-core/pom.xml index 72a55dd74..a7688a915 100644 --- a/commons-datastore/commons-datastore-core/pom.xml +++ b/commons-datastore/commons-datastore-core/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons-datastore - 5.7.0-SNAPSHOT + 5.6.0-SNAPSHOT ../pom.xml diff --git a/commons-datastore/commons-datastore-mongodb/pom.xml b/commons-datastore/commons-datastore-mongodb/pom.xml index 656fcca4d..ea8d77c6e 100644 --- a/commons-datastore/commons-datastore-mongodb/pom.xml +++ b/commons-datastore/commons-datastore-mongodb/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons-datastore - 5.7.0-SNAPSHOT + 5.6.0-SNAPSHOT ../pom.xml diff --git a/commons-datastore/commons-datastore-solr/pom.xml b/commons-datastore/commons-datastore-solr/pom.xml index 81a443632..10d9baeaa 100644 --- a/commons-datastore/commons-datastore-solr/pom.xml +++ b/commons-datastore/commons-datastore-solr/pom.xml @@ -22,7 +22,7 @@ org.opencb.commons commons-datastore - 5.7.0-SNAPSHOT + 5.6.0-SNAPSHOT ../pom.xml diff --git a/commons-datastore/pom.xml b/commons-datastore/pom.xml index fdea9ca47..0ad238d50 100644 --- a/commons-datastore/pom.xml +++ b/commons-datastore/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons - 5.7.0-SNAPSHOT + 5.6.0-SNAPSHOT ../pom.xml diff --git a/commons-lib/pom.xml b/commons-lib/pom.xml index ba5ab94f4..b83808599 100644 --- a/commons-lib/pom.xml +++ b/commons-lib/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons - 5.7.0-SNAPSHOT + 5.6.0-SNAPSHOT ../pom.xml diff --git a/pom.xml b/pom.xml index 40e61b4bd..d6f5c34ea 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons - 5.7.0-SNAPSHOT + 5.6.0-SNAPSHOT pom OpenCB commons project @@ -312,7 +312,7 @@ ossrh - https://ossrh-staging-api.central.sonatype.com/service/local/ + https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2/ ossrh From cc3aef6a51c331141442260ff0f298034b9603c8 Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Fri, 1 Aug 2025 10:41:41 +0200 Subject: [PATCH 13/49] cicd: Rewrite the settings.xml for maven #TASK-7783 --- .../deploy-maven-central-workflow.yml | 82 +++++++++++++++++ .../deploy-maven-repository-workflow.bkp | 53 +++++++++++ .../deploy-maven-repository-workflow.yml | 89 +++++++++++++------ 3 files changed, 196 insertions(+), 28 deletions(-) create mode 100644 .github/workflows/deploy-maven-central-workflow.yml create mode 100644 .github/workflows/deploy-maven-repository-workflow.bkp diff --git a/.github/workflows/deploy-maven-central-workflow.yml b/.github/workflows/deploy-maven-central-workflow.yml new file mode 100644 index 000000000..3f4d76c3f --- /dev/null +++ b/.github/workflows/deploy-maven-central-workflow.yml @@ -0,0 +1,82 @@ +# This workflow deploys a Maven project to Sonatype Central using a reusable action. +name: Reusable Sonatype Central Deployment + +on: + workflow_call: + inputs: + maven_opts: + description: 'Additional Maven CLI options (optional)' + type: string + required: false + secrets: + MAVEN_NEXUS_USER: + description: 'Sonatype Central username (token)' + required: true + MAVEN_NEXUS_PASSWORD: + description: 'Sonatype Central password (token)' + required: true + MAVEN_GPG_PRIVATE_KEY: + description: 'Base64-encoded GPG private key' + required: true + MAVEN_GPG_PASSPHRASE: + description: 'Passphrase for your GPG key' + required: true + +jobs: + deploy: + name: Deploy to Sonatype Central + runs-on: ubuntu-22.04 + env: + # Allow GPG to access a TTY if needed + GPG_TTY: ${{ runner.tool_cache }}/workspace/.gpg + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + # Fetch full history so tags and versions are available + fetch-depth: 10 + + - name: Set up Java 8 & Maven cache + uses: actions/setup-java@v4 + with: + distribution: 'temurin' # Eclipse Temurin JDK + java-version: '8' # Java 8 compatibility + cache: 'maven' # Cache dependencies + + - name: Import GPG private key + # Decode and import your Base64-encoded private key + env: + GPG_KEY: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} + GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} + run: | + echo "$GPG_KEY" | base64 -d > private.key + gpg --batch --import private.key + rm private.key + + - name: Generate Maven settings.xml + # Create settings.xml with Sonatype Central credentials & GPG profile + run: | + cat > settings.xml < + + + central + ${{ secrets.MAVEN_NEXUS_USER }} + ${{ secrets.MAVEN_NEXUS_PASSWORD }} + + + + + gpg + + ${{ secrets.MAVEN_GPG_PASSPHRASE }} + + + + + EOF + + - name: Deploy to Central + # A single Maven deploy picks SNAPSHOT vs Release by your POM’s version + run: mvn clean deploy -DskipTests -s settings.xml ${{ inputs.maven_opts }} --no-transfer-progress diff --git a/.github/workflows/deploy-maven-repository-workflow.bkp b/.github/workflows/deploy-maven-repository-workflow.bkp new file mode 100644 index 000000000..c2dc332ca --- /dev/null +++ b/.github/workflows/deploy-maven-repository-workflow.bkp @@ -0,0 +1,53 @@ +name: Reusable workflow to deploy in Apache Maven + +on: + workflow_call: + inputs: + maven_opts: + type: string + required: false + secrets: + MAVEN_NEXUS_USER: + required: true + MAVEN_NEXUS_PASSWORD: + required: true + MAVEN_GPG_PASSPHRASE: + required: true + MAVEN_GPG_PRIVATE_KEY: + required: true + +jobs: + deploy-workflow: + name: Deploy to Maven and GitHub Packages + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: '10' + - name: Set up JDK 8 + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: '8' + cache: 'maven' + ## Future Nacho and Juanfe, please read this very carefully: DO NOT TOUCH!!! + server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml + server-username: MAVEN_NEXUS_USER # env variable for username in deploy + server-password: MAVEN_NEXUS_PASSWORD # env variable for token in deploy + gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Value of the GPG private key to import + gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase + - name: Deploy to Maven Central repository + run: mvn clean deploy -DskipTests -P deploy-maven ${{ inputs.maven_opts }} --no-transfer-progress + env: + MAVEN_NEXUS_USER: ${{ secrets.MAVEN_USER_TOKEN }} + MAVEN_NEXUS_PASSWORD: ${{ secrets.MAVEN_PASSWORD_TOKEN }} + MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} + - name: Set up Java for publishing to GitHub Packages + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: '8' + - name: Deploy to GitHub Packages repository + run: mvn clean deploy -DskipTests -P deploy-github ${{ inputs.maven_opts }} --no-transfer-progress + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/deploy-maven-repository-workflow.yml b/.github/workflows/deploy-maven-repository-workflow.yml index c2dc332ca..d831629e7 100644 --- a/.github/workflows/deploy-maven-repository-workflow.yml +++ b/.github/workflows/deploy-maven-repository-workflow.yml @@ -1,53 +1,86 @@ -name: Reusable workflow to deploy in Apache Maven +# This workflow deploys a Maven project to Sonatype Central using a reusable action. +name: Reusable Sonatype Central Deployment on: workflow_call: inputs: maven_opts: + description: 'Additional Maven CLI options (optional)' type: string required: false secrets: MAVEN_NEXUS_USER: + description: 'Sonatype Central username (token)' required: true MAVEN_NEXUS_PASSWORD: - required: true - MAVEN_GPG_PASSPHRASE: + description: 'Sonatype Central password (token)' required: true MAVEN_GPG_PRIVATE_KEY: + description: 'Base64-encoded GPG private key' + required: true + MAVEN_GPG_PASSPHRASE: + description: 'Passphrase for your GPG key' required: true jobs: - deploy-workflow: - name: Deploy to Maven and GitHub Packages + deploy: + name: Deploy to Sonatype Central runs-on: ubuntu-22.04 + env: + # Allow GPG to access a TTY if needed + GPG_TTY: ${{ runner.tool_cache }}/workspace/.gpg + steps: - - uses: actions/checkout@v4 + - name: Checkout repository + uses: actions/checkout@v4 with: - fetch-depth: '10' - - name: Set up JDK 8 + # Fetch full history so tags and versions are available + fetch-depth: 10 + + - name: Set up Java 8 & Maven cache uses: actions/setup-java@v4 with: - distribution: 'temurin' - java-version: '8' - cache: 'maven' - ## Future Nacho and Juanfe, please read this very carefully: DO NOT TOUCH!!! - server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml - server-username: MAVEN_NEXUS_USER # env variable for username in deploy - server-password: MAVEN_NEXUS_PASSWORD # env variable for token in deploy - gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Value of the GPG private key to import - gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase - - name: Deploy to Maven Central repository - run: mvn clean deploy -DskipTests -P deploy-maven ${{ inputs.maven_opts }} --no-transfer-progress + distribution: 'temurin' # Eclipse Temurin JDK + java-version: '8' # Java 8 compatibility + cache: 'maven' # Cache dependencies + + - name: Import GPG private key + # Decode and import your Base64-encoded private key env: - MAVEN_NEXUS_USER: ${{ secrets.MAVEN_USER_TOKEN }} - MAVEN_NEXUS_PASSWORD: ${{ secrets.MAVEN_PASSWORD_TOKEN }} - MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} - - name: Set up Java for publishing to GitHub Packages - uses: actions/setup-java@v4 - with: - distribution: 'temurin' - java-version: '8' + GPG_KEY: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} + GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} + run: | + echo "$GPG_KEY" | base64 -d > private.key + gpg --batch --import private.key + rm private.key + + - name: Generate Maven settings.xml + # Create settings.xml with Sonatype Central credentials & GPG profile + run: | + cat > settings.xml < + + + central + ${{ secrets.MAVEN_NEXUS_USER }} + ${{ secrets.MAVEN_NEXUS_PASSWORD }} + + + + + gpg + + ${{ secrets.MAVEN_GPG_PASSPHRASE }} + + + + + EOF + + - name: Deploy to Central + # A single Maven deploy picks SNAPSHOT vs Release by your POM’s version + run: mvn clean deploy -DskipTests -P deploy-maven -s settings.xml ${{ inputs.maven_opts }} --no-transfer-progress - name: Deploy to GitHub Packages repository run: mvn clean deploy -DskipTests -P deploy-github ${{ inputs.maven_opts }} --no-transfer-progress env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file From c48c284b0649157e3158562c88d00e84adc95436 Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Fri, 1 Aug 2025 10:45:43 +0200 Subject: [PATCH 14/49] cicd: delete runner.tool_cache #TASK-7783 --- .../workflows/deploy-maven-repository-workflow.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/deploy-maven-repository-workflow.yml b/.github/workflows/deploy-maven-repository-workflow.yml index d831629e7..9d67b79c8 100644 --- a/.github/workflows/deploy-maven-repository-workflow.yml +++ b/.github/workflows/deploy-maven-repository-workflow.yml @@ -26,10 +26,6 @@ jobs: deploy: name: Deploy to Sonatype Central runs-on: ubuntu-22.04 - env: - # Allow GPG to access a TTY if needed - GPG_TTY: ${{ runner.tool_cache }}/workspace/.gpg - steps: - name: Checkout repository uses: actions/checkout@v4 @@ -45,13 +41,16 @@ jobs: cache: 'maven' # Cache dependencies - name: Import GPG private key - # Decode and import your Base64-encoded private key + # Decode and import your Base64-encoded private key, + # and ensure GPG can find a TTY for passphrase prompts if needed env: GPG_KEY: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} run: | + # Set GPG_TTY at runtime instead of using runner.tool_cache + export GPG_TTY=$(tty || echo /dev/console) echo "$GPG_KEY" | base64 -d > private.key - gpg --batch --import private.key + gpg --batch --passphrase "$GPG_PASSPHRASE" --import private.key rm private.key - name: Generate Maven settings.xml From 11e8c1f1db696f596e1335b239aa67568c13f993 Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Fri, 1 Aug 2025 10:48:56 +0200 Subject: [PATCH 15/49] cicd: fix base64 error #TASK-7783 --- .github/workflows/deploy-maven-repository-workflow.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/deploy-maven-repository-workflow.yml b/.github/workflows/deploy-maven-repository-workflow.yml index 9d67b79c8..1ace97e2a 100644 --- a/.github/workflows/deploy-maven-repository-workflow.yml +++ b/.github/workflows/deploy-maven-repository-workflow.yml @@ -41,16 +41,14 @@ jobs: cache: 'maven' # Cache dependencies - name: Import GPG private key - # Decode and import your Base64-encoded private key, - # and ensure GPG can find a TTY for passphrase prompts if needed + # Write your secret directly to a file (no base64 decode), + # set GPG_TTY so gpg can prompt if ever needed. env: GPG_KEY: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} - GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} run: | - # Set GPG_TTY at runtime instead of using runner.tool_cache export GPG_TTY=$(tty || echo /dev/console) - echo "$GPG_KEY" | base64 -d > private.key - gpg --batch --passphrase "$GPG_PASSPHRASE" --import private.key + echo "$GPG_KEY" > private.key + gpg --batch --import private.key rm private.key - name: Generate Maven settings.xml From 51dd144a98101b8600f232c92c984a50ebc1f73a Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Fri, 1 Aug 2025 10:53:50 +0200 Subject: [PATCH 16/49] cicd: Configure GPG for loopback pinentry #TASK-7783 --- .../workflows/deploy-maven-repository-workflow.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/deploy-maven-repository-workflow.yml b/.github/workflows/deploy-maven-repository-workflow.yml index 1ace97e2a..3457d34c5 100644 --- a/.github/workflows/deploy-maven-repository-workflow.yml +++ b/.github/workflows/deploy-maven-repository-workflow.yml @@ -40,15 +40,20 @@ jobs: java-version: '8' # Java 8 compatibility cache: 'maven' # Cache dependencies + + - name: Configure GPG for loopback pinentry + run: | + mkdir -p ~/.gnupg + echo "allow-loopback-pinentry" >> ~/.gnupg/gpg.conf + chmod 600 ~/.gnupg/gpg.conf + - name: Import GPG private key - # Write your secret directly to a file (no base64 decode), - # set GPG_TTY so gpg can prompt if ever needed. env: GPG_KEY: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} run: | export GPG_TTY=$(tty || echo /dev/console) echo "$GPG_KEY" > private.key - gpg --batch --import private.key + gpg --batch --pinentry-mode loopback --import private.key rm private.key - name: Generate Maven settings.xml From a02546e410362229f9d79676121b4bf75f69b26a Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Fri, 1 Aug 2025 10:58:23 +0200 Subject: [PATCH 17/49] cicd: Rename server id to ossrh #TASK-7783 --- .github/workflows/deploy-maven-repository-workflow.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy-maven-repository-workflow.yml b/.github/workflows/deploy-maven-repository-workflow.yml index 3457d34c5..80d790a0e 100644 --- a/.github/workflows/deploy-maven-repository-workflow.yml +++ b/.github/workflows/deploy-maven-repository-workflow.yml @@ -63,7 +63,7 @@ jobs: - central + ossrh ${{ secrets.MAVEN_NEXUS_USER }} ${{ secrets.MAVEN_NEXUS_PASSWORD }} From 5db1c8dfd3fe7973606cec59d359205cc377fbf7 Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Fri, 1 Aug 2025 11:03:43 +0200 Subject: [PATCH 18/49] cicd: Update url to server id to ossrh #TASK-7783 --- .../deploy-maven-central-workflow.yml | 82 ------------------- .../deploy-maven-repository-workflow.yml | 4 +- pom.xml | 2 +- 3 files changed, 4 insertions(+), 84 deletions(-) delete mode 100644 .github/workflows/deploy-maven-central-workflow.yml diff --git a/.github/workflows/deploy-maven-central-workflow.yml b/.github/workflows/deploy-maven-central-workflow.yml deleted file mode 100644 index 3f4d76c3f..000000000 --- a/.github/workflows/deploy-maven-central-workflow.yml +++ /dev/null @@ -1,82 +0,0 @@ -# This workflow deploys a Maven project to Sonatype Central using a reusable action. -name: Reusable Sonatype Central Deployment - -on: - workflow_call: - inputs: - maven_opts: - description: 'Additional Maven CLI options (optional)' - type: string - required: false - secrets: - MAVEN_NEXUS_USER: - description: 'Sonatype Central username (token)' - required: true - MAVEN_NEXUS_PASSWORD: - description: 'Sonatype Central password (token)' - required: true - MAVEN_GPG_PRIVATE_KEY: - description: 'Base64-encoded GPG private key' - required: true - MAVEN_GPG_PASSPHRASE: - description: 'Passphrase for your GPG key' - required: true - -jobs: - deploy: - name: Deploy to Sonatype Central - runs-on: ubuntu-22.04 - env: - # Allow GPG to access a TTY if needed - GPG_TTY: ${{ runner.tool_cache }}/workspace/.gpg - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - # Fetch full history so tags and versions are available - fetch-depth: 10 - - - name: Set up Java 8 & Maven cache - uses: actions/setup-java@v4 - with: - distribution: 'temurin' # Eclipse Temurin JDK - java-version: '8' # Java 8 compatibility - cache: 'maven' # Cache dependencies - - - name: Import GPG private key - # Decode and import your Base64-encoded private key - env: - GPG_KEY: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} - GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} - run: | - echo "$GPG_KEY" | base64 -d > private.key - gpg --batch --import private.key - rm private.key - - - name: Generate Maven settings.xml - # Create settings.xml with Sonatype Central credentials & GPG profile - run: | - cat > settings.xml < - - - central - ${{ secrets.MAVEN_NEXUS_USER }} - ${{ secrets.MAVEN_NEXUS_PASSWORD }} - - - - - gpg - - ${{ secrets.MAVEN_GPG_PASSPHRASE }} - - - - - EOF - - - name: Deploy to Central - # A single Maven deploy picks SNAPSHOT vs Release by your POM’s version - run: mvn clean deploy -DskipTests -s settings.xml ${{ inputs.maven_opts }} --no-transfer-progress diff --git a/.github/workflows/deploy-maven-repository-workflow.yml b/.github/workflows/deploy-maven-repository-workflow.yml index 80d790a0e..310881375 100644 --- a/.github/workflows/deploy-maven-repository-workflow.yml +++ b/.github/workflows/deploy-maven-repository-workflow.yml @@ -57,7 +57,6 @@ jobs: rm private.key - name: Generate Maven settings.xml - # Create settings.xml with Sonatype Central credentials & GPG profile run: | cat > settings.xml < @@ -76,6 +75,9 @@ jobs: + + gpg + EOF diff --git a/pom.xml b/pom.xml index d6f5c34ea..c0d24dad0 100644 --- a/pom.xml +++ b/pom.xml @@ -378,7 +378,7 @@ true ossrh - https://oss.sonatype.org/ + https://ossrh-staging-api.central.sonatype.com/ true From 92e5a112342d01923593a98aa06a6eb333235703 Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Fri, 1 Aug 2025 12:30:27 +0200 Subject: [PATCH 19/49] cicd: Deleted org.sonatype.plugins:nexus-staging-maven-plugin and distribution management Added central-publishing-maven-plugin #TASK-7783 --- pom.xml | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/pom.xml b/pom.xml index c0d24dad0..c191b620f 100644 --- a/pom.xml +++ b/pom.xml @@ -309,16 +309,6 @@ deploy-maven - - - ossrh - https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2/ - - - ossrh - https://central.sonatype.com/repository/maven-snapshots/ - - @@ -371,17 +361,24 @@ + - org.sonatype.plugins - nexus-staging-maven-plugin - 1.6.8 + org.sonatype.central + central-publishing-maven-plugin + 0.8.0 true - ossrh - https://ossrh-staging-api.central.sonatype.com/ - true + + ossrh + + true + + published + + true + From 521ae4ee0239283c50ed9da3c881de08268a63af Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Fri, 1 Aug 2025 12:34:07 +0200 Subject: [PATCH 20/49] cicd: Force the snapshot endpoint and authenticate there #TASK-7783 --- pom.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pom.xml b/pom.xml index c191b620f..873c9d9e3 100644 --- a/pom.xml +++ b/pom.xml @@ -370,6 +370,8 @@ ossrh + + https://central.sonatype.com/repository/maven-snapshots/ true From 9b4ba6cf33e5d1e7cd001272e60f14ec3eebe5df Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Fri, 1 Aug 2025 12:40:44 +0200 Subject: [PATCH 21/49] cicd: the plugin will use distributionManagement when your version ends with -SNAPSHOT #TASK-7783 --- pom.xml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 873c9d9e3..8288cdfc4 100644 --- a/pom.xml +++ b/pom.xml @@ -305,7 +305,16 @@ - + + + + ossrh + https://central.sonatype.com/repository/maven-snapshots/ + + true + + + deploy-maven From 340a1a43c73c21ac9d3c09729beca1dba16462ad Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Fri, 1 Aug 2025 12:48:49 +0200 Subject: [PATCH 22/49] cicd: Unified publishing plugin for Sonatype Central releases and snapshots #TASK-7783 --- pom.xml | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/pom.xml b/pom.xml index 8288cdfc4..1aed791bb 100644 --- a/pom.xml +++ b/pom.xml @@ -305,16 +305,6 @@ - - - - ossrh - https://central.sonatype.com/repository/maven-snapshots/ - - true - - - deploy-maven @@ -377,19 +367,18 @@ 0.8.0 true - + ossrh - - https://central.sonatype.com/repository/maven-snapshots/ - + + https://s01.oss.sonatype.org/content/repositories/snapshots/ + true - + published - + true - From f31ebc64f294592748d4d0edd3149280943223dc Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Fri, 1 Aug 2025 12:52:35 +0200 Subject: [PATCH 23/49] cicd: Unified publishing plugin using distribution management for Sonatype Central releases and snapshots #TASK-7783 --- pom.xml | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/pom.xml b/pom.xml index 1aed791bb..c172099fa 100644 --- a/pom.xml +++ b/pom.xml @@ -305,6 +305,16 @@ + + + + ossrh + https://s01.oss.sonatype.org/content/repositories/snapshots/ + + true + + + deploy-maven @@ -367,18 +377,17 @@ 0.8.0 true - + ossrh - - https://s01.oss.sonatype.org/content/repositories/snapshots/ - + true - + published - + true + From c5d89af4aaf231a9c672a1f52b5795838abab1f4 Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Mon, 4 Aug 2025 11:41:40 +0200 Subject: [PATCH 24/49] cicd: Delete snapshot url #TASK-7783 --- pom.xml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/pom.xml b/pom.xml index c172099fa..e6ba56a64 100644 --- a/pom.xml +++ b/pom.xml @@ -52,14 +52,14 @@ - - ossrh - https://oss.sonatype.org/content/repositories/snapshots - - true - daily - - + + + + + + + + github https://maven.pkg.github.com/opencb @@ -386,7 +386,7 @@ true - + :w From 959ab4787a2a9230bd7a2e846b3f3da3a84bb0da Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Mon, 4 Aug 2025 11:42:40 +0200 Subject: [PATCH 25/49] cicd: Delete snapshot url #TASK-7783 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index e6ba56a64..a4b622ed2 100644 --- a/pom.xml +++ b/pom.xml @@ -386,7 +386,7 @@ true - :w + From 8897b73f9da723693978892a963f3b564747247a Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Mon, 4 Aug 2025 12:57:14 +0200 Subject: [PATCH 26/49] cicd: Delete snapshot url #TASK-7783 --- pom.xml | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/pom.xml b/pom.xml index a4b622ed2..0e10b0788 100644 --- a/pom.xml +++ b/pom.xml @@ -52,14 +52,14 @@ - - - - - - - - + + ossrh + https://oss.sonatype.org/content/repositories/snapshots + + true + daily + + github https://maven.pkg.github.com/opencb @@ -305,16 +305,16 @@ - - - - ossrh - https://s01.oss.sonatype.org/content/repositories/snapshots/ - - true - - - + + + + + + + + + + deploy-maven From f96de9cd988d73051b2111b0087c709a702537c2 Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Mon, 4 Aug 2025 13:19:21 +0200 Subject: [PATCH 27/49] cicd: Update distributionManagement #TASK-7783 --- pom.xml | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/pom.xml b/pom.xml index 0e10b0788..9cabaa57a 100644 --- a/pom.xml +++ b/pom.xml @@ -52,14 +52,6 @@ - - ossrh - https://oss.sonatype.org/content/repositories/snapshots - - true - daily - - github https://maven.pkg.github.com/opencb @@ -305,16 +297,21 @@ - - - - - - - - - - + + + + + ossrh + OSSRH Staging API Releases + https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2/ + + + + ossrh + Central Portal Snapshots + https://central.sonatype.com/repository/maven-snapshots/ + + deploy-maven From 7d3df0816875af396b0c09857c33977dec7114bc Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Mon, 4 Aug 2025 13:24:01 +0200 Subject: [PATCH 28/49] cicd: Update distributionManagement #TASK-7783 --- .../deploy-maven-repository-workflow.bkp | 53 ----------- .../deploy-maven-repository-workflow.old | 90 ++++++++++++++++++ .../deploy-maven-repository-workflow.yml | 93 ++++++------------- 3 files changed, 118 insertions(+), 118 deletions(-) delete mode 100644 .github/workflows/deploy-maven-repository-workflow.bkp create mode 100644 .github/workflows/deploy-maven-repository-workflow.old diff --git a/.github/workflows/deploy-maven-repository-workflow.bkp b/.github/workflows/deploy-maven-repository-workflow.bkp deleted file mode 100644 index c2dc332ca..000000000 --- a/.github/workflows/deploy-maven-repository-workflow.bkp +++ /dev/null @@ -1,53 +0,0 @@ -name: Reusable workflow to deploy in Apache Maven - -on: - workflow_call: - inputs: - maven_opts: - type: string - required: false - secrets: - MAVEN_NEXUS_USER: - required: true - MAVEN_NEXUS_PASSWORD: - required: true - MAVEN_GPG_PASSPHRASE: - required: true - MAVEN_GPG_PRIVATE_KEY: - required: true - -jobs: - deploy-workflow: - name: Deploy to Maven and GitHub Packages - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: '10' - - name: Set up JDK 8 - uses: actions/setup-java@v4 - with: - distribution: 'temurin' - java-version: '8' - cache: 'maven' - ## Future Nacho and Juanfe, please read this very carefully: DO NOT TOUCH!!! - server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml - server-username: MAVEN_NEXUS_USER # env variable for username in deploy - server-password: MAVEN_NEXUS_PASSWORD # env variable for token in deploy - gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Value of the GPG private key to import - gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase - - name: Deploy to Maven Central repository - run: mvn clean deploy -DskipTests -P deploy-maven ${{ inputs.maven_opts }} --no-transfer-progress - env: - MAVEN_NEXUS_USER: ${{ secrets.MAVEN_USER_TOKEN }} - MAVEN_NEXUS_PASSWORD: ${{ secrets.MAVEN_PASSWORD_TOKEN }} - MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} - - name: Set up Java for publishing to GitHub Packages - uses: actions/setup-java@v4 - with: - distribution: 'temurin' - java-version: '8' - - name: Deploy to GitHub Packages repository - run: mvn clean deploy -DskipTests -P deploy-github ${{ inputs.maven_opts }} --no-transfer-progress - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/deploy-maven-repository-workflow.old b/.github/workflows/deploy-maven-repository-workflow.old new file mode 100644 index 000000000..310881375 --- /dev/null +++ b/.github/workflows/deploy-maven-repository-workflow.old @@ -0,0 +1,90 @@ +# This workflow deploys a Maven project to Sonatype Central using a reusable action. +name: Reusable Sonatype Central Deployment + +on: + workflow_call: + inputs: + maven_opts: + description: 'Additional Maven CLI options (optional)' + type: string + required: false + secrets: + MAVEN_NEXUS_USER: + description: 'Sonatype Central username (token)' + required: true + MAVEN_NEXUS_PASSWORD: + description: 'Sonatype Central password (token)' + required: true + MAVEN_GPG_PRIVATE_KEY: + description: 'Base64-encoded GPG private key' + required: true + MAVEN_GPG_PASSPHRASE: + description: 'Passphrase for your GPG key' + required: true + +jobs: + deploy: + name: Deploy to Sonatype Central + runs-on: ubuntu-22.04 + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + # Fetch full history so tags and versions are available + fetch-depth: 10 + + - name: Set up Java 8 & Maven cache + uses: actions/setup-java@v4 + with: + distribution: 'temurin' # Eclipse Temurin JDK + java-version: '8' # Java 8 compatibility + cache: 'maven' # Cache dependencies + + + - name: Configure GPG for loopback pinentry + run: | + mkdir -p ~/.gnupg + echo "allow-loopback-pinentry" >> ~/.gnupg/gpg.conf + chmod 600 ~/.gnupg/gpg.conf + + - name: Import GPG private key + env: + GPG_KEY: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} + run: | + export GPG_TTY=$(tty || echo /dev/console) + echo "$GPG_KEY" > private.key + gpg --batch --pinentry-mode loopback --import private.key + rm private.key + + - name: Generate Maven settings.xml + run: | + cat > settings.xml < + + + ossrh + ${{ secrets.MAVEN_NEXUS_USER }} + ${{ secrets.MAVEN_NEXUS_PASSWORD }} + + + + + gpg + + ${{ secrets.MAVEN_GPG_PASSPHRASE }} + + + + + gpg + + + EOF + + - name: Deploy to Central + # A single Maven deploy picks SNAPSHOT vs Release by your POM’s version + run: mvn clean deploy -DskipTests -P deploy-maven -s settings.xml ${{ inputs.maven_opts }} --no-transfer-progress + - name: Deploy to GitHub Packages repository + run: mvn clean deploy -DskipTests -P deploy-github ${{ inputs.maven_opts }} --no-transfer-progress + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/deploy-maven-repository-workflow.yml b/.github/workflows/deploy-maven-repository-workflow.yml index 310881375..c2dc332ca 100644 --- a/.github/workflows/deploy-maven-repository-workflow.yml +++ b/.github/workflows/deploy-maven-repository-workflow.yml @@ -1,90 +1,53 @@ -# This workflow deploys a Maven project to Sonatype Central using a reusable action. -name: Reusable Sonatype Central Deployment +name: Reusable workflow to deploy in Apache Maven on: workflow_call: inputs: maven_opts: - description: 'Additional Maven CLI options (optional)' type: string required: false secrets: MAVEN_NEXUS_USER: - description: 'Sonatype Central username (token)' required: true MAVEN_NEXUS_PASSWORD: - description: 'Sonatype Central password (token)' - required: true - MAVEN_GPG_PRIVATE_KEY: - description: 'Base64-encoded GPG private key' required: true MAVEN_GPG_PASSPHRASE: - description: 'Passphrase for your GPG key' + required: true + MAVEN_GPG_PRIVATE_KEY: required: true jobs: - deploy: - name: Deploy to Sonatype Central + deploy-workflow: + name: Deploy to Maven and GitHub Packages runs-on: ubuntu-22.04 steps: - - name: Checkout repository - uses: actions/checkout@v4 + - uses: actions/checkout@v4 with: - # Fetch full history so tags and versions are available - fetch-depth: 10 - - - name: Set up Java 8 & Maven cache + fetch-depth: '10' + - name: Set up JDK 8 uses: actions/setup-java@v4 with: - distribution: 'temurin' # Eclipse Temurin JDK - java-version: '8' # Java 8 compatibility - cache: 'maven' # Cache dependencies - - - - name: Configure GPG for loopback pinentry - run: | - mkdir -p ~/.gnupg - echo "allow-loopback-pinentry" >> ~/.gnupg/gpg.conf - chmod 600 ~/.gnupg/gpg.conf - - - name: Import GPG private key + distribution: 'temurin' + java-version: '8' + cache: 'maven' + ## Future Nacho and Juanfe, please read this very carefully: DO NOT TOUCH!!! + server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml + server-username: MAVEN_NEXUS_USER # env variable for username in deploy + server-password: MAVEN_NEXUS_PASSWORD # env variable for token in deploy + gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Value of the GPG private key to import + gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase + - name: Deploy to Maven Central repository + run: mvn clean deploy -DskipTests -P deploy-maven ${{ inputs.maven_opts }} --no-transfer-progress env: - GPG_KEY: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} - run: | - export GPG_TTY=$(tty || echo /dev/console) - echo "$GPG_KEY" > private.key - gpg --batch --pinentry-mode loopback --import private.key - rm private.key - - - name: Generate Maven settings.xml - run: | - cat > settings.xml < - - - ossrh - ${{ secrets.MAVEN_NEXUS_USER }} - ${{ secrets.MAVEN_NEXUS_PASSWORD }} - - - - - gpg - - ${{ secrets.MAVEN_GPG_PASSPHRASE }} - - - - - gpg - - - EOF - - - name: Deploy to Central - # A single Maven deploy picks SNAPSHOT vs Release by your POM’s version - run: mvn clean deploy -DskipTests -P deploy-maven -s settings.xml ${{ inputs.maven_opts }} --no-transfer-progress + MAVEN_NEXUS_USER: ${{ secrets.MAVEN_USER_TOKEN }} + MAVEN_NEXUS_PASSWORD: ${{ secrets.MAVEN_PASSWORD_TOKEN }} + MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} + - name: Set up Java for publishing to GitHub Packages + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: '8' - name: Deploy to GitHub Packages repository run: mvn clean deploy -DskipTests -P deploy-github ${{ inputs.maven_opts }} --no-transfer-progress env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 1d8d71f9bc8c862ede1da2172a93b1d6262104b8 Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Mon, 4 Aug 2025 13:31:50 +0200 Subject: [PATCH 29/49] cicd: Migrate deploy sonatype maven plugin to central-publishing-maven-plugin #TASK-7783 --- pom.xml | 56 -------------------------------------------------------- 1 file changed, 56 deletions(-) diff --git a/pom.xml b/pom.xml index 9cabaa57a..bed28b21b 100644 --- a/pom.xml +++ b/pom.xml @@ -317,74 +317,18 @@ deploy-maven - - org.apache.maven.plugins - maven-source-plugin - 3.2.0 - - - attach-sources - - jar-no-fork - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - 3.3.2 - - - attach-javadocs - - jar - - - - - none - - - - org.apache.maven.plugins - maven-gpg-plugin - 1.6 - - - sign-artifacts - deploy - - sign - - - - - --pinentry-mode - loopback - - - - - - org.sonatype.central central-publishing-maven-plugin 0.8.0 true - ossrh - true - published - true - From 40d5e34fb712c245c9b63e56e470d47db79c4a60 Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Mon, 4 Aug 2025 13:41:58 +0200 Subject: [PATCH 30/49] cicd: Delete space after P to specify profiles #TASK-7783 --- .../deploy-maven-repository-workflow.old | 90 ------------------- .../deploy-maven-repository-workflow.yml | 4 +- 2 files changed, 2 insertions(+), 92 deletions(-) delete mode 100644 .github/workflows/deploy-maven-repository-workflow.old diff --git a/.github/workflows/deploy-maven-repository-workflow.old b/.github/workflows/deploy-maven-repository-workflow.old deleted file mode 100644 index 310881375..000000000 --- a/.github/workflows/deploy-maven-repository-workflow.old +++ /dev/null @@ -1,90 +0,0 @@ -# This workflow deploys a Maven project to Sonatype Central using a reusable action. -name: Reusable Sonatype Central Deployment - -on: - workflow_call: - inputs: - maven_opts: - description: 'Additional Maven CLI options (optional)' - type: string - required: false - secrets: - MAVEN_NEXUS_USER: - description: 'Sonatype Central username (token)' - required: true - MAVEN_NEXUS_PASSWORD: - description: 'Sonatype Central password (token)' - required: true - MAVEN_GPG_PRIVATE_KEY: - description: 'Base64-encoded GPG private key' - required: true - MAVEN_GPG_PASSPHRASE: - description: 'Passphrase for your GPG key' - required: true - -jobs: - deploy: - name: Deploy to Sonatype Central - runs-on: ubuntu-22.04 - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - # Fetch full history so tags and versions are available - fetch-depth: 10 - - - name: Set up Java 8 & Maven cache - uses: actions/setup-java@v4 - with: - distribution: 'temurin' # Eclipse Temurin JDK - java-version: '8' # Java 8 compatibility - cache: 'maven' # Cache dependencies - - - - name: Configure GPG for loopback pinentry - run: | - mkdir -p ~/.gnupg - echo "allow-loopback-pinentry" >> ~/.gnupg/gpg.conf - chmod 600 ~/.gnupg/gpg.conf - - - name: Import GPG private key - env: - GPG_KEY: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} - run: | - export GPG_TTY=$(tty || echo /dev/console) - echo "$GPG_KEY" > private.key - gpg --batch --pinentry-mode loopback --import private.key - rm private.key - - - name: Generate Maven settings.xml - run: | - cat > settings.xml < - - - ossrh - ${{ secrets.MAVEN_NEXUS_USER }} - ${{ secrets.MAVEN_NEXUS_PASSWORD }} - - - - - gpg - - ${{ secrets.MAVEN_GPG_PASSPHRASE }} - - - - - gpg - - - EOF - - - name: Deploy to Central - # A single Maven deploy picks SNAPSHOT vs Release by your POM’s version - run: mvn clean deploy -DskipTests -P deploy-maven -s settings.xml ${{ inputs.maven_opts }} --no-transfer-progress - - name: Deploy to GitHub Packages repository - run: mvn clean deploy -DskipTests -P deploy-github ${{ inputs.maven_opts }} --no-transfer-progress - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/deploy-maven-repository-workflow.yml b/.github/workflows/deploy-maven-repository-workflow.yml index c2dc332ca..0c6937ff1 100644 --- a/.github/workflows/deploy-maven-repository-workflow.yml +++ b/.github/workflows/deploy-maven-repository-workflow.yml @@ -37,7 +37,7 @@ jobs: gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Value of the GPG private key to import gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase - name: Deploy to Maven Central repository - run: mvn clean deploy -DskipTests -P deploy-maven ${{ inputs.maven_opts }} --no-transfer-progress + run: mvn clean deploy -DskipTests -Pdeploy-maven ${{ inputs.maven_opts }} --no-transfer-progress env: MAVEN_NEXUS_USER: ${{ secrets.MAVEN_USER_TOKEN }} MAVEN_NEXUS_PASSWORD: ${{ secrets.MAVEN_PASSWORD_TOKEN }} @@ -48,6 +48,6 @@ jobs: distribution: 'temurin' java-version: '8' - name: Deploy to GitHub Packages repository - run: mvn clean deploy -DskipTests -P deploy-github ${{ inputs.maven_opts }} --no-transfer-progress + run: mvn clean deploy -DskipTests -Pdeploy-github ${{ inputs.maven_opts }} --no-transfer-progress env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 3f6b8047a08f92697f64c1705e452585bb476c32 Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Mon, 4 Aug 2025 13:48:19 +0200 Subject: [PATCH 31/49] cicd: Copy distributionmanagement inside the profile tag #TASK-7783 --- pom.xml | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/pom.xml b/pom.xml index bed28b21b..f18537055 100644 --- a/pom.xml +++ b/pom.xml @@ -298,23 +298,24 @@ - - - - ossrh - OSSRH Staging API Releases - https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2/ - - - - ossrh - Central Portal Snapshots - https://central.sonatype.com/repository/maven-snapshots/ - - + deploy-maven + + + + ossrh + OSSRH Staging API Releases + https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2/ + + + + ossrh + Central Portal Snapshots + https://central.sonatype.com/repository/maven-snapshots/ + + From 821fcf8167a3d70c09fa337bd310107556c230da Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Mon, 4 Aug 2025 16:21:39 +0200 Subject: [PATCH 32/49] Prepare release 5.6.0 --- commons-datastore/commons-datastore-core/pom.xml | 2 +- commons-datastore/commons-datastore-mongodb/pom.xml | 2 +- commons-datastore/commons-datastore-solr/pom.xml | 2 +- commons-datastore/pom.xml | 2 +- commons-lib/pom.xml | 2 +- pom.xml | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/commons-datastore/commons-datastore-core/pom.xml b/commons-datastore/commons-datastore-core/pom.xml index a7688a915..abf75a057 100644 --- a/commons-datastore/commons-datastore-core/pom.xml +++ b/commons-datastore/commons-datastore-core/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons-datastore - 5.6.0-SNAPSHOT + 5.6.0 ../pom.xml diff --git a/commons-datastore/commons-datastore-mongodb/pom.xml b/commons-datastore/commons-datastore-mongodb/pom.xml index ea8d77c6e..082394e1e 100644 --- a/commons-datastore/commons-datastore-mongodb/pom.xml +++ b/commons-datastore/commons-datastore-mongodb/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons-datastore - 5.6.0-SNAPSHOT + 5.6.0 ../pom.xml diff --git a/commons-datastore/commons-datastore-solr/pom.xml b/commons-datastore/commons-datastore-solr/pom.xml index 10d9baeaa..d2a790bc3 100644 --- a/commons-datastore/commons-datastore-solr/pom.xml +++ b/commons-datastore/commons-datastore-solr/pom.xml @@ -22,7 +22,7 @@ org.opencb.commons commons-datastore - 5.6.0-SNAPSHOT + 5.6.0 ../pom.xml diff --git a/commons-datastore/pom.xml b/commons-datastore/pom.xml index 0ad238d50..777903eea 100644 --- a/commons-datastore/pom.xml +++ b/commons-datastore/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons - 5.6.0-SNAPSHOT + 5.6.0 ../pom.xml diff --git a/commons-lib/pom.xml b/commons-lib/pom.xml index b83808599..fe6f33d92 100644 --- a/commons-lib/pom.xml +++ b/commons-lib/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons - 5.6.0-SNAPSHOT + 5.6.0 ../pom.xml diff --git a/pom.xml b/pom.xml index f18537055..45f89a36d 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons - 5.6.0-SNAPSHOT + 5.6.0 pom OpenCB commons project From ecef6b6b42b1617a77ff481378b411c755dba1ad Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Mon, 4 Aug 2025 16:21:58 +0200 Subject: [PATCH 33/49] Prepare next release 5.7.0-SNAPSHOT --- commons-datastore/commons-datastore-core/pom.xml | 2 +- commons-datastore/commons-datastore-mongodb/pom.xml | 2 +- commons-datastore/commons-datastore-solr/pom.xml | 2 +- commons-datastore/pom.xml | 2 +- commons-lib/pom.xml | 2 +- pom.xml | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/commons-datastore/commons-datastore-core/pom.xml b/commons-datastore/commons-datastore-core/pom.xml index abf75a057..72a55dd74 100644 --- a/commons-datastore/commons-datastore-core/pom.xml +++ b/commons-datastore/commons-datastore-core/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons-datastore - 5.6.0 + 5.7.0-SNAPSHOT ../pom.xml diff --git a/commons-datastore/commons-datastore-mongodb/pom.xml b/commons-datastore/commons-datastore-mongodb/pom.xml index 082394e1e..656fcca4d 100644 --- a/commons-datastore/commons-datastore-mongodb/pom.xml +++ b/commons-datastore/commons-datastore-mongodb/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons-datastore - 5.6.0 + 5.7.0-SNAPSHOT ../pom.xml diff --git a/commons-datastore/commons-datastore-solr/pom.xml b/commons-datastore/commons-datastore-solr/pom.xml index d2a790bc3..81a443632 100644 --- a/commons-datastore/commons-datastore-solr/pom.xml +++ b/commons-datastore/commons-datastore-solr/pom.xml @@ -22,7 +22,7 @@ org.opencb.commons commons-datastore - 5.6.0 + 5.7.0-SNAPSHOT ../pom.xml diff --git a/commons-datastore/pom.xml b/commons-datastore/pom.xml index 777903eea..fdea9ca47 100644 --- a/commons-datastore/pom.xml +++ b/commons-datastore/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons - 5.6.0 + 5.7.0-SNAPSHOT ../pom.xml diff --git a/commons-lib/pom.xml b/commons-lib/pom.xml index fe6f33d92..ba5ab94f4 100644 --- a/commons-lib/pom.xml +++ b/commons-lib/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons - 5.6.0 + 5.7.0-SNAPSHOT ../pom.xml diff --git a/pom.xml b/pom.xml index 45f89a36d..bad7d5965 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons - 5.6.0 + 5.7.0-SNAPSHOT pom OpenCB commons project From 6cdfa9c5ffb8e2f4da84c0db89eed29468231b59 Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Mon, 4 Aug 2025 16:37:23 +0200 Subject: [PATCH 34/49] cicd: FIX mvn repository profile #TASK-7783 --- .../commons-datastore-core/pom.xml | 2 +- .../commons-datastore-mongodb/pom.xml | 2 +- .../commons-datastore-solr/pom.xml | 2 +- commons-datastore/pom.xml | 2 +- commons-lib/pom.xml | 2 +- pom.xml | 68 ++++++++++++++++++- 6 files changed, 70 insertions(+), 8 deletions(-) diff --git a/commons-datastore/commons-datastore-core/pom.xml b/commons-datastore/commons-datastore-core/pom.xml index 72a55dd74..a7688a915 100644 --- a/commons-datastore/commons-datastore-core/pom.xml +++ b/commons-datastore/commons-datastore-core/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons-datastore - 5.7.0-SNAPSHOT + 5.6.0-SNAPSHOT ../pom.xml diff --git a/commons-datastore/commons-datastore-mongodb/pom.xml b/commons-datastore/commons-datastore-mongodb/pom.xml index 656fcca4d..ea8d77c6e 100644 --- a/commons-datastore/commons-datastore-mongodb/pom.xml +++ b/commons-datastore/commons-datastore-mongodb/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons-datastore - 5.7.0-SNAPSHOT + 5.6.0-SNAPSHOT ../pom.xml diff --git a/commons-datastore/commons-datastore-solr/pom.xml b/commons-datastore/commons-datastore-solr/pom.xml index 81a443632..10d9baeaa 100644 --- a/commons-datastore/commons-datastore-solr/pom.xml +++ b/commons-datastore/commons-datastore-solr/pom.xml @@ -22,7 +22,7 @@ org.opencb.commons commons-datastore - 5.7.0-SNAPSHOT + 5.6.0-SNAPSHOT ../pom.xml diff --git a/commons-datastore/pom.xml b/commons-datastore/pom.xml index fdea9ca47..0ad238d50 100644 --- a/commons-datastore/pom.xml +++ b/commons-datastore/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons - 5.7.0-SNAPSHOT + 5.6.0-SNAPSHOT ../pom.xml diff --git a/commons-lib/pom.xml b/commons-lib/pom.xml index ba5ab94f4..b83808599 100644 --- a/commons-lib/pom.xml +++ b/commons-lib/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons - 5.7.0-SNAPSHOT + 5.6.0-SNAPSHOT ../pom.xml diff --git a/pom.xml b/pom.xml index bad7d5965..e746181d4 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons - 5.7.0-SNAPSHOT + 5.6.0-SNAPSHOT pom OpenCB commons project @@ -303,13 +303,14 @@ deploy-maven - + ossrh OSSRH Staging API Releases https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2/ - + + ossrh Central Portal Snapshots @@ -318,18 +319,79 @@ + org.sonatype.central central-publishing-maven-plugin 0.8.0 + true + ossrh + true + published + true + + + org.apache.maven.plugins + maven-source-plugin + 3.2.1 + + + attach-sources + + + jar-no-fork + + + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 3.3.2 + + + attach-javadocs + + + jar + + + + + + + + org.apache.maven.plugins + maven-gpg-plugin + 1.6 + + + sign-artifacts + + verify + + sign + + + + + --pinentry-mode + loopback + + + + + From b46c060e801055eeba3461de6a6e85db8049f6c1 Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Mon, 4 Aug 2025 16:45:01 +0200 Subject: [PATCH 35/49] cicd: FIX maven-javadoc-plugin #TASK-7783 --- pom.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pom.xml b/pom.xml index e746181d4..9fd1b8651 100644 --- a/pom.xml +++ b/pom.xml @@ -367,6 +367,12 @@ + + + none + + false + From ac6d240384fb9a1465fc0139bd3f94af49e36833 Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Mon, 4 Aug 2025 16:50:17 +0200 Subject: [PATCH 36/49] Prepare release 5.6.0 --- commons-datastore/commons-datastore-core/pom.xml | 2 +- commons-datastore/commons-datastore-mongodb/pom.xml | 2 +- commons-datastore/commons-datastore-solr/pom.xml | 2 +- commons-datastore/pom.xml | 2 +- commons-lib/pom.xml | 2 +- pom.xml | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/commons-datastore/commons-datastore-core/pom.xml b/commons-datastore/commons-datastore-core/pom.xml index a7688a915..abf75a057 100644 --- a/commons-datastore/commons-datastore-core/pom.xml +++ b/commons-datastore/commons-datastore-core/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons-datastore - 5.6.0-SNAPSHOT + 5.6.0 ../pom.xml diff --git a/commons-datastore/commons-datastore-mongodb/pom.xml b/commons-datastore/commons-datastore-mongodb/pom.xml index ea8d77c6e..082394e1e 100644 --- a/commons-datastore/commons-datastore-mongodb/pom.xml +++ b/commons-datastore/commons-datastore-mongodb/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons-datastore - 5.6.0-SNAPSHOT + 5.6.0 ../pom.xml diff --git a/commons-datastore/commons-datastore-solr/pom.xml b/commons-datastore/commons-datastore-solr/pom.xml index 10d9baeaa..d2a790bc3 100644 --- a/commons-datastore/commons-datastore-solr/pom.xml +++ b/commons-datastore/commons-datastore-solr/pom.xml @@ -22,7 +22,7 @@ org.opencb.commons commons-datastore - 5.6.0-SNAPSHOT + 5.6.0 ../pom.xml diff --git a/commons-datastore/pom.xml b/commons-datastore/pom.xml index 0ad238d50..777903eea 100644 --- a/commons-datastore/pom.xml +++ b/commons-datastore/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons - 5.6.0-SNAPSHOT + 5.6.0 ../pom.xml diff --git a/commons-lib/pom.xml b/commons-lib/pom.xml index b83808599..fe6f33d92 100644 --- a/commons-lib/pom.xml +++ b/commons-lib/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons - 5.6.0-SNAPSHOT + 5.6.0 ../pom.xml diff --git a/pom.xml b/pom.xml index 9fd1b8651..a300c6bc4 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons - 5.6.0-SNAPSHOT + 5.6.0 pom OpenCB commons project From 8e4cb8925d67a6c2b0cf641537408e3440988546 Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Mon, 4 Aug 2025 16:50:41 +0200 Subject: [PATCH 37/49] Prepare next release 5.7.0-SNAPSHOT --- commons-datastore/commons-datastore-core/pom.xml | 2 +- commons-datastore/commons-datastore-mongodb/pom.xml | 2 +- commons-datastore/commons-datastore-solr/pom.xml | 2 +- commons-datastore/pom.xml | 2 +- commons-lib/pom.xml | 2 +- pom.xml | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/commons-datastore/commons-datastore-core/pom.xml b/commons-datastore/commons-datastore-core/pom.xml index abf75a057..72a55dd74 100644 --- a/commons-datastore/commons-datastore-core/pom.xml +++ b/commons-datastore/commons-datastore-core/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons-datastore - 5.6.0 + 5.7.0-SNAPSHOT ../pom.xml diff --git a/commons-datastore/commons-datastore-mongodb/pom.xml b/commons-datastore/commons-datastore-mongodb/pom.xml index 082394e1e..656fcca4d 100644 --- a/commons-datastore/commons-datastore-mongodb/pom.xml +++ b/commons-datastore/commons-datastore-mongodb/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons-datastore - 5.6.0 + 5.7.0-SNAPSHOT ../pom.xml diff --git a/commons-datastore/commons-datastore-solr/pom.xml b/commons-datastore/commons-datastore-solr/pom.xml index d2a790bc3..81a443632 100644 --- a/commons-datastore/commons-datastore-solr/pom.xml +++ b/commons-datastore/commons-datastore-solr/pom.xml @@ -22,7 +22,7 @@ org.opencb.commons commons-datastore - 5.6.0 + 5.7.0-SNAPSHOT ../pom.xml diff --git a/commons-datastore/pom.xml b/commons-datastore/pom.xml index 777903eea..fdea9ca47 100644 --- a/commons-datastore/pom.xml +++ b/commons-datastore/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons - 5.6.0 + 5.7.0-SNAPSHOT ../pom.xml diff --git a/commons-lib/pom.xml b/commons-lib/pom.xml index fe6f33d92..ba5ab94f4 100644 --- a/commons-lib/pom.xml +++ b/commons-lib/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons - 5.6.0 + 5.7.0-SNAPSHOT ../pom.xml diff --git a/pom.xml b/pom.xml index a300c6bc4..c64f9aa46 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons - 5.6.0 + 5.7.0-SNAPSHOT pom OpenCB commons project From cffe317b869f1a1076d7f80ff83b27de423cc2b7 Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Mon, 4 Aug 2025 17:25:53 +0200 Subject: [PATCH 38/49] cicd: FIX Project name is missing #TASK-7783 --- commons-datastore/commons-datastore-core/pom.xml | 6 +++++- commons-datastore/commons-datastore-mongodb/pom.xml | 6 +++++- commons-datastore/commons-datastore-solr/pom.xml | 7 ++++++- commons-datastore/pom.xml | 7 ++++++- commons-lib/pom.xml | 6 +++++- pom.xml | 2 +- 6 files changed, 28 insertions(+), 6 deletions(-) diff --git a/commons-datastore/commons-datastore-core/pom.xml b/commons-datastore/commons-datastore-core/pom.xml index 72a55dd74..b86033a3e 100644 --- a/commons-datastore/commons-datastore-core/pom.xml +++ b/commons-datastore/commons-datastore-core/pom.xml @@ -6,13 +6,17 @@ org.opencb.commons commons-datastore - 5.7.0-SNAPSHOT + 5.6.0-SNAPSHOT ../pom.xml commons-datastore-core jar + OpenCB commons-datastore-core project + OpenCB commons project contains several Java libs for Bioinformatics + http://www.opencb.org + com.fasterxml.jackson.core diff --git a/commons-datastore/commons-datastore-mongodb/pom.xml b/commons-datastore/commons-datastore-mongodb/pom.xml index 656fcca4d..b4a58b2fc 100644 --- a/commons-datastore/commons-datastore-mongodb/pom.xml +++ b/commons-datastore/commons-datastore-mongodb/pom.xml @@ -6,13 +6,17 @@ org.opencb.commons commons-datastore - 5.7.0-SNAPSHOT + 5.6.0-SNAPSHOT ../pom.xml commons-datastore-mongodb jar + OpenCB commons-datastore-mongodb project + OpenCB commons project contains several Java libs for Bioinformatics + http://www.opencb.org + org.opencb.commons diff --git a/commons-datastore/commons-datastore-solr/pom.xml b/commons-datastore/commons-datastore-solr/pom.xml index 81a443632..4ea0b035c 100644 --- a/commons-datastore/commons-datastore-solr/pom.xml +++ b/commons-datastore/commons-datastore-solr/pom.xml @@ -22,13 +22,18 @@ org.opencb.commons commons-datastore - 5.7.0-SNAPSHOT + 5.6.0-SNAPSHOT ../pom.xml commons-datastore-solr jar + OpenCB commons-datastore-solr project + OpenCB commons project contains several Java libs for Bioinformatics + http://www.opencb.org + + org.opencb.commons diff --git a/commons-datastore/pom.xml b/commons-datastore/pom.xml index fdea9ca47..0bbf01861 100644 --- a/commons-datastore/pom.xml +++ b/commons-datastore/pom.xml @@ -6,13 +6,18 @@ org.opencb.commons commons - 5.7.0-SNAPSHOT + 5.6.0-SNAPSHOT ../pom.xml commons-datastore pom + OpenCB commons-datastore project + OpenCB commons project contains several Java libs for Bioinformatics + http://www.opencb.org + + commons-datastore-core commons-datastore-mongodb diff --git a/commons-lib/pom.xml b/commons-lib/pom.xml index ba5ab94f4..71bde92e4 100644 --- a/commons-lib/pom.xml +++ b/commons-lib/pom.xml @@ -6,13 +6,17 @@ org.opencb.commons commons - 5.7.0-SNAPSHOT + 5.6.0-SNAPSHOT ../pom.xml commons-lib jar + OpenCB commons-lib project + OpenCB commons project contains several Java libs for Bioinformatics + http://www.opencb.org + org.opencb.commons diff --git a/pom.xml b/pom.xml index c64f9aa46..9fd1b8651 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons - 5.7.0-SNAPSHOT + 5.6.0-SNAPSHOT pom OpenCB commons project From 19a11f4c01679b6a046eff8e560fb0eceafa7577 Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Mon, 4 Aug 2025 18:27:15 +0200 Subject: [PATCH 39/49] Prepare release 5.6.0 --- commons-datastore/commons-datastore-core/pom.xml | 2 +- commons-datastore/commons-datastore-mongodb/pom.xml | 2 +- commons-datastore/commons-datastore-solr/pom.xml | 2 +- commons-datastore/pom.xml | 2 +- commons-lib/pom.xml | 2 +- pom.xml | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/commons-datastore/commons-datastore-core/pom.xml b/commons-datastore/commons-datastore-core/pom.xml index b86033a3e..9263ef78a 100644 --- a/commons-datastore/commons-datastore-core/pom.xml +++ b/commons-datastore/commons-datastore-core/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons-datastore - 5.6.0-SNAPSHOT + 5.6.0 ../pom.xml diff --git a/commons-datastore/commons-datastore-mongodb/pom.xml b/commons-datastore/commons-datastore-mongodb/pom.xml index b4a58b2fc..915b40701 100644 --- a/commons-datastore/commons-datastore-mongodb/pom.xml +++ b/commons-datastore/commons-datastore-mongodb/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons-datastore - 5.6.0-SNAPSHOT + 5.6.0 ../pom.xml diff --git a/commons-datastore/commons-datastore-solr/pom.xml b/commons-datastore/commons-datastore-solr/pom.xml index 4ea0b035c..90051460a 100644 --- a/commons-datastore/commons-datastore-solr/pom.xml +++ b/commons-datastore/commons-datastore-solr/pom.xml @@ -22,7 +22,7 @@ org.opencb.commons commons-datastore - 5.6.0-SNAPSHOT + 5.6.0 ../pom.xml diff --git a/commons-datastore/pom.xml b/commons-datastore/pom.xml index 0bbf01861..c9e636a49 100644 --- a/commons-datastore/pom.xml +++ b/commons-datastore/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons - 5.6.0-SNAPSHOT + 5.6.0 ../pom.xml diff --git a/commons-lib/pom.xml b/commons-lib/pom.xml index 71bde92e4..c62a2bf08 100644 --- a/commons-lib/pom.xml +++ b/commons-lib/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons - 5.6.0-SNAPSHOT + 5.6.0 ../pom.xml diff --git a/pom.xml b/pom.xml index 9fd1b8651..a300c6bc4 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons - 5.6.0-SNAPSHOT + 5.6.0 pom OpenCB commons project From 92e40dfdbc98471a34c19c6d0dcaf9f72d4155a5 Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Mon, 11 Aug 2025 11:25:04 +0200 Subject: [PATCH 40/49] Preparing port patch from version 5.6.0 to 6.1.0-SNAPSHOT --- commons-datastore/commons-datastore-core/pom.xml | 2 +- commons-datastore/commons-datastore-mongodb/pom.xml | 2 +- commons-datastore/commons-datastore-solr/pom.xml | 2 +- commons-datastore/pom.xml | 2 +- commons-lib/pom.xml | 2 +- pom.xml | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/commons-datastore/commons-datastore-core/pom.xml b/commons-datastore/commons-datastore-core/pom.xml index 9263ef78a..0d0eaa905 100644 --- a/commons-datastore/commons-datastore-core/pom.xml +++ b/commons-datastore/commons-datastore-core/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons-datastore - 5.6.0 + 6.1.0-SNAPSHOT ../pom.xml diff --git a/commons-datastore/commons-datastore-mongodb/pom.xml b/commons-datastore/commons-datastore-mongodb/pom.xml index 915b40701..bef095735 100644 --- a/commons-datastore/commons-datastore-mongodb/pom.xml +++ b/commons-datastore/commons-datastore-mongodb/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons-datastore - 5.6.0 + 6.1.0-SNAPSHOT ../pom.xml diff --git a/commons-datastore/commons-datastore-solr/pom.xml b/commons-datastore/commons-datastore-solr/pom.xml index 90051460a..a64a905ac 100644 --- a/commons-datastore/commons-datastore-solr/pom.xml +++ b/commons-datastore/commons-datastore-solr/pom.xml @@ -22,7 +22,7 @@ org.opencb.commons commons-datastore - 5.6.0 + 6.1.0-SNAPSHOT ../pom.xml diff --git a/commons-datastore/pom.xml b/commons-datastore/pom.xml index c9e636a49..a85aed2b9 100644 --- a/commons-datastore/pom.xml +++ b/commons-datastore/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons - 5.6.0 + 6.1.0-SNAPSHOT ../pom.xml diff --git a/commons-lib/pom.xml b/commons-lib/pom.xml index c62a2bf08..48de972fd 100644 --- a/commons-lib/pom.xml +++ b/commons-lib/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons - 5.6.0 + 6.1.0-SNAPSHOT ../pom.xml diff --git a/pom.xml b/pom.xml index a300c6bc4..8bc872cb4 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons - 5.6.0 + 6.1.0-SNAPSHOT pom OpenCB commons project From 77f281267ca0b0a6fff5451f9e5ab52ce22b177b Mon Sep 17 00:00:00 2001 From: pfurio Date: Tue, 12 Aug 2025 13:06:06 +0200 Subject: [PATCH 41/49] datastore: add smart splitter that would consider quotes, #TASK-7881 --- .../commons/datastore/core/ObjectMap.java | 1 - .../commons/datastore/core/ObjectMapTest.java | 31 --------- .../datastore/mongodb/MongoDBQueryUtils.java | 58 ++++++++++++++++- .../datastore/mongodb/SmartSplitTest.java | 63 +++++++++++++++++++ 4 files changed, 118 insertions(+), 35 deletions(-) create mode 100644 commons-datastore/commons-datastore-mongodb/src/test/java/org/opencb/commons/datastore/mongodb/SmartSplitTest.java diff --git a/commons-datastore/commons-datastore-core/src/main/java/org/opencb/commons/datastore/core/ObjectMap.java b/commons-datastore/commons-datastore-core/src/main/java/org/opencb/commons/datastore/core/ObjectMap.java index 743b610f0..dd1beec33 100644 --- a/commons-datastore/commons-datastore-core/src/main/java/org/opencb/commons/datastore/core/ObjectMap.java +++ b/commons-datastore/commons-datastore-core/src/main/java/org/opencb/commons/datastore/core/ObjectMap.java @@ -38,7 +38,6 @@ public class ObjectMap implements Map, Serializable { private static final Pattern KEY_SPLIT_PATTERN = Pattern.compile("(^[^\\[\\].]+(?:\\[[^\\]]+\\])?)(?:\\.(.*))*"); private static final Pattern LIST_FILTER_PATTERN = Pattern.compile("([^\\[\\]]+)\\[([^=]*?)(?:[=]?)([^=]+)\\]$"); - public static final Pattern COMMA_SEPARATED_LIST_SPLIT_PATTERN = Pattern.compile("((?:(?!,\\S).)+)+"); public ObjectMap() { objectMap = new LinkedHashMap<>(); diff --git a/commons-datastore/commons-datastore-core/src/test/java/org/opencb/commons/datastore/core/ObjectMapTest.java b/commons-datastore/commons-datastore-core/src/test/java/org/opencb/commons/datastore/core/ObjectMapTest.java index 15f4e4e40..d0098015b 100644 --- a/commons-datastore/commons-datastore-core/src/test/java/org/opencb/commons/datastore/core/ObjectMapTest.java +++ b/commons-datastore/commons-datastore-core/src/test/java/org/opencb/commons/datastore/core/ObjectMapTest.java @@ -263,35 +263,4 @@ public void testGetWithFilterFromList() { assertEquals("CGHI", objectMap.get("nestedList[nested.value=G].nested.list[id=Cghi].name")); } - @Test - public void testPatternListSplit() { - List originalValues = Arrays.asList("disorder1", "disorder2, blabla", "disorder3"); - objectMap.put("key", StringUtils.join(originalValues, ",")); - objectMap.put("key1", ""); - objectMap.put("key2", "my value"); - objectMap.put("key3", Arrays.asList("1", "2")); - objectMap.put("key4", Arrays.asList(1, 2)); - - List values = objectMap.getAsStringList("key", ObjectMap.COMMA_SEPARATED_LIST_SPLIT_PATTERN); - assertEquals(originalValues.size(), values.size()); - assertTrue(originalValues.containsAll(values)); - - values = objectMap.getAsStringList("key1", ObjectMap.COMMA_SEPARATED_LIST_SPLIT_PATTERN); - assertEquals(1, values.size()); - assertEquals("", values.get(0)); - - values = objectMap.getAsStringList("key2", ObjectMap.COMMA_SEPARATED_LIST_SPLIT_PATTERN); - assertEquals(1, values.size()); - assertEquals("my value", values.get(0)); - - values = objectMap.getAsStringList("key3", ObjectMap.COMMA_SEPARATED_LIST_SPLIT_PATTERN); - assertEquals(2, values.size()); - assertEquals("1", values.get(0)); - assertEquals("2", values.get(1)); - - values = objectMap.getAsStringList("key4", ObjectMap.COMMA_SEPARATED_LIST_SPLIT_PATTERN); - assertEquals(2, values.size()); - assertEquals("1", values.get(0)); - assertEquals("2", values.get(1)); - } } diff --git a/commons-datastore/commons-datastore-mongodb/src/main/java/org/opencb/commons/datastore/mongodb/MongoDBQueryUtils.java b/commons-datastore/commons-datastore-mongodb/src/main/java/org/opencb/commons/datastore/mongodb/MongoDBQueryUtils.java index e80265d53..a57e79cf6 100644 --- a/commons-datastore/commons-datastore-mongodb/src/main/java/org/opencb/commons/datastore/mongodb/MongoDBQueryUtils.java +++ b/commons-datastore/commons-datastore-mongodb/src/main/java/org/opencb/commons/datastore/mongodb/MongoDBQueryUtils.java @@ -36,9 +36,9 @@ import static com.mongodb.client.model.Aggregates.*; import static com.mongodb.client.model.Projections.*; +import static org.opencb.commons.datastore.mongodb.MongoDBQueryUtils.Accumulator.*; import static org.opencb.commons.datastore.mongodb.MongoDBQueryUtils.Accumulator.bucket; import static org.opencb.commons.datastore.mongodb.MongoDBQueryUtils.Accumulator.count; -import static org.opencb.commons.datastore.mongodb.MongoDBQueryUtils.Accumulator.*; /** * Created by imedina on 17/01/16. @@ -178,6 +178,53 @@ public static Bson createFilter(String mongoDbField, String queryParam, Query qu return filter; } + /** + * Splits a string by the given separator, handling quoted values properly. + * Quoted values can contain the separator character without being split. + * Removes surrounding quotes and trims whitespace from each value. + * + * @param input the input string to split + * @param separator the separator to split by ("," or ";") + * @return list of trimmed, unquoted values + */ + public static List smartSplit(String input, String separator) { + List result = new ArrayList<>(); + if (input == null || input.isEmpty()) { + return result; + } + + boolean inQuotes = false; + StringBuilder currentValue = new StringBuilder(); + + for (int i = 0; i < input.length(); i++) { + char c = input.charAt(i); + + if (c == '"') { + inQuotes = !inQuotes; + } else if (!inQuotes && input.substring(i).startsWith(separator)) { + // Found separator outside quotes + String value = currentValue.toString().trim(); + if (value.startsWith("\"") && value.endsWith("\"") && value.length() > 1) { + value = value.substring(1, value.length() - 1); + } + result.add(value.trim()); + currentValue = new StringBuilder(); + i += separator.length() - 1; // Skip the separator + } else { + currentValue.append(c); + } + } + + // Add the last value + String value = currentValue.toString().trim(); + if (value.startsWith("\"") && value.endsWith("\"") && value.length() > 1) { + value = value.substring(1, value.length() - 1); + } + result.add(value.trim()); + + return result; + } + private static String getLogicalSeparator(LogicalOperator operator) { return (operator != null && operator.equals(LogicalOperator.AND)) ? AND : OR; } @@ -258,8 +305,13 @@ protected static String getOp2(String op, String value) { public static Bson createAutoFilter(String mongoDbField, String queryParam, Query query, QueryParam.Type type, LogicalOperator operator) throws NumberFormatException { - - List queryParamList = query.getAsStringList(queryParam, getLogicalSeparator(operator)); + List queryParamList; + String value = query.getString(queryParam); + if (StringUtils.isNotEmpty(value) && value.contains("\"")) { + queryParamList = smartSplit(value, getLogicalSeparator(operator)); + } else { + queryParamList = query.getAsStringList(queryParam, getLogicalSeparator(operator)); + } return createAutoFilter(mongoDbField, queryParam, type, operator, queryParamList); } diff --git a/commons-datastore/commons-datastore-mongodb/src/test/java/org/opencb/commons/datastore/mongodb/SmartSplitTest.java b/commons-datastore/commons-datastore-mongodb/src/test/java/org/opencb/commons/datastore/mongodb/SmartSplitTest.java new file mode 100644 index 000000000..59a5b2c2b --- /dev/null +++ b/commons-datastore/commons-datastore-mongodb/src/test/java/org/opencb/commons/datastore/mongodb/SmartSplitTest.java @@ -0,0 +1,63 @@ +package org.opencb.commons.datastore.mongodb; + +import org.junit.Test; +import java.util.List; +import static org.junit.Assert.assertEquals; + +public class SmartSplitTest { + + @Test + public void testSmartSplitWithQuotedCommaValues() { + String input = "\"a \",\" b\",\" c \""; + List result = MongoDBQueryUtils.smartSplit(input, ","); + + assertEquals(3, result.size()); + assertEquals("a", result.get(0)); + assertEquals("b", result.get(1)); + assertEquals("c", result.get(2)); + } + + @Test + public void testSmartSplitWithQuotedSemicolonValues() { + String input = "\"a \";\" b\";\" c \""; + List result = MongoDBQueryUtils.smartSplit(input, ";"); + + assertEquals(3, result.size()); + assertEquals("a", result.get(0)); + assertEquals("b", result.get(1)); + assertEquals("c", result.get(2)); + } + + @Test + public void testSmartSplitWithNonQuotedValues() { + String input = "a,b,c"; + List result = MongoDBQueryUtils.smartSplit(input, ","); + + assertEquals(3, result.size()); + assertEquals("a", result.get(0)); + assertEquals("b", result.get(1)); + assertEquals("c", result.get(2)); + } + + @Test + public void testSmartSplitWithNonQuotedValuesAndSpaces() { + String input = "a, b,c "; + List result = MongoDBQueryUtils.smartSplit(input, ","); + + assertEquals(3, result.size()); + assertEquals("a", result.get(0)); + assertEquals("b", result.get(1)); + assertEquals("c", result.get(2)); + } + + @Test + public void testSmartSplitWithMixedValues() { + String input = "\"a, with comma\",b,\"c\""; + List result = MongoDBQueryUtils.smartSplit(input, ","); + + assertEquals(3, result.size()); + assertEquals("a, with comma", result.get(0)); + assertEquals("b", result.get(1)); + assertEquals("c", result.get(2)); + } +} From 19e2c2383152638a5570eb4e46077a1a71c4d390 Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Thu, 14 Aug 2025 10:30:06 +0200 Subject: [PATCH 42/49] Delete cellbase references in Xetabase test #TASK-7884 --- .github/workflows/test-xetabase-workflow.yml | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/.github/workflows/test-xetabase-workflow.yml b/.github/workflows/test-xetabase-workflow.yml index 0b060f583..cf3ff2168 100644 --- a/.github/workflows/test-xetabase-workflow.yml +++ b/.github/workflows/test-xetabase-workflow.yml @@ -70,24 +70,11 @@ jobs: distribution: 'temurin' java-version: '8' cache: 'maven' - - name: Install Samtools - run: sudo apt-get install samtools python3-deeptools - name: Start MongoDB v6.0 uses: supercharge/mongodb-github-action@1.8.0 with: mongodb-version: 6.0 mongodb-replica-set: rs-test - - name: K8s Tunnel MongoDB - run: | - wget https://dl.k8s.io/release/v1.28.2/bin/linux/amd64/kubectl - chmod +x ./kubectl - echo "${{ secrets.AZURE_KUBE_CONFIG }}" > admin.conf - ./kubectl -n cellbase-db port-forward services/cellbase-rs0-svc 27018:27017 --kubeconfig ./admin.conf & - - name: DockerHub login - uses: docker/login-action@v3 - with: - username: ${{ env.DOCKER_HUB_USER }} - password: ${{ env.DOCKER_HUB_PASSWORD }} - name: Install sshpass run: sudo apt-get install sshpass - name: Add SSH Host to known_hosts @@ -97,11 +84,11 @@ jobs: env: SSH_HOST: ${{ env.SSH_HOST }} SSH_PORT: ${{ env.SSH_PORT }} - - name: Run all OpenCB Junit tests, ie. java-common-libs, biodata, cellbase, opencga and opencga-enterprise + - name: Run all OpenCB Junit tests, ie. java-common-libs, biodata, opencga and opencga-enterprise run: | cd opencga-enterprise ln -s ../opencga opencga-home - ./build.sh -t -l runShortTests -b -s -T ${{ inputs.task }} -c localhost:27018 -H hdp3.1 + ./build.sh -t -l runShortTests -b -s -T ${{ inputs.task }} - name: Upload reports results to Github uses: actions/upload-artifact@v4 with: From 4b1e90a60dfd3093cabd5ac1ca3eab8e1d8ca5f0 Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Thu, 14 Aug 2025 10:30:06 +0200 Subject: [PATCH 43/49] Delete cellbase references in Xetabase test #TASK-7883 --- .github/workflows/test-xetabase-workflow.yml | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/.github/workflows/test-xetabase-workflow.yml b/.github/workflows/test-xetabase-workflow.yml index 0b060f583..cf3ff2168 100644 --- a/.github/workflows/test-xetabase-workflow.yml +++ b/.github/workflows/test-xetabase-workflow.yml @@ -70,24 +70,11 @@ jobs: distribution: 'temurin' java-version: '8' cache: 'maven' - - name: Install Samtools - run: sudo apt-get install samtools python3-deeptools - name: Start MongoDB v6.0 uses: supercharge/mongodb-github-action@1.8.0 with: mongodb-version: 6.0 mongodb-replica-set: rs-test - - name: K8s Tunnel MongoDB - run: | - wget https://dl.k8s.io/release/v1.28.2/bin/linux/amd64/kubectl - chmod +x ./kubectl - echo "${{ secrets.AZURE_KUBE_CONFIG }}" > admin.conf - ./kubectl -n cellbase-db port-forward services/cellbase-rs0-svc 27018:27017 --kubeconfig ./admin.conf & - - name: DockerHub login - uses: docker/login-action@v3 - with: - username: ${{ env.DOCKER_HUB_USER }} - password: ${{ env.DOCKER_HUB_PASSWORD }} - name: Install sshpass run: sudo apt-get install sshpass - name: Add SSH Host to known_hosts @@ -97,11 +84,11 @@ jobs: env: SSH_HOST: ${{ env.SSH_HOST }} SSH_PORT: ${{ env.SSH_PORT }} - - name: Run all OpenCB Junit tests, ie. java-common-libs, biodata, cellbase, opencga and opencga-enterprise + - name: Run all OpenCB Junit tests, ie. java-common-libs, biodata, opencga and opencga-enterprise run: | cd opencga-enterprise ln -s ../opencga opencga-home - ./build.sh -t -l runShortTests -b -s -T ${{ inputs.task }} -c localhost:27018 -H hdp3.1 + ./build.sh -t -l runShortTests -b -s -T ${{ inputs.task }} - name: Upload reports results to Github uses: actions/upload-artifact@v4 with: From 024ed22c66a6138dabb12c8d3562ae952ff2f2da Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Thu, 14 Aug 2025 13:14:04 +0200 Subject: [PATCH 44/49] Update test reference to use the current branch workflow #TASK-7883 --- .github/workflows/pull-request-approved.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pull-request-approved.yml b/.github/workflows/pull-request-approved.yml index 0c489fd73..e61ad2072 100644 --- a/.github/workflows/pull-request-approved.yml +++ b/.github/workflows/pull-request-approved.yml @@ -35,7 +35,7 @@ jobs: test: name: "Run all tests before merging" needs: calculate-xetabase-branch - uses: opencb/java-common-libs/.github/workflows/test-xetabase-workflow.yml@develop + uses: ./.github/workflows/test-xetabase-workflow.yml@develop with: branch: ${{ needs.calculate-xetabase-branch.outputs.xetabase_branch }} task: ${{ github.event.pull_request.head.ref }} From 4a2a035df64fd4bc92e3a4845551fa29c1210896 Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Thu, 14 Aug 2025 13:20:18 +0200 Subject: [PATCH 45/49] Update test reference to use the current branch workflow #TASK-7883 --- .github/workflows/pull-request-approved.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pull-request-approved.yml b/.github/workflows/pull-request-approved.yml index e61ad2072..7e34cf39c 100644 --- a/.github/workflows/pull-request-approved.yml +++ b/.github/workflows/pull-request-approved.yml @@ -35,7 +35,7 @@ jobs: test: name: "Run all tests before merging" needs: calculate-xetabase-branch - uses: ./.github/workflows/test-xetabase-workflow.yml@develop + uses: ./.github/workflows/test-xetabase-workflow.yml with: branch: ${{ needs.calculate-xetabase-branch.outputs.xetabase_branch }} task: ${{ github.event.pull_request.head.ref }} From 8f7668316922ea1b4295c165a084967d3437b77c Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Thu, 14 Aug 2025 13:32:20 +0200 Subject: [PATCH 46/49] Add sam tolls because it is necessary for test #TASK-7883 --- .github/workflows/test-analysis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test-analysis.yml b/.github/workflows/test-analysis.yml index 487cbb350..eadc89ad5 100644 --- a/.github/workflows/test-analysis.yml +++ b/.github/workflows/test-analysis.yml @@ -20,6 +20,8 @@ jobs: distribution: 'temurin' java-version: '11' cache: 'maven' + - name: Install Samtools + run: sudo apt-get install samtools python3-deeptools - name: Start MongoDB v6.0 uses: supercharge/mongodb-github-action@1.8.0 with: From 5b05d3663c071381049303fe6c664860ff78caa3 Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Thu, 14 Aug 2025 14:14:37 +0200 Subject: [PATCH 47/49] Add sam tolls because it is necessary for test #TASK-7883 --- .github/workflows/test-analysis.yml | 4 +--- .github/workflows/test-xetabase-workflow.yml | 2 ++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test-analysis.yml b/.github/workflows/test-analysis.yml index eadc89ad5..3af763725 100644 --- a/.github/workflows/test-analysis.yml +++ b/.github/workflows/test-analysis.yml @@ -20,8 +20,6 @@ jobs: distribution: 'temurin' java-version: '11' cache: 'maven' - - name: Install Samtools - run: sudo apt-get install samtools python3-deeptools - name: Start MongoDB v6.0 uses: supercharge/mongodb-github-action@1.8.0 with: @@ -41,4 +39,4 @@ jobs: check_name: "Surefire tests report" report_paths: './**/surefire-reports/TEST-*.xml' commit: '${{ github.sha }}' - fail_on_test_failures: true + fail_on_test_failures: true \ No newline at end of file diff --git a/.github/workflows/test-xetabase-workflow.yml b/.github/workflows/test-xetabase-workflow.yml index cf3ff2168..3720d93cf 100644 --- a/.github/workflows/test-xetabase-workflow.yml +++ b/.github/workflows/test-xetabase-workflow.yml @@ -70,6 +70,8 @@ jobs: distribution: 'temurin' java-version: '8' cache: 'maven' + - name: Install Samtools + run: sudo apt-get install samtools python3-deeptools - name: Start MongoDB v6.0 uses: supercharge/mongodb-github-action@1.8.0 with: From f6992e96181b05491acf473a01cf119dbc6f88e3 Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Fri, 5 Sep 2025 14:04:04 +0200 Subject: [PATCH 48/49] Prepare release 6.1.0 --- commons-datastore/commons-datastore-core/pom.xml | 2 +- commons-datastore/commons-datastore-mongodb/pom.xml | 2 +- commons-datastore/commons-datastore-solr/pom.xml | 2 +- commons-datastore/pom.xml | 2 +- commons-lib/pom.xml | 2 +- pom.xml | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/commons-datastore/commons-datastore-core/pom.xml b/commons-datastore/commons-datastore-core/pom.xml index 0d0eaa905..d794b609a 100644 --- a/commons-datastore/commons-datastore-core/pom.xml +++ b/commons-datastore/commons-datastore-core/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons-datastore - 6.1.0-SNAPSHOT + 6.1.0 ../pom.xml diff --git a/commons-datastore/commons-datastore-mongodb/pom.xml b/commons-datastore/commons-datastore-mongodb/pom.xml index bef095735..1b19e38fa 100644 --- a/commons-datastore/commons-datastore-mongodb/pom.xml +++ b/commons-datastore/commons-datastore-mongodb/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons-datastore - 6.1.0-SNAPSHOT + 6.1.0 ../pom.xml diff --git a/commons-datastore/commons-datastore-solr/pom.xml b/commons-datastore/commons-datastore-solr/pom.xml index 4b14c23af..960a07b15 100644 --- a/commons-datastore/commons-datastore-solr/pom.xml +++ b/commons-datastore/commons-datastore-solr/pom.xml @@ -22,7 +22,7 @@ org.opencb.commons commons-datastore - 6.1.0-SNAPSHOT + 6.1.0 ../pom.xml diff --git a/commons-datastore/pom.xml b/commons-datastore/pom.xml index a85aed2b9..93158c484 100644 --- a/commons-datastore/pom.xml +++ b/commons-datastore/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons - 6.1.0-SNAPSHOT + 6.1.0 ../pom.xml diff --git a/commons-lib/pom.xml b/commons-lib/pom.xml index 48de972fd..fb28f07fc 100644 --- a/commons-lib/pom.xml +++ b/commons-lib/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons - 6.1.0-SNAPSHOT + 6.1.0 ../pom.xml diff --git a/pom.xml b/pom.xml index b4562449f..b2df76146 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons - 6.1.0-SNAPSHOT + 6.1.0 pom OpenCB commons project From 06b35823949d4919cfe3230d38f1882891afd111 Mon Sep 17 00:00:00 2001 From: JuanfeSanahuja Date: Mon, 15 Sep 2025 13:30:59 +0200 Subject: [PATCH 49/49] Preparing port patch from version 6.1.0 to 7.0.0-SNAPSHOT --- commons-datastore/commons-datastore-core/pom.xml | 2 +- commons-datastore/commons-datastore-mongodb/pom.xml | 2 +- commons-datastore/commons-datastore-solr/pom.xml | 2 +- commons-datastore/pom.xml | 2 +- commons-lib/pom.xml | 2 +- pom.xml | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/commons-datastore/commons-datastore-core/pom.xml b/commons-datastore/commons-datastore-core/pom.xml index d794b609a..e297caa08 100644 --- a/commons-datastore/commons-datastore-core/pom.xml +++ b/commons-datastore/commons-datastore-core/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons-datastore - 6.1.0 + 7.0.0-SNAPSHOT ../pom.xml diff --git a/commons-datastore/commons-datastore-mongodb/pom.xml b/commons-datastore/commons-datastore-mongodb/pom.xml index 1b19e38fa..04e5b2189 100644 --- a/commons-datastore/commons-datastore-mongodb/pom.xml +++ b/commons-datastore/commons-datastore-mongodb/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons-datastore - 6.1.0 + 7.0.0-SNAPSHOT ../pom.xml diff --git a/commons-datastore/commons-datastore-solr/pom.xml b/commons-datastore/commons-datastore-solr/pom.xml index 960a07b15..d12b5a736 100644 --- a/commons-datastore/commons-datastore-solr/pom.xml +++ b/commons-datastore/commons-datastore-solr/pom.xml @@ -22,7 +22,7 @@ org.opencb.commons commons-datastore - 6.1.0 + 7.0.0-SNAPSHOT ../pom.xml diff --git a/commons-datastore/pom.xml b/commons-datastore/pom.xml index 93158c484..895662cfc 100644 --- a/commons-datastore/pom.xml +++ b/commons-datastore/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons - 6.1.0 + 7.0.0-SNAPSHOT ../pom.xml diff --git a/commons-lib/pom.xml b/commons-lib/pom.xml index fb28f07fc..d28d48754 100644 --- a/commons-lib/pom.xml +++ b/commons-lib/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons - 6.1.0 + 7.0.0-SNAPSHOT ../pom.xml diff --git a/pom.xml b/pom.xml index b2df76146..7f3c4b46c 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ org.opencb.commons commons - 6.1.0 + 7.0.0-SNAPSHOT pom OpenCB commons project