From 5229b2c2dd5e1f2d5d29c7bfa86ec2a32cbf5749 Mon Sep 17 00:00:00 2001 From: Jan Opravil Date: Wed, 25 Nov 2026 19:01:32 +0100 Subject: [PATCH 01/12] build: generate the ANTLR parser in a forked JVM The antlr-maven-plugin runs antlr.Tool in-process and traps its System.exit() with a SecurityManager. Java 18+ no longer allows installing a SecurityManager, so the OpenLDAP ACL editor does not build on current JDKs. Run antlr.Tool with exec-maven-plugin in a separate JVM instead and add the generated sources with build-helper in pom-first.xml. The exec-maven-plugin version is now managed in the root POM (3.7.0). Co-Authored-By: Claude Opus 5.5 --- installers/pom.xml | 12 ------- plugins/openldap.acl.editor/pom-first.xml | 44 +++++++++++++++++++---- plugins/openldap.acl.editor/pom.xml | 24 ++++++++++--- pom.xml | 7 ++++ 4 files changed, 64 insertions(+), 23 deletions(-) diff --git a/installers/pom.xml b/installers/pom.xml index a1f7fafcf1..8b962dadc7 100644 --- a/installers/pom.xml +++ b/installers/pom.xml @@ -48,16 +48,4 @@ - - - - - org.codehaus.mojo - exec-maven-plugin - 3.2.0 - - - - - diff --git a/plugins/openldap.acl.editor/pom-first.xml b/plugins/openldap.acl.editor/pom-first.xml index 31a6d0d6f0..231935c64e 100644 --- a/plugins/openldap.acl.editor/pom-first.xml +++ b/plugins/openldap.acl.editor/pom-first.xml @@ -42,18 +42,50 @@ + org.codehaus.mojo - antlr-maven-plugin - - *.g - - + exec-maven-plugin + + + generate-antlr-sources + generate-sources + + exec + + + ${java.home}/bin/java + compile + ${project.build.directory}/generated-sources/antlr + + -classpath + + antlr.Tool + ${project.basedir}/src/main/antlr/Acl.g + + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + add-antlr-sources + generate-sources - generate + add-source + + + ${project.build.directory}/generated-sources/antlr + + diff --git a/plugins/openldap.acl.editor/pom.xml b/plugins/openldap.acl.editor/pom.xml index a6ead75269..6fa8650251 100644 --- a/plugins/openldap.acl.editor/pom.xml +++ b/plugins/openldap.acl.editor/pom.xml @@ -40,17 +40,31 @@ + org.codehaus.mojo - antlr-maven-plugin - - *.g - + exec-maven-plugin + generate-antlr-sources + generate-sources - generate + exec + + ${java.home}/bin/java + compile + ${project.build.directory}/generated-sources/antlr + + -classpath + + antlr.Tool + ${project.basedir}/src/main/antlr/Acl.g + + diff --git a/pom.xml b/pom.xml index 3aa4362523..e5d5c34b8a 100644 --- a/pom.xml +++ b/pom.xml @@ -261,6 +261,13 @@ + + + org.codehaus.mojo + exec-maven-plugin + 3.7.0 + + org.apache.rat apache-rat-plugin From 1c3a4e04cd2ec54c2acb0bad8d6fcf9ad88a22d5 Mon Sep 17 00:00:00 2001 From: Jan Opravil Date: Wed, 25 Nov 2026 19:01:52 +0100 Subject: [PATCH 02/12] build!: move to Java 21, Tycho 5.0.4 and Eclipse 4.41 Eclipse 4.41 requires Java 21, so the build and the product now target Java 21 (maven.compiler.release, osgi.requiredJavaVersion). Build: - Tycho 2.3.0 -> 5.0.4 (needs Maven 3.9.9+), parent POM 48 -> 52. - pom-first.xml of the target platform uses 'pom' packaging, because Tycho 5 resolves an eclipse-target-definition before the local p2 repository it refers to has been built. The generated .target is attached with build-helper, so it is still installed. Target platform: - Eclipse 4.41, SWTBot 4.3.0, Orbit 4.41, Babel R0.20.0. - Drop what Eclipse 4.41 no longer ships: javax.xml, javax.xml.stream, jdt.launching.macosx, org.eclipse.osgi.services, source features, explicit EMF/ECF product features and missing Babel fragments. - dom4j from Orbit (org.dom4j 2.2.0) instead of the ServiceMix bundle, whose javax.xml.stream [1.0,2) import no longer resolves cleanly. - slf4j-api 1.7.36 is published locally (LDAP API and ApacheDS import [1.7,1.8), Eclipse ships 2.x); slf4j-nop only satisfies org.slf4j.impl while the target is resolved. - commons-logging 1.2 is published locally for httpclient. Libraries: commons-codec 1.23.0, collections4 4.6.0, io 2.22.0, lang3 3.22.0, pool2 2.13.1, text 1.15.0, httpclient 4.5.14, httpcore 4.4.16, BouncyCastle 1.87 (jdk18on + bcutil), Caffeine 2.9.3, MINA 2.1.15, slf4j 1.7.36, JUnit 5.14.4 / Platform 1.14.4, hamcrest 3.0.0, skin 1.0.3. LDAP API stays on 2.1.0 and MINA on 2.1.x: ApacheDS 2.0.0.AM26 uses SslFilter.DISABLE_ENCRYPTION_ONCE (removed in MINA 2.2) and LDAP API 2.1.1+ requires MINA 2.2. ApacheDS 2.0.0.AM27 cannot be used because several of its bundles miss an Import-Package for org.apache.directory.api.ldap.model.schema.registries. Code: replace the removed IPageLayout.ID_RES_NAV and setShowFastViewBars APIs. BREAKING CHANGE: building and running Directory Studio requires Java 21. Co-Authored-By: Claude Opus 5.5 --- .gitignore | 1 + README.md | 4 +- eclipse-trgt-platform/pom-first.xml | 94 ++++++++++++++----- ...tory.studio.eclipse-trgt-platform.template | 54 +++++------ features/nls.feature/feature.xml | 65 ------------- features/rcp.feature/feature.xml | 32 +------ plugins/ldapbrowser.core/pom-first.xml | 2 +- .../studio/ldifeditor/editor/LdifEditor.java | 2 +- .../ApplicationWorkbenchWindowAdvisor.java | 1 - plugins/slf4j-eclipselog/pom-first.xml | 4 +- plugins/valueeditors/pom-first.xml | 2 +- pom.xml | 76 ++++++++------- product/org.apache.directory.studio.product | 10 +- tests/test.integration.core/pom-first.xml | 11 +-- tests/test.integration.ui/pom-first.xml | 17 ++-- 15 files changed, 165 insertions(+), 210 deletions(-) diff --git a/.gitignore b/.gitignore index e875c867c0..6cc978686d 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ .settings .pmd target/ +.tycho-consumer-pom.xml META-INF/ eclipse-trgt-platform/org.apache.directory.studio.eclipse-trgt-platform.target plugins/ldapbrowser.core/lib/ diff --git a/README.md b/README.md index fcbc8c8237..89f6288d51 100644 --- a/README.md +++ b/README.md @@ -29,8 +29,8 @@ Apache Directory Studio is a complete directory tooling platform intended to be ### Prerequisites -* JDK 11 or newer -* Maven 3 or newer +* JDK 21 or newer +* Maven 3.9.9 or newer * Sufficient heap space for Maven: `export MAVEN_OPTS="-Xmx512m"` ### Build diff --git a/eclipse-trgt-platform/pom-first.xml b/eclipse-trgt-platform/pom-first.xml index 2ae081ef4a..0c212ebbac 100644 --- a/eclipse-trgt-platform/pom-first.xml +++ b/eclipse-trgt-platform/pom-first.xml @@ -30,17 +30,38 @@ org.apache.directory.studio.eclipse-trgt-platform Apache Directory Studio Target Platform for Eclipse - eclipse-target-definition + pom - + org.slf4j slf4j-api ${org.slf4j.version} - provided + + + + + org.slf4j + slf4j-nop + ${org.slf4j.version} + + + + + commons-logging + commons-logging + ${commons-logging.version} @@ -83,16 +104,29 @@ org.bouncycastle - bcprov-jdk15on + bcprov-jdk18on + ${org.bouncycastle.version} + + + + org.bouncycastle + bcpkix-jdk18on ${org.bouncycastle.version} org.bouncycastle - bcpkix-jdk15on + bcutil-jdk18on ${org.bouncycastle.version} + + + org.apache.servicemix.bundles + org.apache.servicemix.bundles.antlr + ${org.apache.servicemix.bundles.antlr.version} + + org.apache.mina @@ -512,6 +546,11 @@ ${project.basedir}/target/source/plugins provided + + org.apache.servicemix.bundles.dom4j @@ -557,26 +596,6 @@ - - org.codehaus.gmaven - groovy-maven-plugin - 2.1.1 - - - set-basedir-uri - validate - - execute - - - -project.properties['basedirUri']=project.basedir.toURI().toString(); - - - - - - maven-resources-plugin @@ -620,6 +639,31 @@ project.properties['basedirUri']=project.basedir.toURI().toString(); + + + org.codehaus.mojo + build-helper-maven-plugin + + + attach-target-definition + package + + attach-artifact + + + + + ${basedir}/org.apache.directory.studio.eclipse-trgt-platform.target + target + + + + + + + maven-clean-plugin diff --git a/eclipse-trgt-platform/template/org.apache.directory.studio.eclipse-trgt-platform.template b/eclipse-trgt-platform/template/org.apache.directory.studio.eclipse-trgt-platform.template index c6251b1593..4cbe2570ee 100644 --- a/eclipse-trgt-platform/template/org.apache.directory.studio.eclipse-trgt-platform.template +++ b/eclipse-trgt-platform/template/org.apache.directory.studio.eclipse-trgt-platform.template @@ -24,11 +24,14 @@ - - + + + - + + + @@ -36,10 +39,10 @@ - + - + @@ -107,43 +110,38 @@ - + + - - - - - - - - - - - + + + + + + + - - - - + + + + + - - - - - - + + + - + diff --git a/features/nls.feature/feature.xml b/features/nls.feature/feature.xml index ea9c29ce76..fec98e4d6a 100644 --- a/features/nls.feature/feature.xml +++ b/features/nls.feature/feature.xml @@ -274,7 +274,6 @@ http://www.apache.org/licenses/ - @@ -817,22 +816,6 @@ http://www.apache.org/licenses/ fragment="true" unpack="false"/> - - - - - - - - - - - - - - - - - - - - - - diff --git a/plugins/ldapbrowser.core/pom-first.xml b/plugins/ldapbrowser.core/pom-first.xml index b279dad193..5e4f587140 100644 --- a/plugins/ldapbrowser.core/pom-first.xml +++ b/plugins/ldapbrowser.core/pom-first.xml @@ -128,7 +128,7 @@ - org.apache.commons.commons-text, + org.apache.commons.text, org.apache.directory.api.asn1.api;bundle-version="${org.apache.directory.api.bundleversion}", org.apache.directory.api.ldap.model;bundle-version="${org.apache.directory.api.bundleversion}", org.apache.directory.api.ldap.codec.core;bundle-version="${org.apache.directory.api.bundleversion}", diff --git a/plugins/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/LdifEditor.java b/plugins/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/LdifEditor.java index aa3ec6477d..4938cfc904 100644 --- a/plugins/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/LdifEditor.java +++ b/plugins/ldifeditor/src/main/java/org/apache/directory/studio/ldifeditor/editor/LdifEditor.java @@ -286,7 +286,7 @@ public Object getAdapter( Class required ) public String[] getShowInTargetIds() { return new String[] - { IPageLayout.ID_RES_NAV }; + { IPageLayout.ID_PROJECT_EXPLORER }; } }; } diff --git a/plugins/rcp/src/main/java/org/apache/directory/studio/ApplicationWorkbenchWindowAdvisor.java b/plugins/rcp/src/main/java/org/apache/directory/studio/ApplicationWorkbenchWindowAdvisor.java index 736c2c012a..8879d7ac73 100644 --- a/plugins/rcp/src/main/java/org/apache/directory/studio/ApplicationWorkbenchWindowAdvisor.java +++ b/plugins/rcp/src/main/java/org/apache/directory/studio/ApplicationWorkbenchWindowAdvisor.java @@ -133,7 +133,6 @@ public void preWindowOpen() configurer.setShowStatusLine( false ); configurer.setShowPerspectiveBar( true ); configurer.setShowProgressIndicator( true ); - configurer.setShowFastViewBars( true ); // hopk up the listeners to update the window title // adapted from org.eclipse.ui.internal.ide.application.IDEWorkbenchWindowAdvisor diff --git a/plugins/slf4j-eclipselog/pom-first.xml b/plugins/slf4j-eclipselog/pom-first.xml index 10bd19745b..59fa61fa6e 100644 --- a/plugins/slf4j-eclipselog/pom-first.xml +++ b/plugins/slf4j-eclipselog/pom-first.xml @@ -46,7 +46,7 @@ ${project.artifactId};singleton:=true plugin - org.slf4j.api + slf4j.api;bundle-version="[1.7,1.8)" org.slf4j.impl @@ -54,7 +54,7 @@ - org.slf4j.api, + slf4j.api;bundle-version="[1.7,1.8)", org.eclipse.core.runtime diff --git a/plugins/valueeditors/pom-first.xml b/plugins/valueeditors/pom-first.xml index f4e60c4223..9b918262ba 100644 --- a/plugins/valueeditors/pom-first.xml +++ b/plugins/valueeditors/pom-first.xml @@ -69,7 +69,7 @@ - org.apache.commons.commons-text, + org.apache.commons.text, org.apache.directory.api.ldap.model;bundle-version="${org.apache.directory.api.bundleversion}", org.apache.directory.api.util;bundle-version="${org.apache.directory.api.bundleversion}", org.apache.directory.studio.common.ui, diff --git a/pom.xml b/pom.xml index e5d5c34b8a..292f718d6a 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,7 @@ org.apache.directory.project project - 48 + 52 @@ -66,54 +66,64 @@ none - 1.8 - 1.8 + 21 - 2.3.0 + 5.0.4 2.7.7 2.7.7 - 1.10.2 - 5.10.2 + 2.7.7_5 + 5.14.4 + 1.14.4 1.2.17 1.2.17 - 2.7.0 - 2.7.0 - 4.5.12 - 4.5.12 - 4.4.13 - 4.4.13 - 1.15 - 1.15.0 - 4.4 - 4.4.0 - 2.6 - 2.6.0 - 3.12.0 - 3.12.0 - 2.9.0 - 2.9.0 - 1.9 - 1.9 + 2.9.3 + 2.9.3 + 4.5.14 + 4.5.14 + 4.4.16 + 4.4.16 + + 1.2 + 1.2.0 + 1.23.0 + 1.23.0 + 4.6.0 + 4.6.0 + 2.22.0 + 2.22.0 + 3.22.0 + 3.22.0 + 2.13.1 + 2.13.1 + 1.15.0 + 1.15.0 + 2.1.0 2.1.0 2.0.0.AM26 - 2.1.10 - 2.1.10 + 2.1.15 + 2.1.15 5.2.5 5.2.5 2.9 - 1.62 - 1.7.25 - 1.7.25 + 1.87 + 1.7.36 + 1.7.36 1.1.4.c 1.1.4.c 2.11.0 2.11.0 - 1.0.2 + 1.0.3 @@ -139,8 +149,7 @@ org.eclipse.tycho tycho-compiler-plugin - 11 - 11 + 21 @@ -223,8 +232,7 @@ org.apache.maven.plugins maven-compiler-plugin - 1.8 - 1.8 + 21 diff --git a/product/org.apache.directory.studio.product b/product/org.apache.directory.studio.product index 18bf10b3ce..eed52e8027 100644 --- a/product/org.apache.directory.studio.product +++ b/product/org.apache.directory.studio.product @@ -24,9 +24,9 @@ #Uncomment_to_configure_Java_version_to_use #https://directory.apache.org/studio/faqs.html#how-to-set-the-java-vm-to-use #-vm -#/usr/lib/jvm/java-11-openjdk/bin/java +#/usr/lib/jvm/java-21-openjdk/bin/java - -Dosgi.requiredJavaVersion=11 + -Dosgi.requiredJavaVersion=21 ### #Uncomment_to_configure_heap_memory #https://directory.apache.org/studio/faqs.html#how-to-increase-the-heap-memory @@ -250,19 +250,13 @@ http://www.apache.org/licenses/ - - - - - - diff --git a/tests/test.integration.core/pom-first.xml b/tests/test.integration.core/pom-first.xml index 271d18e7f1..b7bee2c577 100644 --- a/tests/test.integration.core/pom-first.xml +++ b/tests/test.integration.core/pom-first.xml @@ -49,10 +49,10 @@ org.apache.directory.studio.test.integration.junit5 - org.hamcrest.library;bundle-version="1.3.0", - org.junit.jupiter.api;bundle-version="5.7.0", - org.junit.jupiter.params;bundle-version="5.7.0", - org.opentest4j;bundle-version="1.2.0", + org.hamcrest;bundle-version="3.0.0", + junit-jupiter-api;bundle-version="[5.14.0,6.0.0)", + junit-jupiter-params;bundle-version="[5.14.0,6.0.0)", + org.opentest4j;bundle-version="1.3.0", org.apache.directory.server.apacheds-test-framework;bundle-version="${org.apache.directory.server.version}", org.apache.directory.server.annotations;bundle-version="${org.apache.directory.server.version}", @@ -81,8 +81,7 @@ org.apache.directory.studio.ldapbrowser.core, org.apache.directory.studio.ldifparser, org.eclipse.core.runtime, - org.eclipse.ui, - javax.annotation + org.eclipse.ui org.apache.commons.codec.digest, org.apache.commons.lang3, diff --git a/tests/test.integration.ui/pom-first.xml b/tests/test.integration.ui/pom-first.xml index 9e9159380e..0d8d7e0449 100644 --- a/tests/test.integration.ui/pom-first.xml +++ b/tests/test.integration.ui/pom-first.xml @@ -47,14 +47,14 @@ true org.apache.directory.studio.test.integration.ui.Activator - org.junit.jupiter.api;bundle-version="5.7.0", - org.junit.jupiter.params;bundle-version="5.7.0", - org.opentest4j;bundle-version="1.2.0", - org.hamcrest.library;bundle-version="1.3.0", - org.eclipse.swtbot.eclipse.finder;bundle-version="3.0.0", - org.eclipse.swtbot.eclipse.core;bundle-version="3.0.0", - org.eclipse.swtbot.forms.finder;bundle-version="3.0.0", - org.eclipse.swtbot.junit5_x;bundle-version="3.0.0", + junit-jupiter-api;bundle-version="[5.14.0,6.0.0)", + junit-jupiter-params;bundle-version="[5.14.0,6.0.0)", + org.opentest4j;bundle-version="1.3.0", + org.hamcrest;bundle-version="3.0.0", + org.eclipse.swtbot.eclipse.finder;bundle-version="4.3.0", + org.eclipse.swtbot.eclipse.core;bundle-version="4.3.0", + org.eclipse.swtbot.forms.finder;bundle-version="4.3.0", + org.eclipse.swtbot.junit5_x;bundle-version="4.3.0", org.apache.directory.server.apacheds-test-framework;bundle-version="${org.apache.directory.server.version}", org.apache.directory.server.annotations;bundle-version="${org.apache.directory.server.version}", @@ -110,7 +110,6 @@ org.apache.commons.lang3, org.apache.commons.codec.digest, org.apache.http.conn.ssl, - org.apache.log4j, org.bouncycastle.asn1, org.bouncycastle.asn1.x509, org.bouncycastle.jce.provider, From 8c0e82cca080383d1d8edc9c4de2d8e097dc7bce Mon Sep 17 00:00:00 2001 From: Jan Opravil Date: Wed, 25 Nov 2026 19:01:58 +0100 Subject: [PATCH 03/12] build(deps): upgrade POI, xerces, FOP and xalan - POI 3.9 -> 6.0.0 for the XLS export. POI 5+ needs commons-math3, SparseBitSet and log4j-api, which are embedded next to it, and commons-io, commons-codec and commons-collections4 packages, which are imported. ExportXlsRunnable uses CellType instead of the removed CELL_TYPE_* constants. The embedded jar names now come from the version properties. - xerces 2.11.0 -> 2.12.2 (embedded in ldapbrowser.core). - FOP and xmlgraphics-commons 2.9 -> 2.12, xalan 2.7.2 -> 2.7.3 plus its serializer, which is a separate artifact since 2.7.3, and ant-apache-regexp 1.10.14 -> 1.10.18 for the help and user guide generation. odftoolkit stays on 0.8.8 / 0.7: odfdom 0.13 pulls about 20 additional jars and should be a separate change. Co-Authored-By: Claude Opus 5.5 --- helps/pom.xml | 2 +- plugins/ldapbrowser.core/pom-first.xml | 36 ++++++++++++++++--- plugins/ldapbrowser.core/pom.xml | 17 ++++++++- .../core/jobs/ExportXlsRunnable.java | 8 ++--- pom.xml | 25 +++++++++---- 5 files changed, 69 insertions(+), 19 deletions(-) diff --git a/helps/pom.xml b/helps/pom.xml index 353ad0c14c..816b8345b2 100644 --- a/helps/pom.xml +++ b/helps/pom.xml @@ -174,7 +174,7 @@ org.apache.xmlgraphics xmlgraphics-commons - 2.9 + ${org.apache.xmlgraphics.fop.version} compile diff --git a/plugins/ldapbrowser.core/pom-first.xml b/plugins/ldapbrowser.core/pom-first.xml index 5e4f587140..3fe3a34c45 100644 --- a/plugins/ldapbrowser.core/pom-first.xml +++ b/plugins/ldapbrowser.core/pom-first.xml @@ -64,7 +64,22 @@ org.apache.poi poi - 3.9 + ${org.apache.poi.version} + + + org.apache.commons + commons-math3 + ${org.apache.commons.math3.version} + + + com.zaxxer + SparseBitSet + ${com.zaxxer.sparsebitset.version} + + + org.apache.logging.log4j + log4j-api + ${org.apache.logging.log4j.version} org.apache.odftoolkit @@ -79,7 +94,7 @@ xerces xercesImpl - 2.11.0 + ${xerces.xercesimpl.version} xml-apis @@ -121,7 +136,15 @@ org.apache.commons.text, org.apache.commons.lang3, org.apache.commons.collections4, + org.apache.commons.collections4.bidimap, + org.apache.commons.collections4.iterators, + org.apache.commons.codec, org.apache.commons.codec.digest, + org.apache.commons.io, + org.apache.commons.io.build, + org.apache.commons.io.function, + org.apache.commons.io.input, + org.apache.commons.io.output, org.dom4j, org.dom4j.io, org.xmlpull.v1 @@ -142,10 +165,13 @@ lib - lib/poi-3.9.jar;g="org.apache.poi";a="poi";v="3.9" + lib/poi-${org.apache.poi.version}.jar;g="org.apache.poi";a="poi";v="${org.apache.poi.version}" ., - lib/poi-3.9.jar, - lib/xercesImpl-2.11.0.jar, + lib/poi-${org.apache.poi.version}.jar, + lib/commons-math3-${org.apache.commons.math3.version}.jar, + lib/SparseBitSet-${com.zaxxer.sparsebitset.version}.jar, + lib/log4j-api-${org.apache.logging.log4j.version}.jar, + lib/xercesImpl-${xerces.xercesimpl.version}.jar, lib/xml-apis-1.4.01.jar, lib/odfdom-java-0.8.8-incubating.jar, lib/simple-odf-0.7-incubating.jar diff --git a/plugins/ldapbrowser.core/pom.xml b/plugins/ldapbrowser.core/pom.xml index e04519dd37..7c85fd8dce 100644 --- a/plugins/ldapbrowser.core/pom.xml +++ b/plugins/ldapbrowser.core/pom.xml @@ -51,7 +51,22 @@ org.apache.poi poi - 3.9 + ${org.apache.poi.version} + + + org.apache.commons + commons-math3 + ${org.apache.commons.math3.version} + + + com.zaxxer + SparseBitSet + ${com.zaxxer.sparsebitset.version} + + + org.apache.logging.log4j + log4j-api + ${org.apache.logging.log4j.version} diff --git a/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ExportXlsRunnable.java b/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ExportXlsRunnable.java index 3bfaafc6a7..3b74b8f82b 100644 --- a/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ExportXlsRunnable.java +++ b/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/jobs/ExportXlsRunnable.java @@ -48,7 +48,7 @@ import org.apache.poi.hssf.usermodel.HSSFRow; import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFWorkbook; -import org.apache.poi.ss.usermodel.Cell; +import org.apache.poi.ss.usermodel.CellType; import org.apache.poi.ss.usermodel.CellStyle; import org.eclipse.core.runtime.Preferences; @@ -186,7 +186,7 @@ public void run( StudioProgressMonitor monitor ) for ( short j = 0; row != null && j <= row.getLastCellNum(); j++ ) { HSSFCell cell = row.getCell( j ); - if ( cell != null && cell.getCellType() == HSSFCell.CELL_TYPE_STRING ) + if ( cell != null && cell.getCellType() == CellType.STRING ) { String value = cell.getStringCellValue(); @@ -330,9 +330,7 @@ private static void recordToHSSFRow( IBrowserConnection browserConnection, LdifC private static HSSFCell createStringCell( HSSFRow row, int cellNum ) { - HSSFCell cell = row.createCell( cellNum ); - cell.setCellType( Cell.CELL_TYPE_STRING ); - return cell; + return row.createCell( cellNum, CellType.STRING ); } } diff --git a/pom.xml b/pom.xml index 292f718d6a..90f515405b 100644 --- a/pom.xml +++ b/pom.xml @@ -111,16 +111,19 @@ 2.0.0.AM26 2.1.15 2.1.15 - 5.2.5 - 5.2.5 - 2.9 + 6.0.0 + 6.0.0 + 3.6.1 + 1.3 + 2.26.1 + 2.12 1.87 1.7.36 1.7.36 1.1.4.c 1.1.4.c - 2.11.0 - 2.11.0 + 2.12.2 + 2.12.2 1.0.3 @@ -243,14 +246,22 @@ org.apache.ant ant-apache-regexp - 1.10.14 + 1.10.18 compile xalan xalan - 2.7.2 + 2.7.3 + compile + + + + + xalan + serializer + 2.7.3 compile From 895c49a13cc422c97d7d1767c3edadb7abbbbf8f Mon Sep 17 00:00:00 2001 From: Jan Opravil Date: Wed, 25 Nov 2026 19:02:07 +0100 Subject: [PATCH 04/12] ci: build with JDK 21 and 25 and update the actions The build requires Java 21, so the GitHub workflows now build with JDK 21 and 25 (the JDK 11 workflow is removed, the JDK 17 one becomes JDK 25) and the Jenkins stages run on Java 21 only. Update actions/checkout to v7.0.1, actions/setup-java to v6.3.0, actions/upload-artifact to v7.0.2, github/codeql-action to v4.39.5 and ossf/scorecard-action to v2.6.0, keeping each workflow's existing pinning style (SHA in the build and Scorecard workflows, version tags in CodeQL). CodeQL now sets up JDK 21 explicitly instead of relying on the runner's default JDK. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/codeql-analysis.yml | 13 ++++-- .../pull-request-build-openjdk11.yml | 44 ------------------- .../pull-request-build-openjdk21.yml | 4 +- ...7.yml => pull-request-build-openjdk25.yml} | 8 ++-- .github/workflows/scorecards.yml | 8 ++-- Jenkinsfile | 31 +++---------- 6 files changed, 25 insertions(+), 83 deletions(-) delete mode 100644 .github/workflows/pull-request-build-openjdk11.yml rename .github/workflows/{pull-request-build-openjdk17.yml => pull-request-build-openjdk25.yml} (84%) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index ddb99cc541..caff91b480 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -39,11 +39,18 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v4.1.1 + uses: actions/checkout@v7.0.1 + + - name: Set up the JDK + uses: actions/setup-java@v6.3.0 + with: + java-version: '21' + distribution: 'temurin' + cache: maven # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@v3 + uses: github/codeql-action/init@v4.39.5 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -68,4 +75,4 @@ jobs: mvn clean install - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v3 + uses: github/codeql-action/analyze@v4.39.5 diff --git a/.github/workflows/pull-request-build-openjdk11.yml b/.github/workflows/pull-request-build-openjdk11.yml deleted file mode 100644 index c4c07215ee..0000000000 --- a/.github/workflows/pull-request-build-openjdk11.yml +++ /dev/null @@ -1,44 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -name: "Build with OpenJDK 11" - -on: - pull_request: - branches: ['master'] - -permissions: - contents: read - -jobs: - build: - runs-on: ubuntu-latest - permissions: - contents: read - pull-requests: read - timeout-minutes: 130 - steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - name: Set up JDK 11 - uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1 - with: - java-version: '11' - distribution: 'temurin' - cache: maven - - name: Build with Apache Maven - run: mvn -f pom-first.xml -U clean install && mvn clean install - env: - MAVEN_OPTS: "-Xmx1024M" - diff --git a/.github/workflows/pull-request-build-openjdk21.yml b/.github/workflows/pull-request-build-openjdk21.yml index 22034ad82d..bb34be0cde 100644 --- a/.github/workflows/pull-request-build-openjdk21.yml +++ b/.github/workflows/pull-request-build-openjdk21.yml @@ -30,9 +30,9 @@ jobs: pull-requests: read timeout-minutes: 130 steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: Set up the JDK - uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1 + uses: actions/setup-java@d1374f8ac74474200d16ef8ecee22c7ae7a51880 # v6.3.0 with: java-version: '21' distribution: 'temurin' diff --git a/.github/workflows/pull-request-build-openjdk17.yml b/.github/workflows/pull-request-build-openjdk25.yml similarity index 84% rename from .github/workflows/pull-request-build-openjdk17.yml rename to .github/workflows/pull-request-build-openjdk25.yml index cf60155ff8..5f7fb4513a 100644 --- a/.github/workflows/pull-request-build-openjdk17.yml +++ b/.github/workflows/pull-request-build-openjdk25.yml @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -name: "Build with OpenJDK 17" +name: "Build with OpenJDK 25" on: pull_request: @@ -30,11 +30,11 @@ jobs: pull-requests: read timeout-minutes: 130 steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: Set up the JDK - uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1 + uses: actions/setup-java@d1374f8ac74474200d16ef8ecee22c7ae7a51880 # v6.3.0 with: - java-version: '17' + java-version: '25' distribution: 'temurin' cache: maven - name: Build with Apache Maven diff --git a/.github/workflows/scorecards.yml b/.github/workflows/scorecards.yml index 054cef6736..e8e61eca10 100644 --- a/.github/workflows/scorecards.yml +++ b/.github/workflows/scorecards.yml @@ -40,12 +40,12 @@ jobs: steps: - name: "Checkout code" - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # tag=v3.0.0 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - name: "Run analysis" - uses: ossf/scorecard-action@0864cf19026789058feabb7e87baa5f140aac736 #tag=2.3.1 + uses: ossf/scorecard-action@23f22cd43608bae7a1f1fa2603d7314dee9538a5 # v2.6.0 with: results_file: results.sarif results_format: sarif @@ -64,7 +64,7 @@ jobs: # Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF # format to the repository Actions tab. - name: "Upload artifact" - uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # tag=v4.3.1 + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 with: name: SARIF file path: results.sarif @@ -72,6 +72,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@cdcdbb579706841c47f7063dda365e292e5cad7a #tag=v2 + uses: github/codeql-action/upload-sarif@915412ff23e8b7659517e607487dbeae018f2934 # v4.39.5 with: sarif_file: results.sarif diff --git a/Jenkinsfile b/Jenkinsfile index 036182f87e..39acaadbd8 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -37,7 +37,7 @@ pipeline { } steps { script { - inTestLab('jdk-11', { sh 'export DISPLAY=:99; env; ps aux' }) + inTestLab('jdk-21', { sh 'export DISPLAY=:99; env; ps aux' }) } } post { @@ -48,7 +48,7 @@ pipeline { } stage ('Build and Test') { parallel { - stage ('Linux Java 11') { + stage ('Linux Java 21') { options { timeout(time: 4, unit: 'HOURS') retry(2) @@ -58,7 +58,7 @@ pipeline { } steps { script { - inTestLab('jdk-11', { sh 'export DISPLAY=:99; mvn -V -U -f pom-first.xml clean install && mvn -V clean install -Dorg.eclipse.swtbot.search.timeout=20000 -Denable-ui-tests' }) + inTestLab('jdk-21', { sh 'export DISPLAY=:99; mvn -V -U -f pom-first.xml clean install && mvn -V clean install -Dorg.eclipse.swtbot.search.timeout=20000 -Denable-ui-tests' }) } } post { @@ -69,28 +69,7 @@ pipeline { } } } - stage ('Linux Java 17') { - options { - timeout(time: 4, unit: 'HOURS') - retry(2) - } - agent { - label 'ubuntu' - } - steps { - script { - inTestLab('jdk-17', { sh 'export DISPLAY=:99; mvn -V -U -f pom-first.xml clean install && mvn -V clean install -Dorg.eclipse.swtbot.search.timeout=20000 -Denable-ui-tests' }) - } - } - post { - always { - junit '**/target/surefire-reports/*.xml' - archiveArtifacts artifacts:'tests/test.integration.ui/screenshots/*', allowEmptyArchive:true - deleteDir() - } - } - } - stage ('Windows Java 11') { + stage ('Windows Java 21') { options { timeout(time: 4, unit: 'HOURS') retry(2) @@ -101,7 +80,7 @@ pipeline { steps { bat ''' rmdir /S /Q F:\\hudson\\m2_repository\\p2\\osgi\\bundle\\org.apache.directory.api.ldap.model - set JAVA_HOME=F:\\jenkins\\tools\\java\\latest11 + set JAVA_HOME=F:\\jenkins\\tools\\java\\latest21 set MAVEN_OPTS="-Xmx512m" call F:\\jenkins\\tools\\maven\\latest3\\bin\\mvn -V -U -f pom-first.xml clean install call F:\\jenkins\\tools\\maven\\latest3\\bin\\mvn -V clean install -Dorg.eclipse.swtbot.search.timeout=20000 -Denable-ui-tests From 94ad9b363c1987459c188cd7d51ecc9b58febfb5 Mon Sep 17 00:00:00 2001 From: Jan Opravil Date: Thu, 26 Nov 2026 08:55:58 +0100 Subject: [PATCH 05/12] fix(ldapservers): restore the "LDAP Servers" view name Commit 9f40267d6 (German translation improvements) replaced the hard-coded view and category name "LDAP Servers" with %View_ServersView_name, which is "Servers" in plugin.properties. That renamed the view and its Show View category in the English UI, and the UI tests no longer found the "LDAP Servers" view. Set the English view name back to "LDAP Servers" and use the existing View_Category_name key for the category. The German names are kept. Co-Authored-By: Claude Opus 5.5 --- plugins/ldapservers/plugin.properties | 2 +- plugins/ldapservers/plugin.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/ldapservers/plugin.properties b/plugins/ldapservers/plugin.properties index 843ecb4a15..e8dbc8feaf 100644 --- a/plugins/ldapservers/plugin.properties +++ b/plugins/ldapservers/plugin.properties @@ -33,7 +33,7 @@ Ctx_ServersView_id=org.apache.directory.studio.ldapservers.contexts.serversView= # The I18n Strings #--------------------------------------------------------------------------------------------------- View_Category_name=LDAP Servers -View_ServersView_name=Servers +View_ServersView_name=LDAP Servers Prop_ServerPropertyPage_name=Info diff --git a/plugins/ldapservers/plugin.xml b/plugins/ldapservers/plugin.xml index 98f86a7f17..d7ac92247e 100644 --- a/plugins/ldapservers/plugin.xml +++ b/plugins/ldapservers/plugin.xml @@ -25,7 +25,7 @@ point="org.eclipse.ui.views"> + name="%View_Category_name" /> Date: Thu, 26 Nov 2026 08:55:59 +0100 Subject: [PATCH 06/12] fix: import org.slf4j [1.7,1.8) in the template and ACL editors The product now contains two slf4j.api bundles: 1.7.36 for the LDAP API and ApacheDS, and 2.x from the Eclipse platform. The template editor and the OpenLDAP ACL editor imported org.slf4j without a version, so they could be wired to slf4j 2.x and bypass the slf4j-eclipselog binding. Use the same range as the LDAP API. Co-Authored-By: Claude Opus 5.5 --- plugins/openldap.acl.editor/pom-first.xml | 2 +- plugins/templateeditor/pom-first.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/openldap.acl.editor/pom-first.xml b/plugins/openldap.acl.editor/pom-first.xml index 231935c64e..13f3dc784a 100644 --- a/plugins/openldap.acl.editor/pom-first.xml +++ b/plugins/openldap.acl.editor/pom-first.xml @@ -106,7 +106,7 @@ antlr, antlr.collections, antlr.collections.impl, - org.slf4j + org.slf4j;version="[1.7,1.8)" org.apache.directory.api.ldap.model;bundle-version="${org.apache.directory.api.bundleversion}", diff --git a/plugins/templateeditor/pom-first.xml b/plugins/templateeditor/pom-first.xml index e33be2da8d..72484fd57b 100644 --- a/plugins/templateeditor/pom-first.xml +++ b/plugins/templateeditor/pom-first.xml @@ -63,7 +63,7 @@ org.apache.commons.collections4.multimap, org.dom4j, org.dom4j.io, - org.slf4j + org.slf4j;version="[1.7,1.8)" From 19663f332bc26482c63b94805421c57930b41320 Mon Sep 17 00:00:00 2001 From: Jan Opravil Date: Thu, 26 Nov 2026 08:56:18 +0100 Subject: [PATCH 07/12] build: publish org.dom4j and keep slf4j-nop out of the update site Two problems in the dependencies update site (p2repositories/dependencies), which mirrors the local target platform repository: - org.dom4j comes from Eclipse Orbit and was missing from the update site, so installing the LDAP Browser into an Eclipse IDE failed on the org.dom4j import. Mirror that one IU from Orbit as well. - slf4j-nop, needed only to resolve the target platform, was published, so p2 could pick it as the org.slf4j.impl provider and drop all LDAP API logging. Publish it into a separate resolution-only repository that is not mirrored. Also define the versions that were written twice (dom4j, ServiceMix ANTLR, JUnit, the Orbit URL) once as properties, and note in the rcp feature that its slf4j.api version must match org.slf4j.bundleversion. Co-Authored-By: Claude Opus 5.5 --- eclipse-trgt-platform/pom-first.xml | 28 +++++++++++++++++-- ...tory.studio.eclipse-trgt-platform.template | 12 ++++---- features/rcp.feature/feature.xml | 2 ++ p2repositories/dependencies/pom.xml | 24 ++++++++++++++++ pom.xml | 4 +++ 5 files changed, 63 insertions(+), 7 deletions(-) diff --git a/eclipse-trgt-platform/pom-first.xml b/eclipse-trgt-platform/pom-first.xml index 0c212ebbac..88bed57633 100644 --- a/eclipse-trgt-platform/pom-first.xml +++ b/eclipse-trgt-platform/pom-first.xml @@ -49,7 +49,8 @@ slf4j-api 1.7.x requires the org.slf4j.impl package. At runtime it is provided by the org.apache.directory.studio.slf4j-eclipselog fragment, which is built in the reactor and therefore not available while the target platform is resolved. slf4j-nop only satisfies that requirement - during target resolution; it is not part of any feature. + during target resolution: it is published into target/resolution-repository, which is not + mirrored into the dependencies update site, and it is not part of any feature. --> org.slf4j @@ -550,7 +551,18 @@ The ServiceMix dom4j bundle imports javax.xml.stream in range [1.0,2.0), which the JRE exports without a version. The org.dom4j bundle from Eclipse Orbit is used instead. --> - org.apache.servicemix.bundles.dom4j + org.apache.servicemix.bundles.dom4j,slf4j-nop + + + + copy-bundles-for-resolution-only + process-resources + + copy-dependencies + + + ${project.basedir}/target/resolution-source/plugins + slf4j-nop @@ -568,6 +580,18 @@ publish-features-and-bundles + + publish-bundles-for-resolution-only + prepare-package + + publish-features-and-bundles + + + ${project.build.directory}/resolution-source + ${project.build.directory}/resolution-repository + ${project.build.directory}/resolution-repository + + false diff --git a/eclipse-trgt-platform/template/org.apache.directory.studio.eclipse-trgt-platform.template b/eclipse-trgt-platform/template/org.apache.directory.studio.eclipse-trgt-platform.template index 4cbe2570ee..5a599358f0 100644 --- a/eclipse-trgt-platform/template/org.apache.directory.studio.eclipse-trgt-platform.template +++ b/eclipse-trgt-platform/template/org.apache.directory.studio.eclipse-trgt-platform.template @@ -27,8 +27,8 @@ - - + + @@ -111,7 +111,9 @@ - + + + @@ -125,8 +127,8 @@ - - + + diff --git a/features/rcp.feature/feature.xml b/features/rcp.feature/feature.xml index ab0028ef9e..0a4c6a5c2b 100644 --- a/features/rcp.feature/feature.xml +++ b/features/rcp.feature/feature.xml @@ -526,6 +526,8 @@ http://www.apache.org/licenses/ fragment="true" unpack="false"/> + false + + + mirror-orbit-bundles + prepare-package + + mirror + + + + + ${eclipse.orbit.repository} + + + + + org.dom4j + ${org.dom4j.bundleversion} + + + true + true + false + + diff --git a/pom.xml b/pom.xml index 90f515405b..c0b6122cb1 100644 --- a/pom.xml +++ b/pom.xml @@ -74,6 +74,7 @@ 2.7.7 2.7.7 2.7.7_5 + 2.7.7.5 5.14.4 1.14.4 1.2.17 @@ -120,6 +121,9 @@ 1.87 1.7.36 1.7.36 + + 2.2.0.v20250828-1500 + https://download.eclipse.org/tools/orbit/simrel/orbit-aggregation/release/4.41.0 1.1.4.c 1.1.4.c 2.12.2 From 6b69719c250f7e2ccb3634ccf2fc681606527723 Mon Sep 17 00:00:00 2001 From: Jan Opravil Date: Thu, 26 Nov 2026 08:56:35 +0100 Subject: [PATCH 08/12] build: add the Maven Wrapper pinned to Maven 3.9.16 Tycho 5 needs Maven 3.9.9 or newer, but not 3.10: Maven 3.10.x (Resolver 2.0) fails to resolve the bundles' dependencies with "Invalid Collect Request: null". The build environments have neither: the Jenkins image apachedirectory/maven-build:jdk-21 ships Maven 3.9.6 and GitHub's Ubuntu runners ship Maven 3.10.1. Add the Maven Wrapper (only-script, with the distribution's SHA-256 checksum) and use it in Jenkins, the CodeQL workflow, build.sh, build.bat and the build instructions. The testlab instructions now use the jdk-21 image. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/codeql-analysis.yml | 4 +- .mvn/wrapper/maven-wrapper.properties | 22 ++ Jenkinsfile | 6 +- README.md | 6 +- build.bat | 4 +- build.sh | 2 +- mvnw | 295 ++++++++++++++++++++++++++ mvnw.cmd | 189 +++++++++++++++++ tools/testlab/README.md | 2 +- 9 files changed, 518 insertions(+), 12 deletions(-) create mode 100644 .mvn/wrapper/maven-wrapper.properties create mode 100755 mvnw create mode 100644 mvnw.cmd diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index caff91b480..94bbdb8a00 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -71,8 +71,8 @@ jobs: # uses a compiled language - run: | - mvn -f pom-first.xml clean install - mvn clean install + ./mvnw -B -V -f pom-first.xml clean install + ./mvnw -B -V clean install - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v4.39.5 diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 0000000000..0b2043b9cb --- /dev/null +++ b/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1,22 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# Maven 3.10.x (Resolver 2.0) cannot resolve the dependencies of the Tycho 5.0.4 bundles +# ("Invalid Collect Request: null"), so the build stays on the latest Maven 3.9.x. +wrapperVersion=3.3.4 +distributionType=only-script +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.16/apache-maven-3.9.16-bin.zip +distributionSha256Sum=5af3b743dd8b876b5c45da33b676251e5f1687712644abb4ee519ca56e1d89ce diff --git a/Jenkinsfile b/Jenkinsfile index 39acaadbd8..3ac566863b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -58,7 +58,7 @@ pipeline { } steps { script { - inTestLab('jdk-21', { sh 'export DISPLAY=:99; mvn -V -U -f pom-first.xml clean install && mvn -V clean install -Dorg.eclipse.swtbot.search.timeout=20000 -Denable-ui-tests' }) + inTestLab('jdk-21', { sh 'export DISPLAY=:99; ./mvnw -V -U -f pom-first.xml clean install && ./mvnw -V clean install -Dorg.eclipse.swtbot.search.timeout=20000 -Denable-ui-tests' }) } } post { @@ -82,8 +82,8 @@ pipeline { rmdir /S /Q F:\\hudson\\m2_repository\\p2\\osgi\\bundle\\org.apache.directory.api.ldap.model set JAVA_HOME=F:\\jenkins\\tools\\java\\latest21 set MAVEN_OPTS="-Xmx512m" - call F:\\jenkins\\tools\\maven\\latest3\\bin\\mvn -V -U -f pom-first.xml clean install - call F:\\jenkins\\tools\\maven\\latest3\\bin\\mvn -V clean install -Dorg.eclipse.swtbot.search.timeout=20000 -Denable-ui-tests + call mvnw.cmd -V -U -f pom-first.xml clean install + call mvnw.cmd -V clean install -Dorg.eclipse.swtbot.search.timeout=20000 -Denable-ui-tests ''' } post { diff --git a/README.md b/README.md index 89f6288d51..3c0bf275ab 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ Apache Directory Studio is a complete directory tooling platform intended to be ### Prerequisites * JDK 21 or newer -* Maven 3.9.9 or newer +* Maven 3.9.9 or newer, or the included Maven Wrapper (`./mvnw`, `mvnw.cmd`), which downloads the pinned Maven version * Sufficient heap space for Maven: `export MAVEN_OPTS="-Xmx512m"` ### Build @@ -41,11 +41,11 @@ You can use either of those two methods to build the project : Build the 'Eclipse Target Platform' and generate MANIFEST.MF files first - mvn -f pom-first.xml clean install + ./mvnw -f pom-first.xml clean install Build the main eclipse artifacts using Tycho - mvn clean install + ./mvnw clean install #### Use the script (which runs the two previous commands) diff --git a/build.bat b/build.bat index 61024cd5e3..2a6e42c46c 100644 --- a/build.bat +++ b/build.bat @@ -20,6 +20,6 @@ REM under the License. REM This script do a full build of Studio (including the MANIFEST generation and the P2 local repository construction) -call mvn -f pom-first.xml clean install -call mvn clean install +call "%~dp0mvnw.cmd" -f pom-first.xml clean install +call "%~dp0mvnw.cmd" clean install diff --git a/build.sh b/build.sh index 698c8e80d4..330964b334 100755 --- a/build.sh +++ b/build.sh @@ -18,4 +18,4 @@ # This script do a full build of Studio (including the MANIFEST generation and the P2 local repository construction) -mvn -f pom-first.xml clean install && mvn clean install +"$(dirname "$0")/mvnw" -f pom-first.xml clean install && "$(dirname "$0")/mvnw" clean install diff --git a/mvnw b/mvnw new file mode 100755 index 0000000000..bd8896bf22 --- /dev/null +++ b/mvnw @@ -0,0 +1,295 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Apache Maven Wrapper startup batch script, version 3.3.4 +# +# Optional ENV vars +# ----------------- +# JAVA_HOME - location of a JDK home dir, required when download maven via java source +# MVNW_REPOURL - repo url base for downloading maven distribution +# MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven +# MVNW_VERBOSE - true: enable verbose log; debug: trace the mvnw script; others: silence the output +# ---------------------------------------------------------------------------- + +set -euf +[ "${MVNW_VERBOSE-}" != debug ] || set -x + +# OS specific support. +native_path() { printf %s\\n "$1"; } +case "$(uname)" in +CYGWIN* | MINGW*) + [ -z "${JAVA_HOME-}" ] || JAVA_HOME="$(cygpath --unix "$JAVA_HOME")" + native_path() { cygpath --path --windows "$1"; } + ;; +esac + +# set JAVACMD and JAVACCMD +set_java_home() { + # For Cygwin and MinGW, ensure paths are in Unix format before anything is touched + if [ -n "${JAVA_HOME-}" ]; then + if [ -x "$JAVA_HOME/jre/sh/java" ]; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACCMD="$JAVA_HOME/jre/sh/javac" + else + JAVACMD="$JAVA_HOME/bin/java" + JAVACCMD="$JAVA_HOME/bin/javac" + + if [ ! -x "$JAVACMD" ] || [ ! -x "$JAVACCMD" ]; then + echo "The JAVA_HOME environment variable is not defined correctly, so mvnw cannot run." >&2 + echo "JAVA_HOME is set to \"$JAVA_HOME\", but \"\$JAVA_HOME/bin/java\" or \"\$JAVA_HOME/bin/javac\" does not exist." >&2 + return 1 + fi + fi + else + JAVACMD="$( + 'set' +e + 'unset' -f command 2>/dev/null + 'command' -v java + )" || : + JAVACCMD="$( + 'set' +e + 'unset' -f command 2>/dev/null + 'command' -v javac + )" || : + + if [ ! -x "${JAVACMD-}" ] || [ ! -x "${JAVACCMD-}" ]; then + echo "The java/javac command does not exist in PATH nor is JAVA_HOME set, so mvnw cannot run." >&2 + return 1 + fi + fi +} + +# hash string like Java String::hashCode +hash_string() { + str="${1:-}" h=0 + while [ -n "$str" ]; do + char="${str%"${str#?}"}" + h=$(((h * 31 + $(LC_CTYPE=C printf %d "'$char")) % 4294967296)) + str="${str#?}" + done + printf %x\\n $h +} + +verbose() { :; } +[ "${MVNW_VERBOSE-}" != true ] || verbose() { printf %s\\n "${1-}"; } + +die() { + printf %s\\n "$1" >&2 + exit 1 +} + +trim() { + # MWRAPPER-139: + # Trims trailing and leading whitespace, carriage returns, tabs, and linefeeds. + # Needed for removing poorly interpreted newline sequences when running in more + # exotic environments such as mingw bash on Windows. + printf "%s" "${1}" | tr -d '[:space:]' +} + +scriptDir="$(dirname "$0")" +scriptName="$(basename "$0")" + +# parse distributionUrl and optional distributionSha256Sum, requires .mvn/wrapper/maven-wrapper.properties +while IFS="=" read -r key value; do + case "${key-}" in + distributionUrl) distributionUrl=$(trim "${value-}") ;; + distributionSha256Sum) distributionSha256Sum=$(trim "${value-}") ;; + esac +done <"$scriptDir/.mvn/wrapper/maven-wrapper.properties" +[ -n "${distributionUrl-}" ] || die "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties" + +case "${distributionUrl##*/}" in +maven-mvnd-*bin.*) + MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ + case "${PROCESSOR_ARCHITECTURE-}${PROCESSOR_ARCHITEW6432-}:$(uname -a)" in + *AMD64:CYGWIN* | *AMD64:MINGW*) distributionPlatform=windows-amd64 ;; + :Darwin*x86_64) distributionPlatform=darwin-amd64 ;; + :Darwin*arm64) distributionPlatform=darwin-aarch64 ;; + :Linux*x86_64*) distributionPlatform=linux-amd64 ;; + *) + echo "Cannot detect native platform for mvnd on $(uname)-$(uname -m), use pure java version" >&2 + distributionPlatform=linux-amd64 + ;; + esac + distributionUrl="${distributionUrl%-bin.*}-$distributionPlatform.zip" + ;; +maven-mvnd-*) MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ ;; +*) MVN_CMD="mvn${scriptName#mvnw}" _MVNW_REPO_PATTERN=/org/apache/maven/ ;; +esac + +# apply MVNW_REPOURL and calculate MAVEN_HOME +# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-,maven-mvnd--}/ +[ -z "${MVNW_REPOURL-}" ] || distributionUrl="$MVNW_REPOURL$_MVNW_REPO_PATTERN${distributionUrl#*"$_MVNW_REPO_PATTERN"}" +distributionUrlName="${distributionUrl##*/}" +distributionUrlNameMain="${distributionUrlName%.*}" +distributionUrlNameMain="${distributionUrlNameMain%-bin}" +MAVEN_USER_HOME="${MAVEN_USER_HOME:-${HOME}/.m2}" +MAVEN_HOME="${MAVEN_USER_HOME}/wrapper/dists/${distributionUrlNameMain-}/$(hash_string "$distributionUrl")" + +exec_maven() { + unset MVNW_VERBOSE MVNW_USERNAME MVNW_PASSWORD MVNW_REPOURL || : + exec "$MAVEN_HOME/bin/$MVN_CMD" "$@" || die "cannot exec $MAVEN_HOME/bin/$MVN_CMD" +} + +if [ -d "$MAVEN_HOME" ]; then + verbose "found existing MAVEN_HOME at $MAVEN_HOME" + exec_maven "$@" +fi + +case "${distributionUrl-}" in +*?-bin.zip | *?maven-mvnd-?*-?*.zip) ;; +*) die "distributionUrl is not valid, must match *-bin.zip or maven-mvnd-*.zip, but found '${distributionUrl-}'" ;; +esac + +# prepare tmp dir +if TMP_DOWNLOAD_DIR="$(mktemp -d)" && [ -d "$TMP_DOWNLOAD_DIR" ]; then + clean() { rm -rf -- "$TMP_DOWNLOAD_DIR"; } + trap clean HUP INT TERM EXIT +else + die "cannot create temp dir" +fi + +mkdir -p -- "${MAVEN_HOME%/*}" + +# Download and Install Apache Maven +verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." +verbose "Downloading from: $distributionUrl" +verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" + +# select .zip or .tar.gz +if ! command -v unzip >/dev/null; then + distributionUrl="${distributionUrl%.zip}.tar.gz" + distributionUrlName="${distributionUrl##*/}" +fi + +# verbose opt +__MVNW_QUIET_WGET=--quiet __MVNW_QUIET_CURL=--silent __MVNW_QUIET_UNZIP=-q __MVNW_QUIET_TAR='' +[ "${MVNW_VERBOSE-}" != true ] || __MVNW_QUIET_WGET='' __MVNW_QUIET_CURL='' __MVNW_QUIET_UNZIP='' __MVNW_QUIET_TAR=v + +# normalize http auth +case "${MVNW_PASSWORD:+has-password}" in +'') MVNW_USERNAME='' MVNW_PASSWORD='' ;; +has-password) [ -n "${MVNW_USERNAME-}" ] || MVNW_USERNAME='' MVNW_PASSWORD='' ;; +esac + +if [ -z "${MVNW_USERNAME-}" ] && command -v wget >/dev/null; then + verbose "Found wget ... using wget" + wget ${__MVNW_QUIET_WGET:+"$__MVNW_QUIET_WGET"} "$distributionUrl" -O "$TMP_DOWNLOAD_DIR/$distributionUrlName" || die "wget: Failed to fetch $distributionUrl" +elif [ -z "${MVNW_USERNAME-}" ] && command -v curl >/dev/null; then + verbose "Found curl ... using curl" + curl ${__MVNW_QUIET_CURL:+"$__MVNW_QUIET_CURL"} -f -L -o "$TMP_DOWNLOAD_DIR/$distributionUrlName" "$distributionUrl" || die "curl: Failed to fetch $distributionUrl" +elif set_java_home; then + verbose "Falling back to use Java to download" + javaSource="$TMP_DOWNLOAD_DIR/Downloader.java" + targetZip="$TMP_DOWNLOAD_DIR/$distributionUrlName" + cat >"$javaSource" <<-END + public class Downloader extends java.net.Authenticator + { + protected java.net.PasswordAuthentication getPasswordAuthentication() + { + return new java.net.PasswordAuthentication( System.getenv( "MVNW_USERNAME" ), System.getenv( "MVNW_PASSWORD" ).toCharArray() ); + } + public static void main( String[] args ) throws Exception + { + setDefault( new Downloader() ); + java.nio.file.Files.copy( java.net.URI.create( args[0] ).toURL().openStream(), java.nio.file.Paths.get( args[1] ).toAbsolutePath().normalize() ); + } + } + END + # For Cygwin/MinGW, switch paths to Windows format before running javac and java + verbose " - Compiling Downloader.java ..." + "$(native_path "$JAVACCMD")" "$(native_path "$javaSource")" || die "Failed to compile Downloader.java" + verbose " - Running Downloader.java ..." + "$(native_path "$JAVACMD")" -cp "$(native_path "$TMP_DOWNLOAD_DIR")" Downloader "$distributionUrl" "$(native_path "$targetZip")" +fi + +# If specified, validate the SHA-256 sum of the Maven distribution zip file +if [ -n "${distributionSha256Sum-}" ]; then + distributionSha256Result=false + if [ "$MVN_CMD" = mvnd.sh ]; then + echo "Checksum validation is not supported for maven-mvnd." >&2 + echo "Please disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 + exit 1 + elif command -v sha256sum >/dev/null; then + if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | sha256sum -c - >/dev/null 2>&1; then + distributionSha256Result=true + fi + elif command -v shasum >/dev/null; then + if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | shasum -a 256 -c >/dev/null 2>&1; then + distributionSha256Result=true + fi + else + echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." >&2 + echo "Please install either command, or disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 + exit 1 + fi + if [ $distributionSha256Result = false ]; then + echo "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised." >&2 + echo "If you updated your Maven version, you need to update the specified distributionSha256Sum property." >&2 + exit 1 + fi +fi + +# unzip and move +if command -v unzip >/dev/null; then + unzip ${__MVNW_QUIET_UNZIP:+"$__MVNW_QUIET_UNZIP"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -d "$TMP_DOWNLOAD_DIR" || die "failed to unzip" +else + tar xzf${__MVNW_QUIET_TAR:+"$__MVNW_QUIET_TAR"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -C "$TMP_DOWNLOAD_DIR" || die "failed to untar" +fi + +# Find the actual extracted directory name (handles snapshots where filename != directory name) +actualDistributionDir="" + +# First try the expected directory name (for regular distributions) +if [ -d "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" ]; then + if [ -f "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain/bin/$MVN_CMD" ]; then + actualDistributionDir="$distributionUrlNameMain" + fi +fi + +# If not found, search for any directory with the Maven executable (for snapshots) +if [ -z "$actualDistributionDir" ]; then + # enable globbing to iterate over items + set +f + for dir in "$TMP_DOWNLOAD_DIR"/*; do + if [ -d "$dir" ]; then + if [ -f "$dir/bin/$MVN_CMD" ]; then + actualDistributionDir="$(basename "$dir")" + break + fi + fi + done + set -f +fi + +if [ -z "$actualDistributionDir" ]; then + verbose "Contents of $TMP_DOWNLOAD_DIR:" + verbose "$(ls -la "$TMP_DOWNLOAD_DIR")" + die "Could not find Maven distribution directory in extracted archive" +fi + +verbose "Found extracted Maven distribution directory: $actualDistributionDir" +printf %s\\n "$distributionUrl" >"$TMP_DOWNLOAD_DIR/$actualDistributionDir/mvnw.url" +mv -- "$TMP_DOWNLOAD_DIR/$actualDistributionDir" "$MAVEN_HOME" || [ -d "$MAVEN_HOME" ] || die "fail to move MAVEN_HOME" + +clean || : +exec_maven "$@" diff --git a/mvnw.cmd b/mvnw.cmd new file mode 100644 index 0000000000..5761d94892 --- /dev/null +++ b/mvnw.cmd @@ -0,0 +1,189 @@ +<# : batch portion +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Apache Maven Wrapper startup batch script, version 3.3.4 +@REM +@REM Optional ENV vars +@REM MVNW_REPOURL - repo url base for downloading maven distribution +@REM MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven +@REM MVNW_VERBOSE - true: enable verbose log; others: silence the output +@REM ---------------------------------------------------------------------------- + +@IF "%__MVNW_ARG0_NAME__%"=="" (SET __MVNW_ARG0_NAME__=%~nx0) +@SET __MVNW_CMD__= +@SET __MVNW_ERROR__= +@SET __MVNW_PSMODULEP_SAVE=%PSModulePath% +@SET PSModulePath= +@FOR /F "usebackq tokens=1* delims==" %%A IN (`powershell -noprofile "& {$scriptDir='%~dp0'; $script='%__MVNW_ARG0_NAME__%'; icm -ScriptBlock ([Scriptblock]::Create((Get-Content -Raw '%~f0'))) -NoNewScope}"`) DO @( + IF "%%A"=="MVN_CMD" (set __MVNW_CMD__=%%B) ELSE IF "%%B"=="" (echo %%A) ELSE (echo %%A=%%B) +) +@SET PSModulePath=%__MVNW_PSMODULEP_SAVE% +@SET __MVNW_PSMODULEP_SAVE= +@SET __MVNW_ARG0_NAME__= +@SET MVNW_USERNAME= +@SET MVNW_PASSWORD= +@IF NOT "%__MVNW_CMD__%"=="" ("%__MVNW_CMD__%" %*) +@echo Cannot start maven from wrapper >&2 && exit /b 1 +@GOTO :EOF +: end batch / begin powershell #> + +$ErrorActionPreference = "Stop" +if ($env:MVNW_VERBOSE -eq "true") { + $VerbosePreference = "Continue" +} + +# calculate distributionUrl, requires .mvn/wrapper/maven-wrapper.properties +$distributionUrl = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionUrl +if (!$distributionUrl) { + Write-Error "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties" +} + +switch -wildcard -casesensitive ( $($distributionUrl -replace '^.*/','') ) { + "maven-mvnd-*" { + $USE_MVND = $true + $distributionUrl = $distributionUrl -replace '-bin\.[^.]*$',"-windows-amd64.zip" + $MVN_CMD = "mvnd.cmd" + break + } + default { + $USE_MVND = $false + $MVN_CMD = $script -replace '^mvnw','mvn' + break + } +} + +# apply MVNW_REPOURL and calculate MAVEN_HOME +# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-,maven-mvnd--}/ +if ($env:MVNW_REPOURL) { + $MVNW_REPO_PATTERN = if ($USE_MVND -eq $False) { "/org/apache/maven/" } else { "/maven/mvnd/" } + $distributionUrl = "$env:MVNW_REPOURL$MVNW_REPO_PATTERN$($distributionUrl -replace "^.*$MVNW_REPO_PATTERN",'')" +} +$distributionUrlName = $distributionUrl -replace '^.*/','' +$distributionUrlNameMain = $distributionUrlName -replace '\.[^.]*$','' -replace '-bin$','' + +$MAVEN_M2_PATH = "$HOME/.m2" +if ($env:MAVEN_USER_HOME) { + $MAVEN_M2_PATH = "$env:MAVEN_USER_HOME" +} + +if (-not (Test-Path -Path $MAVEN_M2_PATH)) { + New-Item -Path $MAVEN_M2_PATH -ItemType Directory | Out-Null +} + +$MAVEN_WRAPPER_DISTS = $null +if ((Get-Item $MAVEN_M2_PATH).Target[0] -eq $null) { + $MAVEN_WRAPPER_DISTS = "$MAVEN_M2_PATH/wrapper/dists" +} else { + $MAVEN_WRAPPER_DISTS = (Get-Item $MAVEN_M2_PATH).Target[0] + "/wrapper/dists" +} + +$MAVEN_HOME_PARENT = "$MAVEN_WRAPPER_DISTS/$distributionUrlNameMain" +$MAVEN_HOME_NAME = ([System.Security.Cryptography.SHA256]::Create().ComputeHash([byte[]][char[]]$distributionUrl) | ForEach-Object {$_.ToString("x2")}) -join '' +$MAVEN_HOME = "$MAVEN_HOME_PARENT/$MAVEN_HOME_NAME" + +if (Test-Path -Path "$MAVEN_HOME" -PathType Container) { + Write-Verbose "found existing MAVEN_HOME at $MAVEN_HOME" + Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" + exit $? +} + +if (! $distributionUrlNameMain -or ($distributionUrlName -eq $distributionUrlNameMain)) { + Write-Error "distributionUrl is not valid, must end with *-bin.zip, but found $distributionUrl" +} + +# prepare tmp dir +$TMP_DOWNLOAD_DIR_HOLDER = New-TemporaryFile +$TMP_DOWNLOAD_DIR = New-Item -Itemtype Directory -Path "$TMP_DOWNLOAD_DIR_HOLDER.dir" +$TMP_DOWNLOAD_DIR_HOLDER.Delete() | Out-Null +trap { + if ($TMP_DOWNLOAD_DIR.Exists) { + try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } + catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } + } +} + +New-Item -Itemtype Directory -Path "$MAVEN_HOME_PARENT" -Force | Out-Null + +# Download and Install Apache Maven +Write-Verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." +Write-Verbose "Downloading from: $distributionUrl" +Write-Verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" + +$webclient = New-Object System.Net.WebClient +if ($env:MVNW_USERNAME -and $env:MVNW_PASSWORD) { + $webclient.Credentials = New-Object System.Net.NetworkCredential($env:MVNW_USERNAME, $env:MVNW_PASSWORD) +} +[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 +$webclient.DownloadFile($distributionUrl, "$TMP_DOWNLOAD_DIR/$distributionUrlName") | Out-Null + +# If specified, validate the SHA-256 sum of the Maven distribution zip file +$distributionSha256Sum = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionSha256Sum +if ($distributionSha256Sum) { + if ($USE_MVND) { + Write-Error "Checksum validation is not supported for maven-mvnd. `nPlease disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." + } + Import-Module $PSHOME\Modules\Microsoft.PowerShell.Utility -Function Get-FileHash + if ((Get-FileHash "$TMP_DOWNLOAD_DIR/$distributionUrlName" -Algorithm SHA256).Hash.ToLower() -ne $distributionSha256Sum) { + Write-Error "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised. If you updated your Maven version, you need to update the specified distributionSha256Sum property." + } +} + +# unzip and move +Expand-Archive "$TMP_DOWNLOAD_DIR/$distributionUrlName" -DestinationPath "$TMP_DOWNLOAD_DIR" | Out-Null + +# Find the actual extracted directory name (handles snapshots where filename != directory name) +$actualDistributionDir = "" + +# First try the expected directory name (for regular distributions) +$expectedPath = Join-Path "$TMP_DOWNLOAD_DIR" "$distributionUrlNameMain" +$expectedMvnPath = Join-Path "$expectedPath" "bin/$MVN_CMD" +if ((Test-Path -Path $expectedPath -PathType Container) -and (Test-Path -Path $expectedMvnPath -PathType Leaf)) { + $actualDistributionDir = $distributionUrlNameMain +} + +# If not found, search for any directory with the Maven executable (for snapshots) +if (!$actualDistributionDir) { + Get-ChildItem -Path "$TMP_DOWNLOAD_DIR" -Directory | ForEach-Object { + $testPath = Join-Path $_.FullName "bin/$MVN_CMD" + if (Test-Path -Path $testPath -PathType Leaf) { + $actualDistributionDir = $_.Name + } + } +} + +if (!$actualDistributionDir) { + Write-Error "Could not find Maven distribution directory in extracted archive" +} + +Write-Verbose "Found extracted Maven distribution directory: $actualDistributionDir" +Rename-Item -Path "$TMP_DOWNLOAD_DIR/$actualDistributionDir" -NewName $MAVEN_HOME_NAME | Out-Null +try { + Move-Item -Path "$TMP_DOWNLOAD_DIR/$MAVEN_HOME_NAME" -Destination $MAVEN_HOME_PARENT | Out-Null +} catch { + if (! (Test-Path -Path "$MAVEN_HOME" -PathType Container)) { + Write-Error "fail to move MAVEN_HOME" + } +} finally { + try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } + catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } +} + +Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" diff --git a/tools/testlab/README.md b/tools/testlab/README.md index b3980d8a58..3c1936eb56 100644 --- a/tools/testlab/README.md +++ b/tools/testlab/README.md @@ -71,7 +71,7 @@ docker run -it --rm \ --link=kerby:kerby.example.com \ --link=openldap:openldap.example.com -e OPENLDAP_HOST=openldap.example.com -e OPENLDAP_PORT=389 -e OPENLDAP_PORT_SSL=636 \ --link=fedora389ds:fedora389ds.example.com -e FEDORA_389DS_HOST=fedora389ds.example.com -e FEDORA_389DS_PORT=3389 -e FEDORA_389DS_PORT_SSL=3636 \ - apachedirectory/maven-build:jdk-11 bash -c "mvn -V -f pom-first.xml clean install && mvn -V clean install -Denable-ui-tests" + apachedirectory/maven-build:jdk-21 bash -c "./mvnw -V -f pom-first.xml clean install && ./mvnw -V clean install -Denable-ui-tests" ``` From 1c5e9d741969b35e90bc81fc26b747086189bff2 Mon Sep 17 00:00:00 2001 From: Jan Opravil Date: Thu, 26 Nov 2026 08:56:35 +0100 Subject: [PATCH 09/12] test(ui): adapt the UI tests to Eclipse 4.41 and the DN editor - Eclipse 4.41 labels the menu item "Preferences..." and titles the new wizard dialog "New" (the page title is "Select a wizard"). - Since ea38b9c95 a new (empty) DN value is edited in multi-select mode: a list with Add and Remove buttons instead of a combo with Browse. The DN editor bot gets an Add button and a list accessor; the entry editor and alias entry tests use them for new values. Existing values still use the single-DN dialog. Co-Authored-By: Claude Opus 5.5 --- .../test/integration/ui/EntryEditorTest.java | 6 ++++-- .../integration/ui/NewEntryWizardTest.java | 6 +++++- .../integration/ui/bots/DnEditorDialogBot.java | 18 ++++++++++++++++++ .../test/integration/ui/bots/NewWizardBot.java | 2 +- .../test/integration/ui/bots/StudioBot.java | 2 +- 5 files changed, 29 insertions(+), 5 deletions(-) diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/EntryEditorTest.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/EntryEditorTest.java index 001e3ab0fb..3793206411 100644 --- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/EntryEditorTest.java +++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/EntryEditorTest.java @@ -28,6 +28,7 @@ import static org.apache.directory.studio.test.integration.junit5.TestFixture.USER1_DN; import static org.hamcrest.CoreMatchers.startsWith; import static org.hamcrest.MatcherAssert.assertThat; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertNull; @@ -315,11 +316,12 @@ public void testDnValueEditor( TestLdapServer server ) throws Exception wizardBot.typeAttributeType( "member" ); DnEditorDialogBot dnEditorBot = wizardBot.clickFinishButtonExpectingDnEditor(); assertTrue( dnEditorBot.isVisible() ); - SelectDnDialogBot selectDnBot = dnEditorBot.clickBrowseButtonExpectingSelectDnDialog(); + SelectDnDialogBot selectDnBot = dnEditorBot.clickAddButtonExpectingSelectDnDialog(); assertTrue( selectDnBot.isVisible() ); selectDnBot.selectEntry( ArrayUtils.remove( path( MULTI_VALUED_RDN_DN ), 0 ) ); selectDnBot.clickOkButton(); - assertEquals( MULTI_VALUED_RDN_DN.getName(), dnEditorBot.getDnText() ); + assertArrayEquals( new String[] + { MULTI_VALUED_RDN_DN.getName() }, dnEditorBot.getDnListItems() ); dnEditorBot.clickOkButton(); // assert value after saved and reloaded from server diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/NewEntryWizardTest.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/NewEntryWizardTest.java index 742601e122..fcc24fa380 100644 --- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/NewEntryWizardTest.java +++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/NewEntryWizardTest.java @@ -30,6 +30,7 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; +import org.apache.commons.lang3.ArrayUtils; import org.apache.directory.studio.connection.core.Connection; import org.apache.directory.studio.connection.core.Connection.AliasDereferencingMethod; import org.apache.directory.studio.connection.core.Connection.ReferralHandlingMethod; @@ -46,6 +47,7 @@ import org.apache.directory.studio.test.integration.ui.bots.NewAttributeWizardBot; import org.apache.directory.studio.test.integration.ui.bots.NewEntryWizardBot; import org.apache.directory.studio.test.integration.ui.bots.ReferralDialogBot; +import org.apache.directory.studio.test.integration.ui.bots.SelectDnDialogBot; import org.apache.directory.studio.test.integration.ui.bots.SubtreeSpecificationEditorDialogBot; import org.apache.directory.studio.test.integration.ui.utils.ResourceUtils; import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException; @@ -267,7 +269,9 @@ public void testCreateAliasEntry( TestLdapServer server ) throws Exception DnEditorDialogBot dnEditorBot = new DnEditorDialogBot(); dnEditorBot.setWaitAfterClickOkButton( false ); - dnEditorBot.setDnText( USER1_DN.getName() ); + SelectDnDialogBot selectDnBot = dnEditorBot.clickAddButtonExpectingSelectDnDialog(); + selectDnBot.selectEntry( ArrayUtils.remove( path( USER1_DN ), 0 ) ); + selectDnBot.clickOkButton(); dnEditorBot.clickOkButton(); wizardBot.clickFinishButton(); diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/DnEditorDialogBot.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/DnEditorDialogBot.java index cbe97f850d..92620e4004 100644 --- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/DnEditorDialogBot.java +++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/DnEditorDialogBot.java @@ -41,6 +41,24 @@ public SelectDnDialogBot clickBrowseButtonExpectingSelectDnDialog() } + /** + * New (empty) DN values are edited in multi-select mode: a list of DNs with Add and Remove buttons. + */ + public SelectDnDialogBot clickAddButtonExpectingSelectDnDialog() + { + activate(); + super.clickButton( "Add..." ); + return new SelectDnDialogBot(); + } + + + public String[] getDnListItems() + { + activate(); + return bot.list().getItems(); + } + + public void setDnText( String dn ) { activate(); diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/NewWizardBot.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/NewWizardBot.java index aa3ab98644..82fdbcaa8c 100644 --- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/NewWizardBot.java +++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/NewWizardBot.java @@ -28,7 +28,7 @@ public class NewWizardBot extends WizardBot public NewWizardBot() { - super( "Select a wizard" ); + super( "New" ); } diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/StudioBot.java b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/StudioBot.java index ce9848b047..70aeefcc72 100644 --- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/StudioBot.java +++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/StudioBot.java @@ -257,7 +257,7 @@ public void run() } else { - new SWTBot().menu( "Window" ).menu( "Preferences" ).click(); + new SWTBot().menu( "Window" ).menu( "Preferences..." ).click(); } return new PreferencesBot(); } From 873cbcfe70bd3a977a5499d3acfa40bc9f94aaf9 Mon Sep 17 00:00:00 2001 From: Jan Opravil Date: Thu, 26 Nov 2026 08:56:40 +0100 Subject: [PATCH 10/12] ci: run the UI tests in the GitHub Actions builds The SWTBot UI tests were never run by the GitHub workflows, and the Jenkins pipeline stops before them because of failing core integration tests against OpenLDAP/389ds. Run the main build with -Denable-ui-tests under xvfb-run with metacity. The tests need a window manager: without one, no shell is active after a dialog closes. On failure, upload the surefire reports and the UI test screenshots. Both workflows now use the Maven Wrapper. The README explains how to run the UI tests locally. Co-Authored-By: Claude Opus 5.5 --- .../pull-request-build-openjdk21.yml | 22 +++++++++++++++++-- .../pull-request-build-openjdk25.yml | 22 +++++++++++++++++-- README.md | 7 +++--- 3 files changed, 44 insertions(+), 7 deletions(-) diff --git a/.github/workflows/pull-request-build-openjdk21.yml b/.github/workflows/pull-request-build-openjdk21.yml index bb34be0cde..39872033ea 100644 --- a/.github/workflows/pull-request-build-openjdk21.yml +++ b/.github/workflows/pull-request-build-openjdk21.yml @@ -37,8 +37,26 @@ jobs: java-version: '21' distribution: 'temurin' cache: maven - - name: Build with Apache Maven - run: mvn -f pom-first.xml -U clean install && mvn clean install + - name: Build the target platform and generate the manifests + run: ./mvnw -B -V -U -f pom-first.xml clean install + # The SWTBot UI tests need a display and a window manager (without one, closed dialogs + # leave no active shell), so the build runs in a virtual X server with metacity. + - name: Install a window manager for the UI tests + run: sudo apt-get update && sudo apt-get install -y --no-install-recommends metacity dbus + - name: Build and run all tests, including the UI tests + run: >- + xvfb-run -a -s "-screen 0 1920x1200x24" + dbus-run-session -- + sh -c 'metacity --sm-disable --replace & sleep 2; exec ./mvnw -B -V clean install -Denable-ui-tests' + - name: Upload test reports and UI test screenshots + if: failure() + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 + with: + name: test-results-openjdk21 + path: | + **/target/surefire-reports/ + tests/test.integration.ui/screenshots/ + if-no-files-found: ignore env: MAVEN_OPTS: "-Xmx1024M" diff --git a/.github/workflows/pull-request-build-openjdk25.yml b/.github/workflows/pull-request-build-openjdk25.yml index 5f7fb4513a..8e95b2682c 100644 --- a/.github/workflows/pull-request-build-openjdk25.yml +++ b/.github/workflows/pull-request-build-openjdk25.yml @@ -37,8 +37,26 @@ jobs: java-version: '25' distribution: 'temurin' cache: maven - - name: Build with Apache Maven - run: mvn -f pom-first.xml -U clean install && mvn clean install + - name: Build the target platform and generate the manifests + run: ./mvnw -B -V -U -f pom-first.xml clean install + # The SWTBot UI tests need a display and a window manager (without one, closed dialogs + # leave no active shell), so the build runs in a virtual X server with metacity. + - name: Install a window manager for the UI tests + run: sudo apt-get update && sudo apt-get install -y --no-install-recommends metacity dbus + - name: Build and run all tests, including the UI tests + run: >- + xvfb-run -a -s "-screen 0 1920x1200x24" + dbus-run-session -- + sh -c 'metacity --sm-disable --replace & sleep 2; exec ./mvnw -B -V clean install -Denable-ui-tests' + - name: Upload test reports and UI test screenshots + if: failure() + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 + with: + name: test-results-openjdk25 + path: | + **/target/surefire-reports/ + tests/test.integration.ui/screenshots/ + if-no-files-found: ignore env: MAVEN_OPTS: "-Xmx1024M" diff --git a/README.md b/README.md index 3c0bf275ab..e55ea35aee 100644 --- a/README.md +++ b/README.md @@ -61,10 +61,11 @@ or on Windows : * Unit tests included in `src/test/java` of each plugin are executed automatically and run in 'test' phase * Core integration tests in `tests/test.integration.core` are executed automatically and run in 'integration-test' phase -* UI integration tests based on SWTBot in `tests/test.integration.ui` are disabled by default. They can be enabled with `-Denable-ui-tests`. A failing test generates a screenshot. To not block the developer computer they can run within a virtual framebuffer: +* UI integration tests based on SWTBot in `tests/test.integration.ui` are disabled by default. They can be enabled with `-Denable-ui-tests`; the GitHub Actions builds always run them. A failing test generates a screenshot. To not block the developer computer they can run within a virtual framebuffer. They need a window manager (e.g. metacity), otherwise no shell is active after a dialog closes. On Linux with a Wayland session, also set `GDK_BACKEND=x11` so the test windows open on the virtual display: - export DISPLAY=:99 - Xvfb :99 -screen 0 1024x768x16 & + export DISPLAY=:99 GDK_BACKEND=x11 + Xvfb :99 -screen 0 1920x1200x24 & + metacity --sm-disable --replace & * The core and UI integration tests run against ApacheDS, OpenLDAP, and 389ds. The ApacheDS is always started in embedded mode. The others are expected to run, e.g. with the following commands, otherwise those tests are skipped. From c0a1b03212fed81dcaac22e63ad350492edc83e7 Mon Sep 17 00:00:00 2001 From: Jan Opravil Date: Sat, 28 Nov 2026 20:06:49 +0100 Subject: [PATCH 11/12] test(core): skip the DIGEST-MD5 auth-conf tests against 389ds The Java DIGEST-MD5 client picks the 3DES cipher for auth-conf, and the Cyrus SASL DIGEST-MD5 plugin that the 389ds test image installs from openSUSE fails with "failed to init cipher '3des'" (RC4 and DES work). Exclude 389ds from the three tests that request auth-conf until 3DES works again in that plugin. Co-Authored-By: Claude Opus 5.5 --- .../core/DirectoryApiConnectionWrapperTest.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/core/DirectoryApiConnectionWrapperTest.java b/tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/core/DirectoryApiConnectionWrapperTest.java index 730e49d82a..20403d333e 100644 --- a/tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/core/DirectoryApiConnectionWrapperTest.java +++ b/tests/test.integration.core/src/main/java/org/apache/directory/studio/test/integration/core/DirectoryApiConnectionWrapperTest.java @@ -410,11 +410,20 @@ public void testSimpleBindStartTls( TestLdapServer ldapServer ) } + /** + * The Java DIGEST-MD5 client picks 3DES for auth-conf (which testSaslDigestMd5BindPlain always requests), + * and the Cyrus SASL DIGEST-MD5 plugin of the + * 389ds test image fails with "failed to init cipher '3des'" (RC4 and DES work). Remove the exclusions + * when 3DES works again in that plugin. + */ + private static final String FEDORA_389DS_NO_3DES = "Cyrus SASL in the 389ds image cannot init the 3DES cipher"; + + /** * Test binding to the server using SASL auth and no encryption. */ @ParameterizedTest - @LdapServersSource(mode = Mode.All) + @LdapServersSource(mode = Mode.All, except = LdapServerType.Fedora389ds, reason = FEDORA_389DS_NO_3DES) public void testSaslDigestMd5BindAuthPlain( TestLdapServer ldapServer ) { testSaslDigestMd5BindPlain( ldapServer, SaslQoP.AUTH ); @@ -519,7 +528,7 @@ public void testSaslDigestMd5BindAuthIntLdaps( TestLdapServer ldapServer ) * Test binding to the server using SASL auth-conf and ldaps:// encryption. */ @ParameterizedTest - @LdapServersSource(mode = Mode.All) + @LdapServersSource(mode = Mode.All, except = LdapServerType.Fedora389ds, reason = FEDORA_389DS_NO_3DES) public void testSaslDigestMd5BindAuthConfLdaps( TestLdapServer ldapServer ) { testSaslDigestMd5BindLdaps( ldapServer, SaslQoP.AUTH_CONF ); @@ -579,7 +588,7 @@ public void testSaslDigestMd5BindAuthIntStartTls( TestLdapServer ldapServer ) * Test binding to the server using SASL auth-conf and StartTLS encryption. */ @ParameterizedTest - @LdapServersSource(mode = Mode.All) + @LdapServersSource(mode = Mode.All, except = LdapServerType.Fedora389ds, reason = FEDORA_389DS_NO_3DES) public void testSaslDigestMd5BindAuthConfStartTls( TestLdapServer ldapServer ) { testSaslDigestMd5BindStartTls( ldapServer, SaslQoP.AUTH_CONF ); From c410f8225fdf658305d1cb77a02e8ed8b6f3ae68 Mon Sep 17 00:00:00 2001 From: Jan Opravil Date: Sat, 28 Nov 2026 20:06:49 +0100 Subject: [PATCH 12/12] ci(jenkins): build a Java 21 image and fix the 389ds SASL plugins apachedirectory/maven-build:jdk-21 is published for arm64 only, so it cannot run on the amd64 agents, and it has no window manager for the UI tests. The pipeline now builds tools/testlab/build-image (Temurin 21, GTK, Xvfb, metacity, dbus, krb5-user) and runs the build like the GitHub workflows: xvfb-run, dbus-run-session and metacity. HOME and user.home point to /tmp/home, because the Jenkins user has no home directory in the image. The 389ds container installs the DIGEST-MD5 and GSSAPI SASL plugins at start. Since openSUSE rotated its signing key in 2026, zypper skipped every repository, the plugins were missing and the SASL tests against 389ds failed. Import the current key first, and use --replacefiles, because the current packages conflict with OpenSSL 1.1 in the 2.2 image. 389ds stays on 2.2: 2.4 and later answer operations below a referral entry with noSuchObject instead of a referral. Co-Authored-By: Claude Opus 5.5 --- Jenkinsfile | 24 +++++++++++++++++++----- tools/testlab/README.md | 15 +++++++++------ tools/testlab/build-image/Dockerfile | 27 +++++++++++++++++++++++++++ 3 files changed, 55 insertions(+), 11 deletions(-) create mode 100644 tools/testlab/build-image/Dockerfile diff --git a/Jenkinsfile b/Jenkinsfile index 3ac566863b..40b7c44900 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -37,7 +37,7 @@ pipeline { } steps { script { - inTestLab('jdk-21', { sh 'export DISPLAY=:99; env; ps aux' }) + inTestLab({ sh 'env; ps aux' }) } } post { @@ -58,7 +58,14 @@ pipeline { } steps { script { - inTestLab('jdk-21', { sh 'export DISPLAY=:99; ./mvnw -V -U -f pom-first.xml clean install && ./mvnw -V clean install -Dorg.eclipse.swtbot.search.timeout=20000 -Denable-ui-tests' }) + // The Jenkins user has no home directory in the build image, so point HOME and the JVMs' + // user.home to a writable directory. The UI tests need a window manager: run them on a + // private Xvfb display with metacity. + inTestLab({ sh ''' + export HOME=/tmp/home JAVA_TOOL_OPTIONS=-Duser.home=/tmp/home + ./mvnw -B -V -U -f pom-first.xml clean install + xvfb-run -a -s "-screen 0 1920x1200x24" dbus-run-session -- sh -c 'metacity --sm-disable --replace & sleep 2; exec ./mvnw -B -V clean install -Dorg.eclipse.swtbot.search.timeout=20000 -Denable-ui-tests' + ''' }) } } post { @@ -111,11 +118,18 @@ pipeline { } } -def inTestLab(String dockerImageTag, Closure action){ +def inTestLab(Closure action){ + def buildImage = docker.build('directory-studio-build', 'tools/testlab/build-image') docker.image('coheigea/kerby').withRun('-h kerby.example.com -v $(pwd)/tools/testlab/kerby-data:/kerby-data') { kerby -> docker.image('osixia/openldap:1.5.0').withRun('-h openldap.example.com -v $(pwd)/tools/testlab/ldap.keytab:/etc/krb5.keytab -v $(pwd)/tools/testlab/krb5.conf:/etc/krb5.conf -e LDAP_TLS_VERIFY_CLIENT=never') { openldap -> - docker.image('389ds/dirsrv:2.2').withRun('-h fedora389ds.example.com -v $(pwd)/tools/testlab/ldap.keytab:/etc/krb5.keytab -v $(pwd)/tools/testlab/krb5.conf:/etc/krb5.conf -e DS_DM_PASSWORD=admin', 'bash -c "zypper install -y cyrus-sasl-crammd5 cyrus-sasl-digestmd5 cyrus-sasl-gssapi; set -m; /usr/lib/dirsrv/dscontainer -r & while ! /usr/lib/dirsrv/dscontainer -H; do sleep 5; done; sleep 5; /usr/sbin/dsconf localhost backend create --suffix dc=example,dc=org --be-name example; fg"') { fedora389ds -> - docker.image("apachedirectory/maven-build:${dockerImageTag}").inside("-v ${env.WORKSPACE}/tools/testlab/krb5.conf:/etc/krb5.conf --link=${kerby.id}:kerby.example.com --link=${openldap.id}:openldap.example.com -e OPENLDAP_HOST=openldap.example.com -e OPENLDAP_PORT=389 -e OPENLDAP_PORT_SSL=636 --link=${fedora389ds.id}:fedora389ds.example.com -e FEDORA_389DS_HOST=fedora389ds.example.com -e FEDORA_389DS_PORT=3389 -e FEDORA_389DS_PORT_SSL=3636") { + // The 389ds image lacks the DIGEST-MD5 and GSSAPI SASL plugins, so they are installed at start. + // openSUSE rotated its signing key in 2026; import the current key first, otherwise zypper skips + // every repository and the SASL tests against 389ds fail. The plugins pull in current glibc and + // OpenSSL 3, whose files conflict with OpenSSL 1.1 in this older image, hence --replacefiles. + // 389ds stays on 2.2: 2.4 and later return noSuchObject instead of a referral for entries below + // a referral entry, which breaks the referral tests. + docker.image('389ds/dirsrv:2.2').withRun('-h fedora389ds.example.com -v $(pwd)/tools/testlab/ldap.keytab:/etc/krb5.keytab -v $(pwd)/tools/testlab/krb5.conf:/etc/krb5.conf -e DS_DM_PASSWORD=admin', 'bash -c "rpm --import https://download.opensuse.org/tumbleweed/repo/oss/repodata/repomd.xml.key; zypper --non-interactive install --no-recommends --replacefiles cyrus-sasl-crammd5 cyrus-sasl-digestmd5 cyrus-sasl-gssapi; set -m; /usr/lib/dirsrv/dscontainer -r & while ! /usr/lib/dirsrv/dscontainer -H; do sleep 5; done; sleep 5; /usr/sbin/dsconf localhost backend create --suffix dc=example,dc=org --be-name example; fg"') { fedora389ds -> + buildImage.inside("-v ${env.WORKSPACE}/tools/testlab/krb5.conf:/etc/krb5.conf --link=${kerby.id}:kerby.example.com --link=${openldap.id}:openldap.example.com -e OPENLDAP_HOST=openldap.example.com -e OPENLDAP_PORT=389 -e OPENLDAP_PORT_SSL=636 --link=${fedora389ds.id}:fedora389ds.example.com -e FEDORA_389DS_HOST=fedora389ds.example.com -e FEDORA_389DS_PORT=3389 -e FEDORA_389DS_PORT_SSL=3636") { action() } } diff --git a/tools/testlab/README.md b/tools/testlab/README.md index 3c1936eb56..f11b6ef39e 100644 --- a/tools/testlab/README.md +++ b/tools/testlab/README.md @@ -46,7 +46,7 @@ docker run -it --rm --name openldap -h openldap.example.com -p 20389:389 -p 2063 ## Fedora 389ds ``` -docker run -it --rm --name fedora389ds -h fedora389ds.example.com -p 21389:3389 -p 21636:3636 -e DS_DM_PASSWORD=admin -v $(pwd)/tools/testlab/ldap.keytab:/etc/krb5.keytab -v $(pwd)/tools/testlab/krb5.conf:/etc/krb5.conf 389ds/dirsrv bash -c "zypper install -y cyrus-sasl-crammd5 cyrus-sasl-digestmd5 cyrus-sasl-gssapi; set -m; /usr/lib/dirsrv/dscontainer -r & while ! /usr/lib/dirsrv/dscontainer -H; do sleep 5; done; sleep 5; /usr/sbin/dsconf localhost backend create --suffix dc=example,dc=org --be-name example; fg" +docker run -it --rm --name fedora389ds -h fedora389ds.example.com -p 21389:3389 -p 21636:3636 -e DS_DM_PASSWORD=admin -v $(pwd)/tools/testlab/ldap.keytab:/etc/krb5.keytab -v $(pwd)/tools/testlab/krb5.conf:/etc/krb5.conf 389ds/dirsrv:2.2 bash -c "rpm --import https://download.opensuse.org/tumbleweed/repo/oss/repodata/repomd.xml.key; zypper --non-interactive install --no-recommends --replacefiles cyrus-sasl-crammd5 cyrus-sasl-digestmd5 cyrus-sasl-gssapi; set -m; /usr/lib/dirsrv/dscontainer -r & while ! /usr/lib/dirsrv/dscontainer -H; do sleep 5; done; sleep 5; /usr/sbin/dsconf localhost backend create --suffix dc=example,dc=org --be-name example; fg" ``` ## Usage @@ -62,16 +62,19 @@ ldapwhoami -H ldap://fedora389ds.example.com:21389 -Y GSSAPI -N ### UI integration tests +The Jenkins pipeline builds its image from `tools/testlab/build-image` and runs the build like this: + ``` -docker run -it --rm \ +docker build -t directory-studio-build tools/testlab/build-image +docker run -it --rm --init \ -u $(id -u):$(id -g) \ - -v ~/.m2:/home/hnelson/.m2 \ + -e HOME=/tmp/home -e JAVA_TOOL_OPTIONS=-Duser.home=/tmp/home \ + -v ~/.m2:/tmp/home/.m2 \ -v $(pwd):/home/hnelson/project \ + -w /home/hnelson/project \ -v $(pwd)/tools/testlab/krb5.conf:/etc/krb5.conf \ --link=kerby:kerby.example.com \ --link=openldap:openldap.example.com -e OPENLDAP_HOST=openldap.example.com -e OPENLDAP_PORT=389 -e OPENLDAP_PORT_SSL=636 \ --link=fedora389ds:fedora389ds.example.com -e FEDORA_389DS_HOST=fedora389ds.example.com -e FEDORA_389DS_PORT=3389 -e FEDORA_389DS_PORT_SSL=3636 \ - apachedirectory/maven-build:jdk-21 bash -c "./mvnw -V -f pom-first.xml clean install && ./mvnw -V clean install -Denable-ui-tests" - + directory-studio-build sh -c "./mvnw -V -f pom-first.xml clean install && xvfb-run -a -s '-screen 0 1920x1200x24' dbus-run-session -- sh -c 'metacity --sm-disable --replace & sleep 2; exec ./mvnw -V clean install -Denable-ui-tests'" ``` - diff --git a/tools/testlab/build-image/Dockerfile b/tools/testlab/build-image/Dockerfile new file mode 100644 index 0000000000..68205fc2e1 --- /dev/null +++ b/tools/testlab/build-image/Dockerfile @@ -0,0 +1,27 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# Build image for the Jenkins pipeline: Java 21, plus GTK, Xvfb and a window manager for the +# SWTBot UI tests. apachedirectory/maven-build:jdk-21 is published for arm64 only and has no +# window manager; without one, no shell is active after a dialog closes and UI tests fail. +# The GSSAPI tests call /usr/bin/kinit from krb5-user. +FROM eclipse-temurin:21-jdk-noble + +RUN apt-get -q update \ + && DEBIAN_FRONTEND=noninteractive apt-get -q install -y --no-install-recommends \ + libgtk-3-0t64 libxtst6 xvfb xauth metacity dbus dbus-x11 fonts-dejavu-core krb5-user \ + && rm -rf /var/lib/apt/lists/*