Repository navigation
feat(maven): 识别默认激活的 Profiles 并导出取消激活前缀 - #30
Merged
Merged
Conversation
This was referenced Nov 18, 2026
Mucheen
marked this pull request as ready for review
November 18, 2026 02:17
使用 Maven 注入的 Profile 确认当前状态,解析项目 Maven 配置并保留 settings 和 packaging 激活规则。增加 Maven 版本矩阵和 Lithe 桌面 Profile 的回归覆盖,按宿主声明的构建提供者版本启用桌面用例。
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.
关联 Issue / Linked issue
Refs 1lck/Lithe-IDEA#2092(Maven / Build 面板识别
pom.xml的 Profiles 并勾选切换 Active Profiles)。配套通用协议与宿主改动:Lithe-IDEA/Lithe-core-rust#86,以及主仓库桌面端 PR 1lck/Lithe-IDEA#2118。
PR 类型 / Type
改动说明 / What changes
背景:
plugin.json已声明profiles多选构建选项(choicesFromModel: true、allowCustom: true、presentation: "tree"、arguments: ["-P", "${value}"]),且ModelExport已导出optionValues.profiles,但没有导出默认激活的 Profile 与取消激活前缀"-",导致<activeByDefault>true</activeByDefault>或settings.xml<activeProfiles>在未传-P时默认生效却无法在界面回显勾选,也无法通过取消勾选传-P -<profile>关闭。改动点:
导出无
-P时的真实默认激活 Profile 与取消前缀(LitheLifecycleParticipant.java、ModelExport.java)ProfileSelector与SettingsBuilder:SettingsBuilder直接读取全局与用户settings.xml(注意MavenSession.getSettings()是包装MavenExecutionRequest的SettingsAdapter,其getActiveProfiles()已混入命令行-P参数,不能直接当作默认集),取出真实的<activeProfiles>和settings.xml<profiles>。settings.xml的 Profile 构造不含命令行-P覆盖的DefaultProfileActivationContext(清理lithe.*与maven.ext.class.path内部属性),交由 Maven 原生ProfileSelector评估<activeByDefault>、<jdk>、<os>、<property>、<file>和settings.xml<activeProfiles>。litheBuildModel中输出optionDefaults.profiles(非空时)与optionExcludePrefixes.profiles = "-";同时过滤以-或!开头的非法 Profile ID。plugin.json:已有的globalArguments(${optionArguments:profiles})和RunPreparation.java(request.optionArguments)自动把-P ...应用到模型重读、依赖树、生命周期任务、插件目标、测试及应用运行/调试准备;旧宿主遇到未知模型字段会直接忽略,保持向后兼容。集成测试与宿主端到端测试(
scripts/test.mjs、e2e/host/.../official_maven_plugin_e2e_test.go、docs/feature-matrix.md)scripts/test.mjs:验证默认反应堆导出optionExcludePrefixes: { profiles: "-" },并新增带<activeByDefault>true</activeByDefault>子模块的多 Profile 反应堆测试,验证初始默认激活、-P -dev,prod切换以及-P -dev全部取消后激活模块随之切换且optionDefaults.profiles始终保持["dev"]。official_maven_plugin_e2e_test.go:新增TestOfficialMavenPluginSwitchesActiveProfilesInBuildTree,在桌面宿主中安装打包产物、展开 Build 窗口Profiles节点勾选切换dev→prod、执行compile核对字节码产物、关闭重开工程验证冷启动保持-P -dev,prod,并校验已安装插件包字节不变。docs/feature-matrix.md的java-maven-profiles-dependencies条目。范围检查 / Scope checks
ProfileSelector与SettingsBuilder,不手写第二套 Profile 激活规则。dist/、.artifacts/等构建产物或个人路径,测试进程已全部回收。验证 / Verification
node scripts/test-process.mjsnode scripts/package.mjsnode scripts/test.mjs(Maven 3.9.16)<activeByDefault>、-P -dev,prod与-P -dev切换检查)node --test --test-timeout=60000 scripts/package/*.test.mjsTestOfficialMavenPluginSwitchesActiveProfilesInBuildTree(挂载宿主分支 + Lithe-core-rust#86,真实 Maven 3.9.16)未能执行的检查:Windows 原生
mvn.cmd集成由 CI 执行;桌面原生窗口手工验收保持pending。