Repository navigation
feat: 按构建提供者契约在 Tomcat 上运行和调试 Web 模块 - #2
Merged
Merged
Conversation
Replace the Go backend and web panel of the first draft with the current plugin contract: a Tomcat build system whose Java provider lists the Web modules of a workspace and prepares a Tomcat launch that Lithe starts, stops and debugs. - Detect Maven war modules, Gradle war modules, Eclipse Dynamic Web Projects and plain Web folders (including a folder found only by its WEB-INF/web.xml marker). - Build Maven modules from the reactor root with -pl -am, Gradle modules with the war task; serve Eclipse projects and plain folders in place, with their output folder mounted at /WEB-INF/classes. - Run each module in a private CATALINA_BASE under the workspace state: loopback HTTP connector, no shutdown port, console-only logging; the Tomcat installation, the workspace and the package are only read. - Debug through the java debug configuration type with suspend=y on the host's port. - Settings for the Tomcat home and HTTP port, with Chinese translations and localized provider errors. - Log through the Java SDK: quiet model successes, degraded results for unreadable build files and a truncated scan. - End-to-end test against real Tomcat 9.0.124 and 10.1.62 (pinned by SHA-512), CI on Linux (JDK 17 and 8) and Windows, and a release workflow. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Ubuntu image sets GRADLE_HOME to its own Gradle 9, which needs Java 17, and the provider prefers GRADLE_HOME over PATH, so the Java 8 lane built with it and failed. Point GRADLE_HOME at the pinned 8.14.3. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- e2e/host:用宿主自己的测试框架装上本插件和 Java Support,打开 Eclipse Dynamic Web Project, 按用户顺序(先读模型、再在设置里选 Tomcat)从运行配置运行和调试:页面可访问、运行窗口有 Tomcat 日志、Stop 释放端口;调试时请求停在项目源码断点,Continue 后完成;插件包和 Tomcat 安装目录前后不变。 - scripts/e2e-host.mjs:检出 e2e/host/lithe-host.json 固定的宿主,以 overlay 方式运行测试。 - test/java-plugin.json、scripts/test/fetch-java-plugin.mjs:按版本和 SHA-256 固定 Java Support 4.0.1。 - CI 新增 host 任务(ready 后和 main 上,Linux,JDK 21)。 - README、功能矩阵记录宿主测试、JDK 21 要求,以及依赖的宿主修复 1lck/Lithe-IDEA#2142、#2143 和契约缺口 #2144(提供者报错暂时只有英文)。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1lck
marked this pull request as ready for review
November 18, 2026 08:03
Java Support 不带 JDT 语言服务器,Linux runner 上没有安装,调试测试因此失败。 test/java-plugin.json 按 Java 插件 CI 的固定值记下 JDT LS 1.61.0 的地址和 SHA-256, fetch-java-plugin.mjs --jdtls 下载、校验并解压,CI 用 JDTLS_HOME 指向它。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
替代 #1。#1 用 Go 后端加网页面板自己启动和管理 Tomcat,这条路径和现在的插件契约不一致:服务进程应该由 Lithe 持有,调试应该走调试注册表。本 PR 按当前契约重写插件,#1 的检测思路(Web Facet、WAR/Exploded)保留在新实现中。
类型:feat(插件首个版本 0.1.0,三个平台共用同一个包)
改了什么
tomcat:pom.xml、build.gradle(.kts)、.project或web.xml所在的最外层目录建立 Tomcat 构建实例。模型来自提供者,运行项 “Run on Tomcat” 按web-application标签对每个 Web 模块生成,execution: service,调试类型为java。provider/,Java 8,SDK 从源码引入):WebModules:识别 Maven war、Gradle war、Eclipse Dynamic Web Project(WTP 组件文件中部署到/的目录、context-root、.classpath的 output)和普通 Web 目录。只有WEB-INF/web.xml的普通目录,Lithe 会把WEB-INF本身当作实例根,这种情况也能识别。遍历有上限(8 层、5000 个目录)。Preparation:重新检测模块,拒绝过期目标;检查 Tomcat 安装目录和端口;Maven 在反应堆根用-pl <模块> -am -DskipTests package构建,Gradle 运行war任务,构建输出进入运行窗口;Eclipse 项目和普通目录原地运行,编译输出挂到/WEB-INF/classes并开启重载;拒绝程序参数,不悄悄忽略。CatalinaBase:每个模块在${workspaceStateDir}/bases/<哈希>/有自己的 CATALINA_BASE:只绑定 127.0.0.1 的连接器、关闭端口为 -1、只输出到控制台的logging.properties、从安装目录复制的其他conf/文件,以及指向模块的上下文文件。Bootstrap start,系统属性与catalina.sh run相同;调试时加-agentlib:jdwp=…suspend=y,address=<宿主分配的端口>;JDK_JAVA_OPTIONS带上catalina.sh在 Java 9+ 使用的--add-opens。CATALINA_HOME)、HTTP 端口(project,默认 8080)。设置有中文翻译(l10n/zh-Hans.json),提供者的报错按界面语言输出中文或英文。scripts/test.mjs用真实 Tomcat 跑端到端测试;test/tomcat-versions.json用 SHA-512 固定 Tomcat 版本;CI 在 Linux 上用 JDK 17 和 JDK 8 运行,ready 后在 Windows 上运行;另有发布流程release.yml。docs/feature-matrix.md、NOTICE、LICENSE。能力与权限
requires为buildSystems 0、buildProviders 0、settings 0;requiresTools: java;激活事件onBuildSystem:tomcat,用户第一次发起构建请求时才启动提供者。process.build:提供者运行用户的 Maven 或 Gradle 构建 Web 模块。languageServer.launch:契约要求声明这项权限,Lithe 才会用java运行时启动打包的提供者 jar(与 Maven 插件和契约 fixture 相同)。executesProjectCode: true、mayUseNetwork: true:构建会执行项目的构建脚本,可能下载依赖。依据的版本
8b91b324f0e8140cb6ca3fed3dc26fa0b59a788c(sdk.lock.json记录每个文件的 SHA-256)。788e61eb的validate_manifest_value、build_decode_model_command、build_decode_run_preparation_command校验通过(Maven、WTP、普通目录三个实例都带调试参数)。故意改坏运行声明后,校验会拒绝。日志接线
lib/lithe-tomcat-provider.jarlogging.properties只有 ConsoleHandler,不写日志文件lithe/build/modeltomcat.invalidRoot、internal_errorbuildFileUnreadable(带计数,每次请求一次)、webModuleScanTruncatedlithe/build/prepareRuntomcat.run.noHome、invalidHome、portInUse、notWebModule、buildFailed、noTool、noArtifact、unsupportedArguments、invalidProject、invalidDebugbuildFileUnreadable没有恢复路径。取消由 SDK 处理,不记录失败。日志只带类别和计数;测试会断言日志里不出现工作区路径。
验证
本机 macOS arm64:
node scripts/package.mjs:SDK 哈希校验通过,javac -Werror编译通过,三个 ZIP 逐字节相同。node scripts/test.mjs,JDK 17,Tomcat 9.0.124 + 10.1.62:42 项通过。覆盖以下内容:pom.xml产生一次降级记录;模型请求成功不记录;GRADLE_USER_HOME,结束时停止 Gradle daemon;测试结束后确认没有残留的 Tomcat、提供者或 Gradle 进程。宿主端到端测试(
e2e/host/,node scripts/e2e-host.mjs):test/java-plugin.json固定 SHA-256),JDK 21。TestTomcatPluginRunsAWebModule:页面可访问,运行窗口有 Tomcat 启动日志,Stop 后端口释放。TestTomcatPluginDebugsAWebModule:Java 调试器连接后,请求停在项目源码的断点上,Continue 后请求完成,从调试窗口 Stop。host任务:ready 后和 main 上,在 Linux 用 linux-x64 包跑同一组测试。宿主测试暴露的宿主问题和处理:
initialize.locale选择中英文,在此之前提示总是英文。没有绕过。未验证:
pending。发现的契约缺口与过时资料
settings、sections和settingActions。没有绕过,已建 [Feature] 插件翻译文件支持构建系统的显示文字(运行项名称、构建选项和任务标题) 1lck/Lithe-IDEA#2139。sdk-java-v0.5.0发布不存在,Core 仓库没有任何 Release。本 PR 按现有插件的做法从源码引入 SDK,已建 [Bug] Java 插件 SDK 的 README 指向不存在的 sdk-java-v0.5.0 发布 1lck/Lithe-IDEA#2140。🤖 Generated with Claude Code