This is an automated email from the ASF dual-hosted git repository.
mattcasters pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/hop.git
The following commit(s) were added to refs/heads/main by this push:
new f7c2694a0b [build] another try to make ecj frictionless (#8430)
f7c2694a0b is described below
commit f7c2694a0b66a151eb244a7e9c11beff46b18421
Author: Romain Manni-Bucau <[email protected]>
AuthorDate: Mon Sep 21 19:38:31 2026 +0200
[build] another try to make ecj frictionless (#8430)
* [build] another try to make ecj frictionless
* [build] use ecj-lombok 1.0.1: Java 11 bytecode + Plexus-registered
participant so distro Sisu 0.3.x (Ubuntu Maven 3.8.7) attaches the Lombok agent
* fix extensions xml formatting
---
.mvn/extensions.xml | 12 ++
.../META-INF/plexus/components.xml | 34 -----
pom.xml | 110 +---------------
.../org/apache/hop/tools/ecj/AttachLombokEcj.java | 142 ---------------------
4 files changed, 18 insertions(+), 280 deletions(-)
diff --git a/.mvn/extensions.xml b/.mvn/extensions.xml
index 1088e58cad..c3ca7dc3b7 100644
--- a/.mvn/extensions.xml
+++ b/.mvn/extensions.xml
@@ -26,6 +26,18 @@
<version>4.7.0</version>
</extension>
+ <!-- Self-attaches the Lombok ECJ agent once per build, after the projects
are read
+ and before anything compiles. Required because the ECJ compile needs
the Lombok
+ agent and because `cd <module> && mvn` and `-pl <module>` must work.
+ Built with release=11 and Plexus-registered so distro Sisu 0.3.x (ASM
limited
+ to Java 14 bytecode) can load it too.
+ See https://github.com/rmannibucau/ecj-lombok-extension. -->
+ <extension>
+ <groupId>com.github.rmannibucau.maven</groupId>
+ <artifactId>ecj-lombok-extension</artifactId>
+ <version>1.0.1</version>
+ </extension>
+
<!-- not really needed by default and quite outdated
<extension>
<groupId>co.leantechniques</groupId>
diff --git a/.mvn/plexus-eclipse-hint/META-INF/plexus/components.xml
b/.mvn/plexus-eclipse-hint/META-INF/plexus/components.xml
deleted file mode 100644
index 98eb02c1bd..0000000000
--- a/.mvn/plexus-eclipse-hint/META-INF/plexus/components.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ 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.
- -->
-<!--
- Debian/Ubuntu Maven (3.8.7 on 24.04, 3.9.12 on 26.04) uses distro Sisu
- 0.3.4/0.3.5. That Sisu's shaded ASM only reads class files through Java 14,
- so it cannot index plexus-compiler-eclipse 2.17.0 (Java 17, @Named). The
- compiler class itself runs fine on JDK 21; only the scan fails. This Plexus
- descriptor registers compilerId=eclipse without ASM-indexing that class.
--->
-<component-set>
- <components>
- <component>
- <role>org.codehaus.plexus.compiler.Compiler</role>
- <role-hint>eclipse</role-hint>
-
<implementation>org.codehaus.plexus.compiler.eclipse.EclipseJavaCompiler</implementation>
- <isolated-realm>false</isolated-realm>
- </component>
- </components>
-</component-set>
diff --git a/pom.xml b/pom.xml
index a7c07a8bba..d8457faf64 100644
--- a/pom.xml
+++ b/pom.xml
@@ -401,101 +401,6 @@
</execution>
</executions>
</plugin>
- <!--
- Debian/Ubuntu Maven never indexes plexus-compiler-eclipse
2.17.0 (Sisu
- 0.3.x ASM stops at Java 14 class files). inherited so `cd
<module> &&
- mvn` and `-pl <module>` still attach Lombok and install the
Eclipse
- compiler Plexus descriptor into the local repo (no committed
jar, no
- systemPath). javac + exec:java avoids the Groovy-per-module
startup tax.
- Phases are split so sortPom cannot run the helper before it
is compiled.
- -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-antrun-plugin</artifactId>
- <version>3.1.0</version>
- <executions>
- <execution>
- <id>compile-lombok-ecj-helper</id>
- <goals>
- <goal>run</goal>
- </goals>
- <phase>validate</phase>
- <configuration>
- <target>
- <property name="hop.root"
value="${maven.multiModuleProjectDirectory}"></property>
- <mkdir
dir="${hop.root}/tools/ecj-helper/target/classes"></mkdir>
- <javac
destdir="${hop.root}/tools/ecj-helper/target/classes" encoding="UTF-8"
includeDestClasses="true" includeantruntime="false" release="21"
srcdir="${hop.root}/tools/ecj-helper/src/main/java"></javac>
- </target>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>exec-maven-plugin</artifactId>
- <version>3.5.0</version>
- <dependencies>
- <dependency>
- <groupId>org.projectlombok</groupId>
- <artifactId>lombok</artifactId>
- <version>${lombok.version}</version>
- </dependency>
- </dependencies>
- <executions>
- <execution>
- <id>attach-lombok-ecj-agent</id>
- <goals>
- <goal>java</goal>
- </goals>
- <phase>initialize</phase>
- <configuration>
-
<mainClass>org.apache.hop.tools.ecj.AttachLombokEcj</mainClass>
-
<includeProjectDependencies>false</includeProjectDependencies>
-
<includePluginDependencies>true</includePluginDependencies>
- <additionalClasspathElements>
-
<additionalClasspathElement>${maven.multiModuleProjectDirectory}/tools/ecj-helper/target/classes</additionalClasspathElement>
- </additionalClasspathElements>
- <systemProperties>
- <systemProperty>
- <key>lombok.ecj.agent.skip</key>
- <value>${lombok.ecj.agent.skip}</value>
- </systemProperty>
- <systemProperty>
- <key>lombok.version</key>
- <value>${lombok.version}</value>
- </systemProperty>
- </systemProperties>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <!--
- initialize wrote .mvn/plexus-eclipse-hint.jar.
generate-sources installs
- it as a real GAV so maven-compiler-plugin can depend on it
without
- systemPath. generate-sources is after initialize, so plugin
sort order
- cannot invert this.
- -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-install-plugin</artifactId>
- <executions>
- <execution>
- <id>install-plexus-eclipse-hint</id>
- <goals>
- <goal>install-file</goal>
- </goals>
- <phase>generate-sources</phase>
- <configuration>
- <groupId>org.apache.hop</groupId>
- <artifactId>plexus-eclipse-hint</artifactId>
- <version>1.0</version>
- <packaging>jar</packaging>
-
<file>${maven.multiModuleProjectDirectory}/.mvn/plexus-eclipse-hint.jar</file>
- <generatePom>true</generatePom>
- </configuration>
- </execution>
- </executions>
- </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
@@ -509,14 +414,13 @@
<dependencies>
<!-- Plexus XML registration of compilerId=eclipse.
Required for
Debian/Ubuntu Maven, whose Sisu 0.3.x cannot
ASM-index the
- Java 17 EclipseJavaCompiler class. The jar is NOT
tracked in git:
- initialize writes it from .mvn/plexus-eclipse-hint/
and
- generate-sources install-file's it as this GAV,
before compile
- loads this plugin. -->
+ Java 17 EclipseJavaCompiler class. The descriptor
ships as a
+ real artifact of the ecj-lombok project
+
(https://github.com/rmannibucau/ecj-lombok-extension). -->
<dependency>
- <groupId>org.apache.hop</groupId>
- <artifactId>plexus-eclipse-hint</artifactId>
- <version>1.0</version>
+ <groupId>com.github.rmannibucau.maven</groupId>
+ <artifactId>ecj-plexus-hint</artifactId>
+ <version>1.0.1</version>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
@@ -579,7 +483,6 @@
<exclude>.dockerignore</exclude>
<!-- symlink alias of AGENTS.md (header lives on the
target) -->
<exclude>CLAUDE.md</exclude>
- <exclude>.mvn/plexus-eclipse-hint.jar</exclude>
<!-- Unit Test Exclusions -->
<exclude>**/test/**/*.txt</exclude>
@@ -693,7 +596,6 @@
<java>
<includes>
<include>src/**/*.java</include>
- <include>tools/ecj-helper/src/**/*.java</include>
</includes>
<googleJavaFormat></googleJavaFormat>
<importOrder></importOrder>
diff --git
a/tools/ecj-helper/src/main/java/org/apache/hop/tools/ecj/AttachLombokEcj.java
b/tools/ecj-helper/src/main/java/org/apache/hop/tools/ecj/AttachLombokEcj.java
deleted file mode 100644
index fd8031780e..0000000000
---
a/tools/ecj-helper/src/main/java/org/apache/hop/tools/ecj/AttachLombokEcj.java
+++ /dev/null
@@ -1,142 +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.
- */
-
-package org.apache.hop.tools.ecj;
-
-import com.sun.tools.attach.VirtualMachine;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.net.URL;
-import java.nio.file.Files;
-import java.nio.file.StandardCopyOption;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipOutputStream;
-
-/**
- * Build-time helper invoked from exec-maven-plugin (same JVM as Maven).
- *
- * <p>Writes {@code .mvn/plexus-eclipse-hint.jar} from the XML descriptor so
Debian/Ubuntu Maven
- * (Sisu 0.3.x) can register {@code compilerId=eclipse} without ASM-indexing
the Java 17 Eclipse
- * compiler class, then self-attaches the Lombok ECJ agent once per Maven JVM.
- */
-public final class AttachLombokEcj {
-
- private AttachLombokEcj() {}
-
- public static void main(String[] args) throws Exception {
- String rootPath = System.getProperty("maven.multiModuleProjectDirectory");
- if (rootPath == null || rootPath.isEmpty()) {
- throw new IllegalStateException("maven.multiModuleProjectDirectory is
not set");
- }
- File root = new File(rootPath);
- synchronized (System.getProperties()) {
- writeHintJar(root);
- attachLombok(root);
- }
- }
-
- private static void writeHintJar(File root) throws IOException {
- File hintXml = new File(root,
".mvn/plexus-eclipse-hint/META-INF/plexus/components.xml");
- File hintJar = new File(root, ".mvn/plexus-eclipse-hint.jar");
- if (!hintXml.isFile()) {
- throw new IllegalStateException("Eclipse compiler Plexus descriptor
missing: " + hintXml);
- }
- if (hintJar.isFile() && hintJar.lastModified() >= hintXml.lastModified()) {
- return;
- }
- File parent = hintJar.getParentFile();
- if (parent != null && !parent.isDirectory() && !parent.mkdirs()) {
- throw new IllegalStateException("Unable to create " + parent);
- }
- try (FileOutputStream fos = new FileOutputStream(hintJar);
- ZipOutputStream zos = new ZipOutputStream(fos);
- FileInputStream in = new FileInputStream(hintXml)) {
- zos.putNextEntry(new ZipEntry("META-INF/plexus/components.xml"));
- byte[] buffer = new byte[4096];
- int n;
- while ((n = in.read(buffer)) >= 0) {
- zos.write(buffer, 0, n);
- }
- zos.closeEntry();
- }
- System.out.println("Wrote Eclipse compiler Plexus descriptor jar: " +
hintJar);
- }
-
- private static File agentMarker() {
- return new File(
- System.getProperty("java.io.tmpdir"),
- "hop-lombok-ecj-agent-" + ProcessHandle.current().pid());
- }
-
- private static void attachLombok(File root) throws Exception {
- if
("true".equals(String.valueOf(System.getProperty("lombok.ecj.agent.skip")))) {
- return;
- }
- // exec:java restores System properties after main() returns, and loads
this
- // class in a new classloader per module, so a pid-scoped file is the
durable
- // "already attached" flag for this Maven JVM.
- if (System.getProperty("lombok.ecj.agent.attached") != null ||
agentMarker().isFile()) {
- return;
- }
- File lombokJar = findLombokJar(root);
- if (!lombokJar.isFile() || lombokJar.length() < 1_000_000L) {
- throw new IllegalStateException(
- "Lombok jar missing or incomplete for the ECJ agent attach, expected
" + lombokJar);
- }
- File agentJar = Files.createTempFile("lombok-ecj-agent-", ".jar").toFile();
- agentJar.deleteOnExit();
- Files.copy(lombokJar.toPath(), agentJar.toPath(),
StandardCopyOption.REPLACE_EXISTING);
- try {
- VirtualMachine vm =
VirtualMachine.attach(String.valueOf(ProcessHandle.current().pid()));
- try {
- vm.loadAgent(agentJar.getAbsolutePath(), "ECJ");
- } finally {
- vm.detach();
- }
- } catch (Throwable t) {
- throw new IllegalStateException(
- "Unable to self-attach the Lombok ECJ agent, ensure
-Djdk.attach.allowAttachSelf=true is"
- + " in .mvn/jvm.config and the environment allows self-attach,
or skip it with"
- + " -Dlombok.ecj.agent.skip=true",
- t);
- }
- File marker = agentMarker();
- marker.createNewFile();
- marker.deleteOnExit();
- System.setProperty("lombok.ecj.agent.attached", "true");
- System.out.println("Lombok ECJ agent attached (source: " + lombokJar +
")");
- }
-
- private static File findLombokJar(File root) {
- try {
- URL loc =
-
Class.forName("lombok.launch.Agent").getProtectionDomain().getCodeSource().getLocation();
- if (loc != null && "file".equals(loc.getProtocol())) {
- File fromAgent = new File(loc.toURI());
- if (fromAgent.isFile()) {
- return fromAgent;
- }
- }
- } catch (Exception ignored) {
- // fall through to .mvn/lombok-*.jar
- }
- String version = System.getProperty("lombok.version", "");
- return new File(root, ".mvn/lombok-" + version + ".jar");
- }
-}