From fde688f07019fec3f219889346509f3162858ad5 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Thu, 1 Jul 2021 15:45:53 -0500 Subject: [PATCH 01/17] Switch from Travis CI to GitHub Actions --- {.travis => .github}/build.sh | 4 +-- .github/setup.sh | 3 +++ .github/workflows/build-main.yml | 42 ++++++++++++++++++++++++++++++++ .github/workflows/build-pr.yml | 35 ++++++++++++++++++++++++++ .travis.yml | 12 --------- README.md | 2 +- pom.xml | 6 ++--- 7 files changed, 86 insertions(+), 18 deletions(-) rename {.travis => .github}/build.sh (61%) create mode 100755 .github/setup.sh create mode 100644 .github/workflows/build-main.yml create mode 100644 .github/workflows/build-pr.yml delete mode 100644 .travis.yml diff --git a/.travis/build.sh b/.github/build.sh similarity index 61% rename from .travis/build.sh rename to .github/build.sh index e939b6c..7da4262 100755 --- a/.travis/build.sh +++ b/.github/build.sh @@ -1,3 +1,3 @@ #!/bin/sh -curl -fsLO https://raw.githubusercontent.com/scijava/scijava-scripts/master/travis-build.sh -sh travis-build.sh +curl -fsLO https://raw.githubusercontent.com/scijava/scijava-scripts/master/ci-build.sh +sh ci-build.sh diff --git a/.github/setup.sh b/.github/setup.sh new file mode 100755 index 0000000..f359bbe --- /dev/null +++ b/.github/setup.sh @@ -0,0 +1,3 @@ +#!/bin/sh +curl -fsLO https://raw.githubusercontent.com/scijava/scijava-scripts/master/ci-setup-github-actions.sh +sh ci-setup-github-actions.sh diff --git a/.github/workflows/build-main.yml b/.github/workflows/build-main.yml new file mode 100644 index 0000000..45b6b5e --- /dev/null +++ b/.github/workflows/build-main.yml @@ -0,0 +1,42 @@ +name: build + +on: + push: + branches: + - master + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Cache m2 folder + uses: actions/cache@v2 + env: + cache-name: cache-m2 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-build-${{ env.cache-name }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + + - name: Set up JDK 8 + uses: actions/setup-java@v2 + with: + java-version: '8' + distribution: 'zulu' + - name: Set up CI environment + run: .github/setup.sh + - name: Execute the build + run: .github/build.sh + env: + GPG_KEY_NAME: ${{ secrets.GPG_KEY_NAME }} + GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} + MAVEN_USER: ${{ secrets.MAVEN_USER }} + MAVEN_PASS: ${{ secrets.MAVEN_PASS }} + OSSRH_PASS: ${{ secrets.OSSRH_PASS }} + SIGNING_ASC: ${{ secrets.SIGNING_ASC }} diff --git a/.github/workflows/build-pr.yml b/.github/workflows/build-pr.yml new file mode 100644 index 0000000..92a0192 --- /dev/null +++ b/.github/workflows/build-pr.yml @@ -0,0 +1,35 @@ +name: build PR + +on: + pull_request: + branches: + - master + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Cache m2 folder + uses: actions/cache@v2 + env: + cache-name: cache-m2 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-build-${{ env.cache-name }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + + - name: Set up JDK 8 + uses: actions/setup-java@v2 + with: + java-version: '8' + distribution: 'zulu' + - name: Set up CI environment + run: .github/setup.sh + - name: Execute the build + run: .github/build.sh diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 8c3e3dd..0000000 --- a/.travis.yml +++ /dev/null @@ -1,12 +0,0 @@ -language: java -jdk: openjdk8 -branches: - only: - - master - - "/.*-[0-9]+\\..*/" -install: true -script: ".travis/build.sh" -env: - global: - - secure: mx1gt8i3B+jBlKcmOp4kDdWQID9ypKY2h7p0nwLcMbUh8BliMyyHqhT8i1O9UJ7KOWTDi56njVe/OpL/Yq4n8iI5Qc6U8JsUMko7IVEKl6s2DUBjZ0RlVuKcVBJCUZV/nd++brRt6KAOq+rIKo2JBGcih2t4xQ8pSk2Z567uuN8= - - secure: OvoesZlbqzxVHsPKkgjgbl9oaW7LLcdSkPjkjoCPi5NYn1Cm4dilAOOPV4qmwRInpsJY5YKecx8s++y36G09HW5M44MmIKFkGbyi7ug/lEYY2bfUWWow/Avgl8/EL4GN0nu4vLo0jwlFilYF/tFZxisTbRmMiVCIi2J7JY5v/Lw= diff --git a/README.md b/README.md index e66ba40..09650b7 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![](https://travis-ci.org/scijava/scripting-java.svg?branch=master)](https://travis-ci.org/scijava/scripting-java) +[![](https://github.com/scijava/scripting-java/actions/workflows/build-main.yml/badge.svg)](https://github.com/scijava/scripting-java/actions/workflows/build-main.yml) # Java Scripting diff --git a/pom.xml b/pom.xml index 5df6352..fa66a58 100644 --- a/pom.xml +++ b/pom.xml @@ -86,8 +86,8 @@ https://github.com/scijava/scripting-java/issues - Travis CI - https://travis-ci.org/scijava/scripting-java + GitHub Actions + https://github.com/scijava/scripting-java/actions @@ -98,7 +98,7 @@ Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck Institute of Molecular Cell Biology and Genetics. - deploy-to-scijava + sign,deploy-to-scijava From 9aa1f2b0419337475f62ae785f560876f6fc797f Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Fri, 2 Jul 2021 09:49:47 -0500 Subject: [PATCH 02/17] CI: build release tags --- .github/workflows/build-main.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build-main.yml b/.github/workflows/build-main.yml index 45b6b5e..3fb5622 100644 --- a/.github/workflows/build-main.yml +++ b/.github/workflows/build-main.yml @@ -4,6 +4,8 @@ on: push: branches: - master + tags: + - "*-[0-9]+.*" jobs: build: From 67489be2ffc7d7803bc0559ab573ccaac14fa739 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Mon, 8 Nov 2021 15:42:36 -0600 Subject: [PATCH 03/17] POM: Stop using git:// protocol with github.com The GitHub platform is discontinuing support for it. See: https://github.blog/2021-09-01-improving-git-protocol-security-github/#whats-changing --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index fa66a58..44cf8af 100644 --- a/pom.xml +++ b/pom.xml @@ -76,7 +76,7 @@ - scm:git:git://github.com/scijava/scripting-java + scm:git:https://github.com/scijava/scripting-java scm:git:git@github.com:scijava/scripting-java HEAD https://github.com/scijava/scripting-java From e9b4179bcb8ca3b585dc6d5de99fe1e7b6e33462 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Tue, 14 Jun 2022 15:54:27 -0500 Subject: [PATCH 04/17] CI: cache ~/.m2/repository correctly --- .github/workflows/build-main.yml | 18 +++--------------- .github/workflows/build-pr.yml | 18 +++--------------- 2 files changed, 6 insertions(+), 30 deletions(-) diff --git a/.github/workflows/build-main.yml b/.github/workflows/build-main.yml index 3fb5622..5ef5692 100644 --- a/.github/workflows/build-main.yml +++ b/.github/workflows/build-main.yml @@ -13,24 +13,12 @@ jobs: steps: - uses: actions/checkout@v2 - - - name: Cache m2 folder - uses: actions/cache@v2 - env: - cache-name: cache-m2 - with: - path: ~/.m2/repository - key: ${{ runner.os }}-build-${{ env.cache-name }} - restore-keys: | - ${{ runner.os }}-build-${{ env.cache-name }}- - ${{ runner.os }}-build- - ${{ runner.os }}- - - - name: Set up JDK 8 - uses: actions/setup-java@v2 + - name: Set up Java + uses: actions/setup-java@v3 with: java-version: '8' distribution: 'zulu' + cache: 'maven' - name: Set up CI environment run: .github/setup.sh - name: Execute the build diff --git a/.github/workflows/build-pr.yml b/.github/workflows/build-pr.yml index 92a0192..925b576 100644 --- a/.github/workflows/build-pr.yml +++ b/.github/workflows/build-pr.yml @@ -11,24 +11,12 @@ jobs: steps: - uses: actions/checkout@v2 - - - name: Cache m2 folder - uses: actions/cache@v2 - env: - cache-name: cache-m2 - with: - path: ~/.m2/repository - key: ${{ runner.os }}-build-${{ env.cache-name }} - restore-keys: | - ${{ runner.os }}-build-${{ env.cache-name }}- - ${{ runner.os }}-build- - ${{ runner.os }}- - - - name: Set up JDK 8 - uses: actions/setup-java@v2 + - name: Set up Java + uses: actions/setup-java@v3 with: java-version: '8' distribution: 'zulu' + cache: 'maven' - name: Set up CI environment run: .github/setup.sh - name: Execute the build From 714c51401ddfef8cc389efc7e0ea48bd7e2d810d Mon Sep 17 00:00:00 2001 From: Matt Date: Thu, 14 Aug 2025 15:31:52 +0200 Subject: [PATCH 05/17] Switched using classloader to using classgraph library. --- pom.xml | 6 +- .../plugins/scripting/java/JavaEngine.java | 133 +++++------------- 2 files changed, 40 insertions(+), 99 deletions(-) diff --git a/pom.xml b/pom.xml index 44cf8af..1035e79 100644 --- a/pom.xml +++ b/pom.xml @@ -111,7 +111,11 @@ Institute of Molecular Cell Biology and Genetics. org.scijava scijava-common - + + io.github.classgraph + classgraph + 4.8.172 + junit diff --git a/src/main/java/org/scijava/plugins/scripting/java/JavaEngine.java b/src/main/java/org/scijava/plugins/scripting/java/JavaEngine.java index 2225447..6d61f5d 100644 --- a/src/main/java/org/scijava/plugins/scripting/java/JavaEngine.java +++ b/src/main/java/org/scijava/plugins/scripting/java/JavaEngine.java @@ -31,6 +31,33 @@ package org.scijava.plugins.scripting.java; +import io.github.classgraph.ClassGraph; +import org.scijava.command.CommandService; +import org.scijava.minimaven.BuildEnvironment; +import org.scijava.minimaven.Coordinate; +import org.scijava.minimaven.MavenProject; +import org.scijava.plugin.Parameter; +import org.scijava.plugin.PluginService; +import org.scijava.run.RunService; +import org.scijava.script.AbstractScriptEngine; +import org.scijava.util.FileUtils; +import org.scijava.util.LineOutputStream; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.xml.sax.SAXException; + +import javax.script.ScriptEngine; +import javax.script.ScriptException; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.transform.OutputKeys; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerConfigurationException; +import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.TransformerFactoryConfigurationError; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; import java.io.BufferedReader; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -43,44 +70,13 @@ import java.io.Reader; import java.io.StringReader; import java.io.Writer; -import java.net.MalformedURLException; import java.net.URL; import java.net.URLClassLoader; import java.util.ArrayList; import java.util.List; -import java.util.jar.Attributes.Name; -import java.util.jar.JarFile; -import java.util.jar.Manifest; import java.util.regex.Matcher; import java.util.regex.Pattern; -import javax.script.ScriptEngine; -import javax.script.ScriptException; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.transform.OutputKeys; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerConfigurationException; -import javax.xml.transform.TransformerException; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.TransformerFactoryConfigurationError; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.stream.StreamResult; - -import org.scijava.command.CommandService; -import org.scijava.minimaven.BuildEnvironment; -import org.scijava.minimaven.Coordinate; -import org.scijava.minimaven.MavenProject; -import org.scijava.plugin.Parameter; -import org.scijava.plugin.PluginService; -import org.scijava.run.RunService; -import org.scijava.script.AbstractScriptEngine; -import org.scijava.util.FileUtils; -import org.scijava.util.LineOutputStream; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.xml.sax.SAXException; - /** * A pseudo-{@link ScriptEngine} compiling and executing Java classes. *

@@ -787,23 +783,14 @@ private static Element append(final Document document, final Element parent, getAllDependencies(final BuildEnvironment env) { final List result = new ArrayList(); - for (ClassLoader loader = Thread.currentThread().getContextClassLoader(); loader != null; loader = - loader.getParent()) - { - if (loader instanceof URLClassLoader) { - for (final URL url : ((URLClassLoader) loader).getURLs()) { - if (url.getProtocol().equals("file")) { - final File file = new File(url.getPath()); - if (url.toString().matches( - ".*/target/surefire/surefirebooter[0-9]*\\.jar")) - { - getSurefireBooterURLs(file, url, env, result); - continue; - } - result.add(fakeDependency(env, file)); - } - } - } + ClassGraph cg = new ClassGraph(); + String cp = cg.getClasspath(); + String[] candidates = cp.split(File.pathSeparator); + + for( String candidate : candidates ){ + File file = new File(candidate); + Coordinate c = fakeDependency(env, file); + result.add(c); } return result; } @@ -830,56 +817,6 @@ private static Coordinate fakeDependency(final BuildEnvironment env, return dependency; } - /** - * Figures out the class path given a {@code .jar} file generated by the - * {@code maven-surefire-plugin}. - *

- * A little-known feature of JAR files is that their manifest can specify - * additional class path elements in a {@code Class-Path} entry. The - * {@code maven-surefire-plugin} makes extensive use of that: the URLs of the - * of the active {@link URLClassLoader} will consist of only a single - * {@code .jar} file that is empty except for a manifest whose sole purpose is - * to specify the dependencies. - *

- *

- * This method can be used to discover those additional class path elements. - *

- * - * @param file the {@code .jar} file generated by the - * {@code maven-surefire-plugin} - * @param baseURL the {@link URL} of the {@code .jar} file, needed for class - * path elements specified as relative paths - * @param env the {@link BuildEnvironment}, to store the Maven POMs faked for - * the class path elements - * @param result the list of dependencies to which the discovered dependencies - * are added - */ - private static void getSurefireBooterURLs(final File file, final URL baseURL, - final BuildEnvironment env, final List result) - { - try { - final JarFile jar = new JarFile(file); - Manifest manifest = jar.getManifest(); - if (manifest != null) { - final String classPath = - manifest.getMainAttributes().getValue(Name.CLASS_PATH); - if (classPath != null) { - for (final String element : classPath.split(" +")) - try { - final File dependency = - new File(new URL(baseURL, element).getPath()); - result.add(fakeDependency(env, dependency)); - } - catch (MalformedURLException e) { - e.printStackTrace(); - } - } - } - } - catch (final IOException e) { - e.printStackTrace(); - } - } /** * Read complete contents of a Reader and return as String. From b72274b82acbfb1dd156f88856ce1c29c5993edf Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Thu, 14 Aug 2025 13:21:29 -0500 Subject: [PATCH 06/17] POM: update parent to pom-scijava 42.0.0 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 1035e79..fd8fc39 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.scijava pom-scijava - 26.0.0 + 42.0.0 From c3fecc77595cc7e359b115da1690709e952d009d Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Thu, 14 Aug 2025 13:22:07 -0500 Subject: [PATCH 07/17] Update copyright blurbs for 2025 --- LICENSE.txt | 2 +- .../java/org/scijava/plugins/scripting/java/JavaEngine.java | 2 +- .../org/scijava/plugins/scripting/java/JavaEngineBindings.java | 2 +- .../org/scijava/plugins/scripting/java/JavaScriptLanguage.java | 2 +- .../java/org/scijava/plugins/scripting/java/JavaEngineTest.java | 2 +- .../java/org/scijava/plugins/scripting/java/MakeJarTest.java | 2 +- src/test/resources/Dummy.java | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/LICENSE.txt b/LICENSE.txt index 28fb714..3ee5b32 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,4 +1,4 @@ -Copyright (c) 2008 - 2017, Board of Regents of the University of +Copyright (c) 2008 - 2025, Board of Regents of the University of Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck Institute of Molecular Cell Biology and Genetics. All rights reserved. diff --git a/src/main/java/org/scijava/plugins/scripting/java/JavaEngine.java b/src/main/java/org/scijava/plugins/scripting/java/JavaEngine.java index 6d61f5d..88d7e51 100644 --- a/src/main/java/org/scijava/plugins/scripting/java/JavaEngine.java +++ b/src/main/java/org/scijava/plugins/scripting/java/JavaEngine.java @@ -2,7 +2,7 @@ * #%L * JSR-223-compliant Java scripting language plugin. * %% - * Copyright (C) 2008 - 2017 Board of Regents of the University of + * Copyright (C) 2008 - 2025 Board of Regents of the University of * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck * Institute of Molecular Cell Biology and Genetics. * %% diff --git a/src/main/java/org/scijava/plugins/scripting/java/JavaEngineBindings.java b/src/main/java/org/scijava/plugins/scripting/java/JavaEngineBindings.java index 0cf76eb..ea82a3d 100644 --- a/src/main/java/org/scijava/plugins/scripting/java/JavaEngineBindings.java +++ b/src/main/java/org/scijava/plugins/scripting/java/JavaEngineBindings.java @@ -2,7 +2,7 @@ * #%L * JSR-223-compliant Java scripting language plugin. * %% - * Copyright (C) 2008 - 2017 Board of Regents of the University of + * Copyright (C) 2008 - 2025 Board of Regents of the University of * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck * Institute of Molecular Cell Biology and Genetics. * %% diff --git a/src/main/java/org/scijava/plugins/scripting/java/JavaScriptLanguage.java b/src/main/java/org/scijava/plugins/scripting/java/JavaScriptLanguage.java index 00be7fe..6ecad22 100644 --- a/src/main/java/org/scijava/plugins/scripting/java/JavaScriptLanguage.java +++ b/src/main/java/org/scijava/plugins/scripting/java/JavaScriptLanguage.java @@ -2,7 +2,7 @@ * #%L * JSR-223-compliant Java scripting language plugin. * %% - * Copyright (C) 2008 - 2017 Board of Regents of the University of + * Copyright (C) 2008 - 2025 Board of Regents of the University of * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck * Institute of Molecular Cell Biology and Genetics. * %% diff --git a/src/test/java/org/scijava/plugins/scripting/java/JavaEngineTest.java b/src/test/java/org/scijava/plugins/scripting/java/JavaEngineTest.java index d2128ab..7c413d8 100644 --- a/src/test/java/org/scijava/plugins/scripting/java/JavaEngineTest.java +++ b/src/test/java/org/scijava/plugins/scripting/java/JavaEngineTest.java @@ -2,7 +2,7 @@ * #%L * JSR-223-compliant Java scripting language plugin. * %% - * Copyright (C) 2008 - 2017 Board of Regents of the University of + * Copyright (C) 2008 - 2025 Board of Regents of the University of * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck * Institute of Molecular Cell Biology and Genetics. * %% diff --git a/src/test/java/org/scijava/plugins/scripting/java/MakeJarTest.java b/src/test/java/org/scijava/plugins/scripting/java/MakeJarTest.java index 60794b7..ae0b60f 100644 --- a/src/test/java/org/scijava/plugins/scripting/java/MakeJarTest.java +++ b/src/test/java/org/scijava/plugins/scripting/java/MakeJarTest.java @@ -2,7 +2,7 @@ * #%L * JSR-223-compliant Java scripting language plugin. * %% - * Copyright (C) 2008 - 2017 Board of Regents of the University of + * Copyright (C) 2008 - 2025 Board of Regents of the University of * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck * Institute of Molecular Cell Biology and Genetics. * %% diff --git a/src/test/resources/Dummy.java b/src/test/resources/Dummy.java index 5e788c4..3b86531 100644 --- a/src/test/resources/Dummy.java +++ b/src/test/resources/Dummy.java @@ -2,7 +2,7 @@ * #%L * JSR-223-compliant Java scripting language plugin. * %% - * Copyright (C) 2008 - 2017 Board of Regents of the University of + * Copyright (C) 2008 - 2025 Board of Regents of the University of * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck * Institute of Molecular Cell Biology and Genetics. * %% From 40cb95da3abcc76611e0625c8acc277d34629d85 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Thu, 14 Aug 2025 13:22:54 -0500 Subject: [PATCH 08/17] POM: declare classgraph version as a property --- pom.xml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index fd8fc39..5f354c6 100644 --- a/pom.xml +++ b/pom.xml @@ -99,6 +99,8 @@ Institute of Molecular Cell Biology and Genetics. sign,deploy-to-scijava + + 4.8.172 @@ -111,11 +113,14 @@ Institute of Molecular Cell Biology and Genetics. org.scijava scijava-common
+ + io.github.classgraph classgraph - 4.8.172 + ${classgraph.version} + junit From d6918c0570c430832946b593f7cf456c5fca95f8 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Thu, 14 Aug 2025 13:25:36 -0500 Subject: [PATCH 09/17] Update CI to current standards; rename main branch --- .github/build.sh | 2 +- .github/setup.sh | 2 +- .github/workflows/build-pr.yml | 23 ------------------- .../workflows/{build-main.yml => build.yml} | 8 +++++-- README.md | 2 +- 5 files changed, 9 insertions(+), 28 deletions(-) delete mode 100644 .github/workflows/build-pr.yml rename .github/workflows/{build-main.yml => build.yml} (81%) diff --git a/.github/build.sh b/.github/build.sh index 7da4262..523abeb 100755 --- a/.github/build.sh +++ b/.github/build.sh @@ -1,3 +1,3 @@ #!/bin/sh -curl -fsLO https://raw.githubusercontent.com/scijava/scijava-scripts/master/ci-build.sh +curl -fsLO https://raw.githubusercontent.com/scijava/scijava-scripts/main/ci-build.sh sh ci-build.sh diff --git a/.github/setup.sh b/.github/setup.sh index f359bbe..a03464b 100755 --- a/.github/setup.sh +++ b/.github/setup.sh @@ -1,3 +1,3 @@ #!/bin/sh -curl -fsLO https://raw.githubusercontent.com/scijava/scijava-scripts/master/ci-setup-github-actions.sh +curl -fsLO https://raw.githubusercontent.com/scijava/scijava-scripts/main/ci-setup-github-actions.sh sh ci-setup-github-actions.sh diff --git a/.github/workflows/build-pr.yml b/.github/workflows/build-pr.yml deleted file mode 100644 index 925b576..0000000 --- a/.github/workflows/build-pr.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: build PR - -on: - pull_request: - branches: - - master - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - name: Set up Java - uses: actions/setup-java@v3 - with: - java-version: '8' - distribution: 'zulu' - cache: 'maven' - - name: Set up CI environment - run: .github/setup.sh - - name: Execute the build - run: .github/build.sh diff --git a/.github/workflows/build-main.yml b/.github/workflows/build.yml similarity index 81% rename from .github/workflows/build-main.yml rename to .github/workflows/build.yml index 5ef5692..b0a181e 100644 --- a/.github/workflows/build-main.yml +++ b/.github/workflows/build.yml @@ -3,9 +3,12 @@ name: build on: push: branches: - - master + - main tags: - "*-[0-9]+.*" + pull_request: + branches: + - main jobs: build: @@ -28,5 +31,6 @@ jobs: GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} MAVEN_USER: ${{ secrets.MAVEN_USER }} MAVEN_PASS: ${{ secrets.MAVEN_PASS }} - OSSRH_PASS: ${{ secrets.OSSRH_PASS }} + CENTRAL_USER: ${{ secrets.CENTRAL_USER }} + CENTRAL_PASS: ${{ secrets.CENTRAL_PASS }} SIGNING_ASC: ${{ secrets.SIGNING_ASC }} diff --git a/README.md b/README.md index 09650b7..a16ffca 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![](https://github.com/scijava/scripting-java/actions/workflows/build-main.yml/badge.svg)](https://github.com/scijava/scripting-java/actions/workflows/build-main.yml) +[![](https://github.com/scijava/scripting-java/actions/workflows/build.yml/badge.svg)](https://github.com/scijava/scripting-java/actions/workflows/build.yml) # Java Scripting From 31fd9c6ca0983caba169d5e259e6b7987e8304dd Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Thu, 14 Aug 2025 13:29:18 -0500 Subject: [PATCH 10/17] POM: bump version to 1.0.0-SNAPSHOT It's past time to start deploying SciJava components like this one to Maven Central! --- pom.xml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index 5f354c6..73afaf8 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ scripting-java - 0.4.2-SNAPSHOT + 1.0.0-SNAPSHOT SciJava Scripting: Java JSR-223-compliant Java scripting language plugin. @@ -97,9 +97,6 @@ Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck Institute of Molecular Cell Biology and Genetics. - - sign,deploy-to-scijava - 4.8.172 From e8af7611ac12e369706f0414e263ac8854234da2 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Thu, 14 Aug 2025 13:30:49 -0500 Subject: [PATCH 11/17] POM: use HTTPS for schema location URL Maven no longer supports plain HTTP for the schema location. And using HTTP now generates errors in Eclipse (and probably other IDEs). --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 73afaf8..808b03d 100644 --- a/pom.xml +++ b/pom.xml @@ -1,5 +1,5 @@ - + 4.0.0 From 4b1c9dd6f7311796a490923125415f46fc9a970e Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Thu, 14 Aug 2025 13:31:01 -0500 Subject: [PATCH 12/17] Bump to next development cycle Signed-off-by: Curtis Rueden --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 808b03d..cd79974 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ scripting-java - 1.0.0-SNAPSHOT + 1.0.1-SNAPSHOT SciJava Scripting: Java JSR-223-compliant Java scripting language plugin. From 2d382bf0d2ceda6e817b59c6d3d0d4fdb83a54ee Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Sun, 14 Jun 2026 18:37:27 -0500 Subject: [PATCH 13/17] Update license headers for 2026 --- LICENSE.txt | 2 +- .../java/org/scijava/plugins/scripting/java/JavaEngine.java | 2 +- .../org/scijava/plugins/scripting/java/JavaEngineBindings.java | 2 +- .../org/scijava/plugins/scripting/java/JavaScriptLanguage.java | 2 +- .../java/org/scijava/plugins/scripting/java/JavaEngineTest.java | 2 +- .../java/org/scijava/plugins/scripting/java/MakeJarTest.java | 2 +- src/test/resources/Dummy.java | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/LICENSE.txt b/LICENSE.txt index 3ee5b32..b4d1bd0 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,4 +1,4 @@ -Copyright (c) 2008 - 2025, Board of Regents of the University of +Copyright (c) 2008 - 2026, Board of Regents of the University of Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck Institute of Molecular Cell Biology and Genetics. All rights reserved. diff --git a/src/main/java/org/scijava/plugins/scripting/java/JavaEngine.java b/src/main/java/org/scijava/plugins/scripting/java/JavaEngine.java index 88d7e51..3b19983 100644 --- a/src/main/java/org/scijava/plugins/scripting/java/JavaEngine.java +++ b/src/main/java/org/scijava/plugins/scripting/java/JavaEngine.java @@ -2,7 +2,7 @@ * #%L * JSR-223-compliant Java scripting language plugin. * %% - * Copyright (C) 2008 - 2025 Board of Regents of the University of + * Copyright (C) 2008 - 2026 Board of Regents of the University of * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck * Institute of Molecular Cell Biology and Genetics. * %% diff --git a/src/main/java/org/scijava/plugins/scripting/java/JavaEngineBindings.java b/src/main/java/org/scijava/plugins/scripting/java/JavaEngineBindings.java index ea82a3d..7620396 100644 --- a/src/main/java/org/scijava/plugins/scripting/java/JavaEngineBindings.java +++ b/src/main/java/org/scijava/plugins/scripting/java/JavaEngineBindings.java @@ -2,7 +2,7 @@ * #%L * JSR-223-compliant Java scripting language plugin. * %% - * Copyright (C) 2008 - 2025 Board of Regents of the University of + * Copyright (C) 2008 - 2026 Board of Regents of the University of * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck * Institute of Molecular Cell Biology and Genetics. * %% diff --git a/src/main/java/org/scijava/plugins/scripting/java/JavaScriptLanguage.java b/src/main/java/org/scijava/plugins/scripting/java/JavaScriptLanguage.java index 6ecad22..7c4d08f 100644 --- a/src/main/java/org/scijava/plugins/scripting/java/JavaScriptLanguage.java +++ b/src/main/java/org/scijava/plugins/scripting/java/JavaScriptLanguage.java @@ -2,7 +2,7 @@ * #%L * JSR-223-compliant Java scripting language plugin. * %% - * Copyright (C) 2008 - 2025 Board of Regents of the University of + * Copyright (C) 2008 - 2026 Board of Regents of the University of * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck * Institute of Molecular Cell Biology and Genetics. * %% diff --git a/src/test/java/org/scijava/plugins/scripting/java/JavaEngineTest.java b/src/test/java/org/scijava/plugins/scripting/java/JavaEngineTest.java index 7c413d8..6e9e68b 100644 --- a/src/test/java/org/scijava/plugins/scripting/java/JavaEngineTest.java +++ b/src/test/java/org/scijava/plugins/scripting/java/JavaEngineTest.java @@ -2,7 +2,7 @@ * #%L * JSR-223-compliant Java scripting language plugin. * %% - * Copyright (C) 2008 - 2025 Board of Regents of the University of + * Copyright (C) 2008 - 2026 Board of Regents of the University of * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck * Institute of Molecular Cell Biology and Genetics. * %% diff --git a/src/test/java/org/scijava/plugins/scripting/java/MakeJarTest.java b/src/test/java/org/scijava/plugins/scripting/java/MakeJarTest.java index ae0b60f..39dff7c 100644 --- a/src/test/java/org/scijava/plugins/scripting/java/MakeJarTest.java +++ b/src/test/java/org/scijava/plugins/scripting/java/MakeJarTest.java @@ -2,7 +2,7 @@ * #%L * JSR-223-compliant Java scripting language plugin. * %% - * Copyright (C) 2008 - 2025 Board of Regents of the University of + * Copyright (C) 2008 - 2026 Board of Regents of the University of * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck * Institute of Molecular Cell Biology and Genetics. * %% diff --git a/src/test/resources/Dummy.java b/src/test/resources/Dummy.java index 3b86531..a26e8cd 100644 --- a/src/test/resources/Dummy.java +++ b/src/test/resources/Dummy.java @@ -2,7 +2,7 @@ * #%L * JSR-223-compliant Java scripting language plugin. * %% - * Copyright (C) 2008 - 2025 Board of Regents of the University of + * Copyright (C) 2008 - 2026 Board of Regents of the University of * Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck * Institute of Molecular Cell Biology and Genetics. * %% From b63325f502457b9c5e4d366cc6281de01df2b5ca Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Sun, 14 Jun 2026 18:37:40 -0500 Subject: [PATCH 14/17] POM: update parent to pom-scijava 44.0.0 --- pom.xml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index cd79974..cbced05 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.scijava pom-scijava - 42.0.0 + 44.0.0 @@ -91,13 +91,12 @@ + 8 org.scijava.plugins.scripting.java bsd_2 Board of Regents of the University of Wisconsin-Madison, Broad Institute of MIT and Harvard, and Max Planck Institute of Molecular Cell Biology and Genetics. - - 4.8.172 @@ -115,7 +114,6 @@ Institute of Molecular Cell Biology and Genetics. io.github.classgraph classgraph - ${classgraph.version} From 9ae808e63746431de3a4eb3c84804d832d58e24a Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Sun, 14 Jun 2026 19:21:46 -0500 Subject: [PATCH 15/17] Update CI to current configuration --- .github/workflows/build.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b0a181e..612b61d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,17 +15,19 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Java - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: java-version: '8' distribution: 'zulu' cache: 'maven' - name: Set up CI environment run: .github/setup.sh + shell: bash - name: Execute the build run: .github/build.sh + shell: bash env: GPG_KEY_NAME: ${{ secrets.GPG_KEY_NAME }} GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} From b7075bd159d0ee895dd1190b2c45f2b55e279b3a Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Sun, 14 Jun 2026 19:22:23 -0500 Subject: [PATCH 16/17] Fix extraneous whitespace in generated POM files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With Java 11 only (not 8, 17, or 21!), tests failed with errors like: java.lang.AssertionError: Unexpected: META-INF/maven/ org.scijava.scripting.java / Dummy /pom.xml Cause: the generated pom.xml has whitespace-polluted , , and values. Here's what was happening: 1. fakePOM() builds an XML document where each element's content is stored as a CDATA section via document.createCDATASection(content). 2. The transformer is configured with OutputKeys.INDENT = "yes". 3. In Java 8 (Xalan), the transformer writes CDATA content inline: . 4. In Java 11, the internal XSLT transformer changed its indentation behavior for CDATA nodes — it treats a CDATA section as a child node distinct from inline text, and inserts a newline + indent before it and after it: 5. When MiniMaven parses this POM back, getTextContent() on returns "\n org.scijava.scripting.java\n ", which then gets embedded verbatim into the JAR entry path and into download URLs — causing the MalformedURLException and the wrong JAR entry names. The fix is in the append method: replace createCDATASection with createTextNode. XSLT transformers universally treat text-only elements (those with a single text-node child and no element children) as opaque and don't inject indentation whitespace inside them. CDATA sections and text nodes are semantically identical in XML, but Java 11's XSLT transformer treats a CDATA node as a distinct child and wraps it with indentation whitespace when INDENT=yes. Plain text nodes in text-only elements are left inline. Co-authored-by: Claude Sonnet 4.6 --- .../java/org/scijava/plugins/scripting/java/JavaEngine.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/scijava/plugins/scripting/java/JavaEngine.java b/src/main/java/org/scijava/plugins/scripting/java/JavaEngine.java index 3b19983..ea2a4fa 100644 --- a/src/main/java/org/scijava/plugins/scripting/java/JavaEngine.java +++ b/src/main/java/org/scijava/plugins/scripting/java/JavaEngine.java @@ -759,7 +759,7 @@ private static Element append(final Document document, final Element parent, { Element child = document.createElement(tag); if (content != null) child - .appendChild(document.createCDATASection(content)); + .appendChild(document.createTextNode(content)); parent.appendChild(child); return child; } From a0534cd515808e40196d6e8bd10c82ff733ea0c9 Mon Sep 17 00:00:00 2001 From: Curtis Rueden Date: Sun, 14 Jun 2026 19:24:37 -0500 Subject: [PATCH 17/17] Bump to next development cycle Signed-off-by: Curtis Rueden --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index cbced05..459e65e 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ scripting-java - 1.0.1-SNAPSHOT + 1.0.2-SNAPSHOT SciJava Scripting: Java JSR-223-compliant Java scripting language plugin.