diff --git a/.mvn/extensions.jam b/.mvn/extensions.jam index 59f4b71f3..5e6342aa2 100644 --- a/.mvn/extensions.jam +++ b/.mvn/extensions.jam @@ -11,5 +11,5 @@ extensions> extension> groupId>com.javax0.jamal artifactId>jamal-maven-extension - version>{RELEASE} + version>2.6.1-SNAPSHOT }{@xmlFormat} \ No newline at end of file diff --git a/.mvn/extensions.xml b/.mvn/extensions.xml index 143c4c3b5..d5bf7355a 100644 --- a/.mvn/extensions.xml +++ b/.mvn/extensions.xml @@ -6,6 +6,6 @@ The latest version is 2.6.0. com.javax0.jamal jamal-maven-extension - 2.6.0 + 2.6.1-SNAPSHOT \ No newline at end of file diff --git a/.mvn/touch b/.mvn/touch new file mode 100644 index 000000000..fd594a59b --- /dev/null +++ b/.mvn/touch @@ -0,0 +1 @@ +000 \ No newline at end of file diff --git a/README.jrf b/README.jrf index 767a5f4b9..36440b36b 100644 --- a/README.jrf +++ b/README.jrf @@ -1,5 +1,5 @@ # This is a Jamal reference file containing serialized base64 encoded macros -# Created: 2024-06-26 15:33:27 +0200 +# Created: 2024-06-27 19:17:54 +0200 # id|openStr|closeStr|verbatim|tailParameter|pure|content|parameters # TOC VE9D|eyU=|JX0=|0|0|0|Ci4gPDxJbnN0YWxsYXRpb24+PgouIDw8R1M+PgouIDw8Q29uZmlndXJhdGlvbj4+Ci4gPDxGZWF0dXJlcz4+Ci4gPDxDb250cmlidXRpbmc+PgouIDw8RG9jdW1lbnRhdGlvbj4+Ci4gPDxMaWNlbnNlPj4KLiA8PENoYW5nZWxvZz4+Ci4gPDxSb2FkbWFwPj4KLiA8PFN1cHBvcnQ+PgouIDw8RkFRPj4KLiA8PE1haW50ZW5hbmNlPj4=| diff --git a/RELEASES.adoc b/RELEASES.adoc index ce437a577..89ec36efc 100644 --- a/RELEASES.adoc +++ b/RELEASES.adoc @@ -6,8 +6,27 @@ +NOTE: The known bugs sections in the releases are updated after the release. +Plese consult the latest SNAPSHOT version available online at https://github.com/verhas/jamal/blob/master/RELEASES.adoc[GitHub Jamal RELEASES.adoc] + == https://github.com/verhas/jamal/tree/2.6.0[2.6.0] +=== Known Bugs + +* This release does not work as a Maven Extension. +The maven extensions started to use the pre-release Maven core dependecies of `4.0.0`. +It was a mistake, but until `4.0.0-alpha-8` there was no compatibility issue. +The Jamal extension structure was drastically changed from Maven core `4.0.0-alpha-8` to `beta` releases. +It caused the Maven extension to fail silently. +The extension is not invoked. +Since the source of Jamal contains the `pom.xml` files along the source files the fact that the extension did not start was not discovered. ++ +*Workaround:* (1) Use 2.5.0 version of Jamal as a maven extension. +If you need the features from the release 2.6.0 then. +(2) Avoid using the extension and traspile the `pom.jam` files to `pom.xml` files using the `jamal` command-line tool or Maven plugin. + +=== New Features + * `jrf` (reference) files now can contain comments to make them more readable. * `import` has a new parop `global` that makes the import global and not imported again even if the file was imported from a local scope. * `import` does not import a file again if it has the same content as an already imported file. diff --git a/RELEASES.adoc.jam b/RELEASES.adoc.jam index 9f006b905..576308cee 100644 --- a/RELEASES.adoc.jam +++ b/RELEASES.adoc.jam @@ -6,8 +6,27 @@ {%@define RELEASE_N($x)=== https://github.com/verhas/jamal/tree/$x[$x]%} {%@define RELEASE($x)={%RELEASE_N {%RELEASE:$x%}%}%} +NOTE: The known bugs sections in the releases are updated after the release. +Plese consult the latest SNAPSHOT version available online at https://github.com/verhas/jamal/blob/master/RELEASES.adoc[GitHub Jamal RELEASES.adoc] + {%RELEASE OULU%} +=== Known Bugs + +* This release does not work as a Maven Extension. +The maven extensions started to use the pre-release Maven core dependecies of `4.0.0`. +It was a mistake, but until `4.0.0-alpha-8` there was no compatibility issue. +The Jamal extension structure was drastically changed from Maven core `4.0.0-alpha-8` to `beta` releases. +It caused the Maven extension to fail silently. +The extension is not invoked. +Since the source of Jamal contains the `pom.xml` files along the source files the fact that the extension did not start was not discovered. ++ +*Workaround:* (1) Use {%RELEASE:ROGACHEVO%} version of Jamal as a maven extension. +If you need the features from the release {%RELEASE:OULU%} then. +(2) Avoid using the extension and traspile the `pom.jam` files to `pom.xml` files using the `jamal` command-line tool or Maven plugin. + +=== New Features + * `jrf` (reference) files now can contain comments to make them more readable. * `import` has a new parop `global` that makes the import global and not imported again even if the file was imported from a local scope. * `import` does not import a file again if it has the same content as an already imported file. diff --git a/jamal-all/pom.xml b/jamal-all/pom.xml index b9b08cb9d..ebffd66da 100644 --- a/jamal-all/pom.xml +++ b/jamal-all/pom.xml @@ -91,6 +91,10 @@ com.javax0.jamal jamal-xls + + com.javax0.jamal + jamal-rest + com.javax0.jamal jamal-groovy diff --git a/jamal-api/pom.xml b/jamal-api/pom.xml index 4cac01b7a..52809654e 100644 --- a/jamal-api/pom.xml +++ b/jamal-api/pom.xml @@ -37,6 +37,7 @@ --add-opens jamal.api/javax0.jamal.api=ALL-UNNAMED + -XX:+EnableDynamicAgentLoading diff --git a/jamal-asciidoc/pom.xml b/jamal-asciidoc/pom.xml index 28b26171d..2fee62ba8 100644 --- a/jamal-asciidoc/pom.xml +++ b/jamal-asciidoc/pom.xml @@ -49,7 +49,7 @@ --add-opens jamal.asciidoc/javax0.jamal.asciidoc=ALL-UNNAMED - + -XX:+EnableDynamicAgentLoading @@ -116,6 +116,10 @@ com.javax0.jamal jamal-xls + + com.javax0.jamal + jamal-rest + com.javax0.jamal jamal-test diff --git a/jamal-asciidoc258/pom.xml b/jamal-asciidoc258/pom.xml index f31acc758..4cb7519b1 100644 --- a/jamal-asciidoc258/pom.xml +++ b/jamal-asciidoc258/pom.xml @@ -30,7 +30,7 @@ --add-opens jamal.asciidoc/javax0.jamal.asciidoc=ALL-UNNAMED - + -XX:+EnableDynamicAgentLoading diff --git a/jamal-assertions/pom.xml b/jamal-assertions/pom.xml index 540cdd1b7..a77ec078d 100644 --- a/jamal-assertions/pom.xml +++ b/jamal-assertions/pom.xml @@ -30,6 +30,7 @@ --add-opens jamal.assertions/javax0.jamal.assertions=ALL-UNNAMED + -XX:+EnableDynamicAgentLoading @@ -69,13 +70,13 @@ org.junit.jupiter junit-jupiter-api - 5.11.0-M1 + 5.11.0-M2 test org.junit.jupiter junit-jupiter-engine - 5.11.0-M1 + 5.11.0-M2 test diff --git a/jamal-cmd/pom.xml b/jamal-cmd/pom.xml index 745ae3bd5..66567082e 100644 --- a/jamal-cmd/pom.xml +++ b/jamal-cmd/pom.xml @@ -120,6 +120,10 @@ com.javax0.jamal jamal-xls + + com.javax0.jamal + jamal-rest + com.javax0.jamal jamal-maven-input diff --git a/jamal-debug/pom.xml b/jamal-debug/pom.xml index b7a103d9c..c650833bc 100644 --- a/jamal-debug/pom.xml +++ b/jamal-debug/pom.xml @@ -30,6 +30,7 @@ --add-opens jamal.debug/javax0.jamal.debugger=ALL-UNNAMED + -XX:+EnableDynamicAgentLoading @@ -55,13 +56,13 @@ org.junit.jupiter junit-jupiter-api - 5.11.0-M1 + 5.11.0-M2 test org.junit.jupiter junit-jupiter-engine - 5.11.0-M1 + 5.11.0-M2 test diff --git a/jamal-doclet/pom.xml b/jamal-doclet/pom.xml index 461c3a857..912fb347d 100644 --- a/jamal-doclet/pom.xml +++ b/jamal-doclet/pom.xml @@ -30,6 +30,7 @@ --add-opens jamal.doclet/javax0.jamal.doclet=ALL-UNNAMED + -XX:+EnableDynamicAgentLoading @@ -55,13 +56,13 @@ org.junit.jupiter junit-jupiter-api - 5.11.0-M1 + 5.11.0-M2 test org.junit.jupiter junit-jupiter-engine - 5.11.0-M1 + 5.11.0-M2 test diff --git a/jamal-engine/pom.xml b/jamal-engine/pom.xml index d9e7c0949..ab1d724a8 100644 --- a/jamal-engine/pom.xml +++ b/jamal-engine/pom.xml @@ -33,6 +33,7 @@ --add-opens jamal.engine/javax0.jamal=ALL-UNNAMED --add-opens jamal.engine/javax0.jamal.engine=ALL-UNNAMED --add-opens jamal.engine/javax0.jamal.engine.util=ALL-UNNAMED + -XX:+EnableDynamicAgentLoading diff --git a/jamal-extensions/pom.xml b/jamal-extensions/pom.xml index e1b35ae74..eb4ae3db5 100644 --- a/jamal-extensions/pom.xml +++ b/jamal-extensions/pom.xml @@ -31,6 +31,7 @@ --add-opens jamal.extensions/javax0.jamal.extensions=ALL-UNNAMED + -XX:+EnableDynamicAgentLoading diff --git a/jamal-groovy/pom.xml b/jamal-groovy/pom.xml index 70f331916..a451c863d 100644 --- a/jamal-groovy/pom.xml +++ b/jamal-groovy/pom.xml @@ -31,6 +31,7 @@ --add-opens jamal.groovy/javax0.jamal.groovy=ALL-UNNAMED --add-reads jamal.groovy=jamal.engine + -XX:+EnableDynamicAgentLoading @@ -64,13 +65,13 @@ org.junit.jupiter junit-jupiter-api - 5.11.0-M1 + 5.11.0-M2 test org.junit.jupiter junit-jupiter-engine - 5.11.0-M1 + 5.11.0-M2 test diff --git a/jamal-io/pom.xml b/jamal-io/pom.xml index 166c6c0cd..6f63814fb 100644 --- a/jamal-io/pom.xml +++ b/jamal-io/pom.xml @@ -30,6 +30,7 @@ --add-opens jamal.io/javax0.jamal.io=ALL-UNNAMED + -XX:+EnableDynamicAgentLoading @@ -68,13 +69,13 @@ org.junit.jupiter junit-jupiter-api - 5.11.0-M1 + 5.11.0-M2 test org.junit.jupiter junit-jupiter-engine - 5.11.0-M1 + 5.11.0-M2 test diff --git a/jamal-jamal/pom.xml b/jamal-jamal/pom.xml index 9ddb09995..7050849c5 100644 --- a/jamal-jamal/pom.xml +++ b/jamal-jamal/pom.xml @@ -30,6 +30,7 @@ --add-opens jamal.jamal/javax0.jamal.jamal=ALL-UNNAMED + -XX:+EnableDynamicAgentLoading @@ -63,13 +64,13 @@ org.junit.jupiter junit-jupiter-api - 5.11.0-M1 + 5.11.0-M2 test org.junit.jupiter junit-jupiter-engine - 5.11.0-M1 + 5.11.0-M2 test diff --git a/jamal-jar-input/pom.xml b/jamal-jar-input/pom.xml index a1b5e19f5..dcccc8f6d 100644 --- a/jamal-jar-input/pom.xml +++ b/jamal-jar-input/pom.xml @@ -30,6 +30,7 @@ --add-opens jamal.jar.input/javax0.jamal.jar.input=ALL-UNNAMED + -XX:+EnableDynamicAgentLoading diff --git a/jamal-java/pom.xml b/jamal-java/pom.xml index 317fd029c..27af501cf 100644 --- a/jamal-java/pom.xml +++ b/jamal-java/pom.xml @@ -30,6 +30,7 @@ --add-opens jamal.java/javax0.jamal.java=ALL-UNNAMED + -XX:+EnableDynamicAgentLoading @@ -51,7 +52,7 @@ com.javax0.sourcebuddy SourceBuddy - 2.5.0 + 2.5.1 com.javax0.jamal @@ -68,13 +69,13 @@ org.junit.jupiter junit-jupiter-api - 5.11.0-M1 + 5.11.0-M2 test org.junit.jupiter junit-jupiter-engine - 5.11.0-M1 + 5.11.0-M2 test diff --git a/jamal-json/README.adoc b/jamal-json/README.adoc index 1b439eb23..b22aa26b4 100644 --- a/jamal-json/README.adoc +++ b/jamal-json/README.adoc @@ -363,4 +363,6 @@ will result [source] ---- @json:keys a/ = "a,b,c,d" ----- \ No newline at end of file +---- + + diff --git a/jamal-json/pom.xml b/jamal-json/pom.xml index 1aa9e6dac..1806ec77c 100644 --- a/jamal-json/pom.xml +++ b/jamal-json/pom.xml @@ -30,6 +30,7 @@ --add-opens jamal.json/javax0.jamal.json=ALL-UNNAMED + -XX:+EnableDynamicAgentLoading @@ -56,19 +57,19 @@ org.junit.jupiter junit-jupiter-api - 5.11.0-M1 + 5.11.0-M2 test org.junit.jupiter junit-jupiter-engine - 5.11.0-M1 + 5.11.0-M2 test org.mockito mockito-core - 5.11.0 + 5.12.0 org.json diff --git a/jamal-markdown/pom.xml b/jamal-markdown/pom.xml index 0fd72a17f..39040c58c 100644 --- a/jamal-markdown/pom.xml +++ b/jamal-markdown/pom.xml @@ -30,6 +30,7 @@ --add-opens jamal.markdown/javax0.jamal.markdown=ALL-UNNAMED + -XX:+EnableDynamicAgentLoading diff --git a/jamal-maven-extension/README.adoc b/jamal-maven-extension/README.adoc index 7d30c0520..2e82bc93b 100644 --- a/jamal-maven-extension/README.adoc +++ b/jamal-maven-extension/README.adoc @@ -277,6 +277,10 @@ For further information read the link:../jamal-sql/README.adoc[documentation] of For further information read the link:../jamal-xls/README.adoc[documentation] of the module. +=== `rest` + +For further information read the link:../jamal-rest/README.adoc[documentation] of the module. + diff --git a/jamal-maven-extension/README.adoc.jam b/jamal-maven-extension/README.adoc.jam index 2c29045fe..427e68fd1 100644 --- a/jamal-maven-extension/README.adoc.jam +++ b/jamal-maven-extension/README.adoc.jam @@ -303,6 +303,10 @@ The library provides macros that can load Java Built-in Macros from Maven artifa {%further xls%} +=== {%#block {%depCounter%}%} `rest` + +{%further rest%} + {%#assert:equals /{%dependencies%}/{%depCounter last%}/Not all dependencies are documented or some documented dependency is not there any more%} diff --git a/jamal-maven-extension/call-sequence.svg b/jamal-maven-extension/call-sequence.svg index ea94712f5..e94be5a05 100644 --- a/jamal-maven-extension/call-sequence.svg +++ b/jamal-maven-extension/call-sequence.svg @@ -1 +1,4 @@ -UserMavenJamal Maven ExtensionJamalMaven Plaform Readermvn verifyread .mvn/extensions.xmlLOADget pom structureprocess pom.jamresultsave pom.xmlalt[.mvn exists]process .mvn/extensions.jamresultupdate .mvn/extensions.xmlpom.xml fileget pom structureread the pom.xmlpom structurepom structurebuilddone \ No newline at end of file + +UserMavenJamal Maven ExtensionJamalMaven Plaform Readermvn verifyread .mvn/extensions.xmlLOADget pom structureprocess pom.jamresultsave pom.xmlalt[.mvn exists]process .mvn/extensions.jamresultupdate .mvn/extensions.xmlpom.xml fileget pom structureread the pom.xmlpom structurepom structurebuilddone \ No newline at end of file diff --git a/jamal-maven-extension/pom.xml b/jamal-maven-extension/pom.xml index 3b5e2503a..8029d2e06 100644 --- a/jamal-maven-extension/pom.xml +++ b/jamal-maven-extension/pom.xml @@ -118,6 +118,11 @@ jamal-xls 2.6.1-SNAPSHOT + + com.javax0.jamal + jamal-rest + 2.6.1-SNAPSHOT + com.javax0.jamal jamal-maven-input @@ -139,7 +144,7 @@ org.apache.maven maven-core - 4.0.0-beta-3 + 3.9.8 provided diff --git a/jamal-maven-extension/src/main/java/javax0/jamal/mavenextension/CustomModelProcessor.java b/jamal-maven-extension/src/main/java/javax0/jamal/mavenextension/CustomModelProcessor.java index 73260e61c..786355f5a 100644 --- a/jamal-maven-extension/src/main/java/javax0/jamal/mavenextension/CustomModelProcessor.java +++ b/jamal-maven-extension/src/main/java/javax0/jamal/mavenextension/CustomModelProcessor.java @@ -5,15 +5,13 @@ import javax0.jamal.tools.FileTools; import org.apache.maven.model.Model; import org.apache.maven.model.building.ModelProcessor; -import org.apache.maven.model.io.ModelParseException; import org.apache.maven.model.io.ModelReader; +import org.codehaus.plexus.component.annotations.Component; +import org.codehaus.plexus.component.annotations.Requirement; import org.codehaus.plexus.util.ReaderFactory; import org.w3c.dom.Document; import org.xml.sax.InputSource; -import javax.inject.Inject; -import javax.inject.Named; -import javax.inject.Singleton; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.transform.OutputKeys; @@ -24,7 +22,6 @@ import java.io.*; import java.nio.charset.StandardCharsets; import java.nio.file.Files; -import java.nio.file.Path; import java.nio.file.Paths; import java.util.Arrays; import java.util.HashSet; @@ -35,47 +32,18 @@ /** * This is the extension class that implements the maven macro extension */ -@Named -@Singleton +@Component(role = ModelProcessor.class) public class CustomModelProcessor implements ModelProcessor { - @Inject + @Requirement private ModelReader modelReader; - @Deprecated @Override public File locatePom(File projectDirectory) { - Path path = locatePom(projectDirectory != null ? projectDirectory.toPath() : null); - return path != null ? path.toFile() : null; - } - @Override - public Path locatePom(Path projectDirectory) { - return projectDirectory != null ? projectDirectory : Paths.get(System.getProperty("user.dir")); - } - - @Deprecated - @Override - public File locateExistingPom(File project) { - Path path = locateExistingPom(project != null ? project.toPath() : null); - return path != null ? path.toFile() : null; - } - @Override - public Path locateExistingPom(Path project) { - if (project == null || Files.isDirectory(project)) { - project = locatePom(project); - } - - convertExtensionsJam(project); - jam2Xml(project, "pom", false); + convertExtensionsJam(projectDirectory); - if (Files.isDirectory(project)) { - Path pom = project.resolve("pom.xml"); - return Files.isRegularFile(pom) ? pom : null; - } else if (Files.isRegularFile(project)) { - return project; - } else { - return null; - } + jam2Xml(projectDirectory, "pom", false); + return new File(projectDirectory, "pom.xml"); } /** @@ -84,14 +52,15 @@ public Path locateExistingPom(Path project) { * Another side effect is the error report, which does happen if the extensions.jam has syntax errors but it does not stop the compilation. *

* The implementation creates a new thread. - * Since this task is started only once for a built, which is usually a few minutes typically, there is no need to use any executor service or virtual thread. + * Since this task is started only once for a built, which is usually a few minutes typically, there is no need to use any executor service. * - * @param project is the root of the project directory provided by Jamal + * @param projectDirectory is the root of the project directory provided by Jamal */ - private void convertExtensionsJam(final Path project) { + private void convertExtensionsJam(final File projectDirectory) { + createTouchFile(projectDirectory); final var t = new Thread(() -> { - final var dotMvnDir = project.resolve(".mvn"); - if (Files.exists(dotMvnDir)) { + final var dotMvnDir = new File(projectDirectory, ".mvn"); + if (dotMvnDir.exists()) { jam2Xml(dotMvnDir, "extensions", true); } }); @@ -100,11 +69,36 @@ private void convertExtensionsJam(final Path project) { t.start(); } - private void jam2Xml(final Path directory, final String sourceName, final boolean optional) { - var jamFile = directory.resolve( sourceName + ".xml.jam"); - if (!Files.exists(jamFile)) { - jamFile = directory.resolve( sourceName + ".jam"); - if (!Files.exists(jamFile)) { + /** + * Create a touch file in the .mvn directory to signal that the extension executes. + *

+ * This helps test the extension that it is compatible and runs with the actual Maven version. + * It is a piece of code that gets into production code, so it is not nice, but seems fairly harmless. + *

+ * The unit test of the extension checks that the touch file is there and that the time stamp is recent. + *

+ * The touch file must exist in the .mvn directory and its name must be 'touch'. + * It is NOT created if it does not exist, not to create garbage in real life projects. + *

+ * This functionality is not a guaranteed feature of the extension; therefore, it is not documented in the README. + * + * @param projectDirectory is the root of the project directory provided by Jamal + */ + private static void createTouchFile(File projectDirectory) { + final var touchFile = new File(projectDirectory, ".mvn/touch"); + if (touchFile.exists()) { + try { + Files.writeString(Paths.get(touchFile.getAbsolutePath()), System.currentTimeMillis() + "\n", StandardCharsets.UTF_8); + } catch (IOException ignore) { + } + } + } + + private void jam2Xml(final File directory, final String sourceName, final boolean optional) { + File jamFile = new File(directory, sourceName + ".xml.jam"); + if (!jamFile.exists()) { + jamFile = new File(directory, sourceName + ".jam"); + if (!jamFile.exists()) { if (optional) { return; } else { @@ -114,7 +108,7 @@ private void jam2Xml(final Path directory, final String sourceName, final boolea } Processor processor = new javax0.jamal.engine.Processor(); - final String fileName = jamFile.toFile().getAbsolutePath(); + final String fileName = jamFile.getAbsolutePath(); final String xml; try { xml = processor.process(FileTools.getInput(fileName, processor)); @@ -128,7 +122,7 @@ private void jam2Xml(final Path directory, final String sourceName, final boolea throw new RuntimeException("Cannot format the file " + fileName + "\n" + dumpException(e), e); } - final File output = directory.resolve( sourceName + ".xml").toFile(); + final File output = new File(directory, sourceName + ".xml"); // noinspection ResultOfMethodCallIgnored output.setWritable(true); try (final OutputStream os = new FileOutputStream(output)) { @@ -173,9 +167,7 @@ private String formatOutput(String result) throws Exception { tf.setOutputProperty(OutputKeys.INDENT, "yes"); Writer out = new StringWriter(); tf.transform(new DOMSource(doc), new StreamResult(out)); - return Arrays.stream(out.toString().split(System.lineSeparator())) - .filter(s -> !s.trim().isEmpty()) - .collect(Collectors.joining(System.lineSeparator())); + return Arrays.stream(out.toString().split(System.lineSeparator())).filter(s -> s.trim().length() > 0).collect(Collectors.joining(System.lineSeparator())); } @Override @@ -194,9 +186,4 @@ public Model read(Reader reader, Map options) throws IOException { public Model read(File input, Map options) throws IOException { return read(new FileInputStream(input), options); } - - @Override - public Model read(Path input, Map options) throws IOException, ModelParseException { - return read(input.toFile(),options); - } } \ No newline at end of file diff --git a/jamal-maven-extension/src/test/java/javax0/jamal/mavenextension/TestCustomModelProcessor.java b/jamal-maven-extension/src/test/java/javax0/jamal/mavenextension/TestCustomModelProcessor.java index 56234d189..b88fe2faa 100644 --- a/jamal-maven-extension/src/test/java/javax0/jamal/mavenextension/TestCustomModelProcessor.java +++ b/jamal-maven-extension/src/test/java/javax0/jamal/mavenextension/TestCustomModelProcessor.java @@ -1,11 +1,78 @@ package javax0.jamal.mavenextension; +import javax0.jamal.DocumentConverter; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; + public class TestCustomModelProcessor { + private static boolean isIntelliJ() { + final var st = new Exception().getStackTrace(); + for (final var s : st) { + if (s.getClassName().contains("Idea")) { + return true; + } + } + return false; + } + + private static void touch(String time) throws IOException { + Files.write(Paths.get(DocumentConverter.getRoot() + "/.mvn", "touch"), time.getBytes()); + } + + /** + * Create a touch file in the .mvn directory to signal that the extension was executed if the test is run from IntelliJ. + * + * @throws IOException if the file cannot be written + */ + @BeforeEach + void manuallyCreateTouchFile() throws IOException { + if (isIntelliJ()) { + touch(String.valueOf(System.currentTimeMillis())); + } + } + + + /** + * This test will do nothing during the maven build. + *

+ * The next test checks the integrity of the already DEPLOYED build. + * If the test fails, a fix has to be created and then a new build has to start. + * And that build will still use the same DEPLOYED build and will fail. + *

+ * To overcome this situation, this test can be executed from IntelliJ. + * It will create a touch file with the current timestamp. + * The next test will not see that the DEPLOYED build is broken and lets the current one to build and deploy. + *

+ * + * @throws IOException if the file cannot be written + */ + @Test + @DisplayName("Create a current touch file but only in IntelliJ") + void createTouchFile() throws IOException { + } + @Test - public void testNothing() { - final var sut = new CustomModelProcessor(); + @DisplayName("Test that the extension was running in the Jamal project") + public void testItWasExecuted() throws IOException { + final var root = DocumentConverter.getRoot(); + final var lines = Files.readAllLines(Paths.get(root + "/.mvn", "touch")); + final var ts = Long.parseLong(lines.get(0)); // throw exception if not a number, fail the test + final var now = System.currentTimeMillis(); + Assertions.assertTrue(ts <= now, "The touch file was not created or the timestamp is in the future"); + if (isIntelliJ()) { + Assertions.assertEquals(0, ts, "We run in IntelliJ and the touch file time stamp is not zero"); + } else { + Assertions.assertTrue(now - ts < 1000 * 60 * 10, "The touch file is older than 10 minutes, fix the bug, and manually run the 'createTouchFile' test from IntelliJ."); + } + // not to have a lingering current value in the touch file + // but write three zeroes to signal it was by the test, and not a manual reset calling + touch("000"); } } diff --git a/jamal-maven-input/pom.xml b/jamal-maven-input/pom.xml index 771ee7c60..5194c9c1b 100644 --- a/jamal-maven-input/pom.xml +++ b/jamal-maven-input/pom.xml @@ -30,6 +30,7 @@ --add-opens jamal.maven.input/javax0.jamal.maven.input=ALL-UNNAMED + -XX:+EnableDynamicAgentLoading diff --git a/jamal-maven-load/pom.xml b/jamal-maven-load/pom.xml index d6bd98770..73dad5725 100644 --- a/jamal-maven-load/pom.xml +++ b/jamal-maven-load/pom.xml @@ -30,6 +30,7 @@ --add-opens jamal.maven.load/javax0.jamal.maven.load=ALL-UNNAMED + -XX:+EnableDynamicAgentLoading @@ -68,18 +69,18 @@ org.mockito mockito-core - 5.11.0 + 5.12.0 org.junit.jupiter junit-jupiter-api - 5.11.0-M1 + 5.11.0-M2 test org.junit.jupiter junit-jupiter-engine - 5.11.0-M1 + 5.11.0-M2 test diff --git a/jamal-maven-plugin/pom.xml b/jamal-maven-plugin/pom.xml index 363c7173c..bd238d7f2 100644 --- a/jamal-maven-plugin/pom.xml +++ b/jamal-maven-plugin/pom.xml @@ -16,7 +16,7 @@ org.apache.maven.plugins maven-plugin-plugin - 3.13.0 + 3.13.1 true @@ -90,6 +90,14 @@ com.javax0.jamal jamal-sql + + com.javax0.jamal + jamal-xls + + + com.javax0.jamal + jamal-rest + com.javax0.jamal jamal-maven-input @@ -114,13 +122,13 @@ org.apache.maven maven-plugin-api - 4.0.0-alpha-13 + 4.0.0-alpha-8 provided org.apache.maven.plugin-tools maven-plugin-annotations - 3.13.0 + 3.13.1 provided diff --git a/jamal-mock/pom.xml b/jamal-mock/pom.xml index b65475109..40e32fb21 100644 --- a/jamal-mock/pom.xml +++ b/jamal-mock/pom.xml @@ -30,6 +30,7 @@ --add-opens jamal.mock/javax0.jamal.mock=ALL-UNNAMED + -XX:+EnableDynamicAgentLoading @@ -68,13 +69,13 @@ org.junit.jupiter junit-jupiter-api - 5.11.0-M1 + 5.11.0-M2 test org.junit.jupiter junit-jupiter-engine - 5.11.0-M1 + 5.11.0-M2 test diff --git a/jamal-openai/pom.xml b/jamal-openai/pom.xml index 2499ed90f..a43396dfd 100644 --- a/jamal-openai/pom.xml +++ b/jamal-openai/pom.xml @@ -30,6 +30,7 @@ --add-opens jamal.openai/javax0.jamal.openai=ALL-UNNAMED + -XX:+EnableDynamicAgentLoading @@ -80,13 +81,13 @@ org.junit.jupiter junit-jupiter-api - 5.11.0-M1 + 5.11.0-M2 test org.junit.jupiter junit-jupiter-engine - 5.11.0-M1 + 5.11.0-M2 test diff --git a/jamal-prog/pom.xml b/jamal-prog/pom.xml index 51f35d807..86a6f074c 100644 --- a/jamal-prog/pom.xml +++ b/jamal-prog/pom.xml @@ -31,6 +31,7 @@ --add-opens jamal.prog/javax0.jamal.prog=ALL-UNNAMED --add-opens jamal.prog/javax0.jamal.prog.commands=ALL-UNNAMED + -XX:+EnableDynamicAgentLoading @@ -70,13 +71,13 @@ org.junit.jupiter junit-jupiter-api - 5.11.0-M1 + 5.11.0-M2 test org.junit.jupiter junit-jupiter-engine - 5.11.0-M1 + 5.11.0-M2 test diff --git a/jamal-rest/pom.xml b/jamal-rest/pom.xml index e026056d8..507c77a9f 100644 --- a/jamal-rest/pom.xml +++ b/jamal-rest/pom.xml @@ -30,6 +30,7 @@ --add-opens jamal.rest/javax0.jamal.rest=ALL-UNNAMED --add-reads jamal.rest=jdk.httpserver + -XX:+EnableDynamicAgentLoading diff --git a/jamal-rest/src/test/java/javax0/jamal/rest/TestRest.java b/jamal-rest/src/test/java/javax0/jamal/rest/TestRest.java index 1394cc4b2..5d2254f0f 100644 --- a/jamal-rest/src/test/java/javax0/jamal/rest/TestRest.java +++ b/jamal-rest/src/test/java/javax0/jamal/rest/TestRest.java @@ -25,7 +25,7 @@ public class TestRest { @BeforeEach public void setUp() { - port = 8000; + port = 8001; while (true) { try { server = HttpServer.create(new InetSocketAddress(port), 0); diff --git a/jamal-ruby/pom.xml b/jamal-ruby/pom.xml index ac3cfd9b3..f5f4921fa 100644 --- a/jamal-ruby/pom.xml +++ b/jamal-ruby/pom.xml @@ -33,7 +33,7 @@ --add-opens java.base/sun.nio.ch=org.jruby.complete --add-opens java.base/java.io=org.jruby.complete --add-reads jamal.ruby=jamal.engine - + -XX:+EnableDynamicAgentLoading diff --git a/jamal-scriptbasic/pom.xml b/jamal-scriptbasic/pom.xml index c62cff53c..bc83cde34 100644 --- a/jamal-scriptbasic/pom.xml +++ b/jamal-scriptbasic/pom.xml @@ -30,6 +30,7 @@ --add-opens jamal.scriptbasic/javax0.jamal.scriptbasic=ALL-UNNAMED + -XX:+EnableDynamicAgentLoading @@ -56,13 +57,13 @@ org.junit.jupiter junit-jupiter-api - 5.11.0-M1 + 5.11.0-M2 test org.junit.jupiter junit-jupiter-engine - 5.11.0-M1 + 5.11.0-M2 test diff --git a/jamal-snippet/README.adoc b/jamal-snippet/README.adoc index 8fc9613d6..ebe3f6fd6 100644 --- a/jamal-snippet/README.adoc +++ b/jamal-snippet/README.adoc @@ -3816,7 +3816,7 @@ will result in the output .output [source] ---- -2024-06-26 15:33:27 +2024-06-27 19:17:55 ---- diff --git a/jamal-snippet/pom.xml b/jamal-snippet/pom.xml index f9805dae8..0280b6477 100644 --- a/jamal-snippet/pom.xml +++ b/jamal-snippet/pom.xml @@ -32,6 +32,7 @@ --add-opens jamal.snippet/javax0.jamal.snippet=ALL-UNNAMED --add-opens jamal.snippet/javax0.jamal.documentation=ALL-UNNAMED + -XX:+EnableDynamicAgentLoading @@ -102,7 +103,7 @@ com.javax0.sourcebuddy SourceBuddy - 2.5.0 + 2.5.1 com.javax0 @@ -122,7 +123,7 @@ org.mockito mockito-core - 5.11.0 + 5.12.0 \ No newline at end of file diff --git a/jamal-sql/demodb.mv.db b/jamal-sql/demodb.mv.db index ac897bd8f..a234bd6ef 100644 Binary files a/jamal-sql/demodb.mv.db and b/jamal-sql/demodb.mv.db differ diff --git a/jamal-sql/pom.xml b/jamal-sql/pom.xml index 8a58adb23..e33a77195 100644 --- a/jamal-sql/pom.xml +++ b/jamal-sql/pom.xml @@ -30,6 +30,7 @@ --add-opens jamal.sql/javax0.jamal.sql=ALL-UNNAMED + -XX:+EnableDynamicAgentLoading diff --git a/jamal-test/pom.xml b/jamal-test/pom.xml index d9d1c4ec0..88de1e3d9 100644 --- a/jamal-test/pom.xml +++ b/jamal-test/pom.xml @@ -43,7 +43,7 @@ --add-opens jamal.engine/javax0.jamal.engine=jamal.snippet --add-exports jamal.test/javax0.jamal.test.core=jamal.core --add-exports jamal.test/javax0.jamal.test.examples=jamal.core - + -XX:+EnableDynamicAgentLoading diff --git a/jamal-testsupport/pom.xml b/jamal-testsupport/pom.xml index 91b8e1069..31a616b24 100644 --- a/jamal-testsupport/pom.xml +++ b/jamal-testsupport/pom.xml @@ -37,6 +37,7 @@ --add-reads jamal.testsupport=jamal.core --add-exports org.junit.platform.commons/org.junit.platform.commons.logging=ALL-UNNAMED --add-exports org.junit.platform.commons/org.junit.platform.commons.util=ALL-UNNAMED + -XX:+EnableDynamicAgentLoading diff --git a/jamal-tools/pom.xml b/jamal-tools/pom.xml index d49ceea3e..00e73760d 100644 --- a/jamal-tools/pom.xml +++ b/jamal-tools/pom.xml @@ -32,6 +32,7 @@ --add-opens jamal.tools/javax0.jamal.tools=ALL-UNNAMED --add-opens jamal.tools/javax0.jamal.tools.param=ALL-UNNAMED + -XX:+EnableDynamicAgentLoading diff --git a/jamal-word/pom.xml b/jamal-word/pom.xml index 9c254e041..bf1beeb14 100644 --- a/jamal-word/pom.xml +++ b/jamal-word/pom.xml @@ -30,7 +30,7 @@ --add-opens jamal.word/javax0.jamal.poi.word=ALL-UNNAMED - + -XX:+EnableDynamicAgentLoading @@ -67,13 +67,13 @@ org.junit.jupiter junit-jupiter-api - 5.11.0-M1 + 5.11.0-M2 test org.junit.jupiter junit-jupiter-engine - 5.11.0-M1 + 5.11.0-M2 test diff --git a/jamal-word/src/test/resources/demoConverted.docx b/jamal-word/src/test/resources/demoConverted.docx index 4a3ef645f..fd53c3351 100644 Binary files a/jamal-word/src/test/resources/demoConverted.docx and b/jamal-word/src/test/resources/demoConverted.docx differ diff --git a/jamal-word/src/test/resources/includetestConverted.docx b/jamal-word/src/test/resources/includetestConverted.docx index 736537231..9113708a4 100644 Binary files a/jamal-word/src/test/resources/includetestConverted.docx and b/jamal-word/src/test/resources/includetestConverted.docx differ diff --git a/jamal-word/src/test/resources/pictureConverted.docx b/jamal-word/src/test/resources/pictureConverted.docx index 7d7a2df17..2f81c0c07 100644 Binary files a/jamal-word/src/test/resources/pictureConverted.docx and b/jamal-word/src/test/resources/pictureConverted.docx differ diff --git a/jamal-word/src/test/resources/sampleConverted.docx b/jamal-word/src/test/resources/sampleConverted.docx index 545a7d82b..5c0c9cf38 100644 Binary files a/jamal-word/src/test/resources/sampleConverted.docx and b/jamal-word/src/test/resources/sampleConverted.docx differ diff --git a/jamal-xls/pom.xml b/jamal-xls/pom.xml index a3f9312b8..565e3af77 100644 --- a/jamal-xls/pom.xml +++ b/jamal-xls/pom.xml @@ -30,6 +30,7 @@ --add-opens jamal.xls/javax0.jamal.xls=ALL-UNNAMED + -XX:+EnableDynamicAgentLoading diff --git a/jamal-yaml/pom.xml b/jamal-yaml/pom.xml index 56e8a9631..ebac2395d 100644 --- a/jamal-yaml/pom.xml +++ b/jamal-yaml/pom.xml @@ -30,6 +30,7 @@ --add-opens jamal.yaml/javax0.jamal.yaml=ALL-UNNAMED + -XX:+EnableDynamicAgentLoading @@ -51,13 +52,13 @@ org.junit.jupiter junit-jupiter-api - 5.11.0-M1 + 5.11.0-M2 test org.junit.jupiter junit-jupiter-engine - 5.11.0-M1 + 5.11.0-M2 test diff --git a/jamal.sh b/jamal.sh index 284b275c5..db8d7f93b 100755 --- a/jamal.sh +++ b/jamal.sh @@ -95,7 +95,7 @@ download "com.vladsch.flexmark" "flexmark-youtrack-converter" "0.64.8" download "com.javax0.jamal" "jamal-mock" "2.6.1-SNAPSHOT" download "com.javax0.jamal" "jamal-snippet" "2.6.1-SNAPSHOT" download "com.javax0.javaLex" "javaLex" "1.0.2" -download "com.javax0.sourcebuddy" "SourceBuddy" "2.5.0" +download "com.javax0.sourcebuddy" "SourceBuddy" "2.5.1" download "com.javax0" "refi" "1.0.1" download "org.ow2.asm" "asm" "9.7" download "org.ow2.asm" "asm-tree" "9.7" @@ -124,6 +124,7 @@ download "org.apache.xmlbeans" "xmlbeans" "5.2.0" download "com.github.virtuald" "curvesapi" "1.08" download "org.apache.commons" "commons-compress" "1.26.2" download "org.apache.commons" "commons-lang3" "3.14.0" +download "com.javax0.jamal" "jamal-rest" "2.6.1-SNAPSHOT" download "com.javax0.jamal" "jamal-maven-input" "2.6.1-SNAPSHOT" download "com.javax0.jamal" "jamal-extensions" "2.6.1-SNAPSHOT" download "com.javax0.jamal" "jamal-jar-input" "2.6.1-SNAPSHOT" diff --git a/pom.xml b/pom.xml index 2f1798004..fec7210b5 100644 --- a/pom.xml +++ b/pom.xml @@ -151,7 +151,7 @@ org.apache.maven.plugins maven-dependency-plugin - 3.7.0 + 3.7.1 collect diff --git a/version.jim b/version.jim index c945e6ddc..f3dcb3941 100644 --- a/version.jim +++ b/version.jim @@ -65,7 +65,7 @@ MAVEN_COMPILER_PLUGIN_VERSION=3.13.0 -- https://repo.maven.apache.org/mave MAVEN_JAVADOC_PLUGIN_VERSION=3.7.0 -- https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-javadoc-plugin MAVEN_GPG_PLUGIN_VERSION=3.2.4 -- https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-gpg-plugin/ MAVEN_ASSEMBLY_PLUGIN_VERSION=3.7.1 -- https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-assembly-plugin/ -MAVEN_PLUGIN_API=4.0.0-beta-3 -- https://repo.maven.apache.org/maven2/org/apache/maven/maven-plugin-api/ +MAVEN_PLUGIN_API=4.0.0-alpha-8 -- https://repo.maven.apache.org/maven2/org/apache/maven/maven-plugin-api/ MAVEN_PLUGIN_ANNOTATIONS=3.13.1 -- https://repo.maven.apache.org/maven2/org/apache/maven/plugin-tools/maven-plugin-annotations/ MAVEN_PLUGIN_PLUGIN_VERSION=3.13.1 -- https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-plugin-plugin SONATYPE_PLUGIN_VERSION=1.7.0 -- https://repo.maven.apache.org/maven2/org/sonatype/plugins/nexus-staging-maven-plugin @@ -93,7 +93,7 @@ ASCIIDOCTORJ_VERSION=3.0.0-alpha.1 -- https://repo.maven.apache.org/mave JSCRIPTBASIC_VERSION=3.0.0 -- https://repo.maven.apache.org/maven2/com/scriptbasic/jscriptbasic/ MARKDOWN_TO_ASCIIDOC=2.0.1 -- https://repo.maven.apache.org/maven2/io/github/markdown-asciidoc/markdown-to-asciidoc/ MAVEN_DOWNLOADER=1.1.0 -- https://repo.maven.apache.org/maven2/com/javax0/mavenDownload/mavenDownloader/ -SOURCE_BUDDY=2.5.3 -- https://repo.maven.apache.org/maven2/com/javax0/sourcebuddy/SourceBuddy/ +SOURCE_BUDDY=2.5.1 -- https://repo.maven.apache.org/maven2/com/javax0/sourcebuddy/SourceBuddy/ JAVA_LEX=1.0.2 -- https://repo.maven.apache.org/maven2/com/javax0/javaLex/javaLex/ REFI=1.0.1 -- https://repo.maven.apache.org/maven2/com/javax0/refi/ SLF4J=2.0.7 -- https://repo.maven.apache.org/maven2/org/slf4j/slf4j-api/ @@ -102,7 +102,7 @@ ASM_TREE_VERSION=9.7 -- https://repo.maven.apache.org/mave H2_VERSION=2.2.224 -- https://repo.maven.apache.org/maven2/com/h2database/h2/ JSQLPARSER_VERSION=4.9 -- https://repo.maven.apache.org/maven2/com/github/jsqlparser/jsqlparser/ -- dependencies needed for the Maven extension (not the plugin) -MAVEN_CORE_VERSION=4.0.0-beta-3 -- https://repo.maven.apache.org/maven2/org/apache/maven/maven-core +MAVEN_CORE_VERSION=3.9.8 -- https://repo.maven.apache.org/maven2/org/apache/maven/maven-core PLEXUS_COMPONENT_METADATA_VERSION=2.2.0 -- https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-component-metadata COMMONS_COMPRESS_VERSION=1.26.2 -- https://repo.maven.apache.org/maven2/org/apache/commons/commons-compress JSOUP_VERSION=1.17.2 -- https://repo.maven.apache.org/maven2/org/jsoup/jsoup diff --git a/versions.adoc b/versions.adoc index 67ef4720a..d249ea9cd 100644 --- a/versions.adoc +++ b/versions.adoc @@ -18,7 +18,10 @@ If all dependencies are up-to-date, then the output should not contain any `*[re * `OK` `MAVEN_ASSEMBLY_PLUGIN_VERSION` `3.7.1` -* `OK` `MAVEN_PLUGIN_API` `4.0.0-beta-3` +* `*[red]#NO#*` `MAVEN_PLUGIN_API` `4.0.0-alpha-8` `*[red]#upgrade to 4.0.0-beta-3#*` ++ +The `beta` versions of the API do not have the dependency to the some of the dependencies and needs more investigation. +It does not work. * `OK` `MAVEN_PLUGIN_ANNOTATIONS` `3.13.1` @@ -83,9 +86,13 @@ When the new Asciidoctor version is released and used as an IntelliJ plugin we w * `OK` `MAVEN_DOWNLOADER` `1.1.0` -* `OK` `SOURCE_BUDDY` `2.5.3` +* `*[red]#NO#*` `SOURCE_BUDDY` `2.5.1` `*[red]#upgrade to 2.5.3#*` ++ +Version 2.5.2 changed the name of the module. +If we change the name of the module some tests that depend on prior versions of Jamal do not work. +To upgrade we have to remove the dependency from the snippet module and move the dependent macros to a different module. -* `OK` `MAVEN_CORE_VERSION` `4.0.0-beta-3` +* `*[red]#NO#*` `MAVEN_CORE_VERSION` `3.9.8` `*[red]#upgrade to 4.0.0-beta-3#*` * `OK` `PLEXUS_COMPONENT_METADATA_VERSION` `2.2.0` diff --git a/versions.adoc.jam b/versions.adoc.jam index a2e1db8cf..a173f270c 100644 --- a/versions.adoc.jam +++ b/versions.adoc.jam @@ -26,6 +26,9 @@ endif〕〕 〔CHECK :MAVEN_GPG_PLUGIN_VERSION:org/apache/maven/plugins/maven-gpg-plugin〕 〔CHECK :MAVEN_ASSEMBLY_PLUGIN_VERSION:org/apache/maven/plugins/maven-assembly-plugin〕 〔CHECK :MAVEN_PLUGIN_API:org/apache/maven/maven-plugin-api〕 ++ +The `beta` versions of the API do not have the dependency to the some of the dependencies and needs more investigation. +It does not work. 〔CHECK :MAVEN_PLUGIN_ANNOTATIONS:org/apache/maven/plugin-tools/maven-plugin-annotations〕 〔CHECK :MAVEN_PLUGIN_PLUGIN_VERSION:org/apache/maven/plugins/maven-plugin-plugin〕 〔CHECK :SONATYPE_PLUGIN_VERSION:org/sonatype/plugins/nexus-staging-maven-plugin〕 @@ -69,6 +72,10 @@ When the new Asciidoctor version is released and used as an IntelliJ plugin we w 〔CHECK :JSCRIPTBASIC_VERSION:com/scriptbasic/jscriptbasic〕 〔CHECK :MAVEN_DOWNLOADER:com/javax0/mavenDownload/mavenDownloader〕 〔CHECK :SOURCE_BUDDY:com/javax0/sourcebuddy/SourceBuddy〕 ++ +Version 2.5.2 changed the name of the module. +If we change the name of the module some tests that depend on prior versions of Jamal do not work. +To upgrade we have to remove the dependency from the snippet module and move the dependent macros to a different module. 〔CHECK :MAVEN_CORE_VERSION:org/apache/maven/maven-core〕 〔CHECK :PLEXUS_COMPONENT_METADATA_VERSION:org/codehaus/plexus/plexus-component-metadata〕 〔CHECK :ASM_VERSION:org/ow2/asm/asm〕