Conversation
Co-authored-by: laeubi <1331477+laeubi@users.noreply.github.com>
|
@copilot the internal classes are there, but if you look here: https://github.com/laeubi/maven/tree/maven-3.9.x/maven-embedder/src/main/mdo there are some classes that are generated: Lines 186 to 195 in 8413c92 these are now missing in Maven 4 and also the return type has changed in an incompatible way: |
- Created org.apache.maven.cli.internal.extension.model package - Added CoreExtension and CoreExtensions classes (deprecated) - Updated ExtensionResolutionException to return old model type - Added overloaded constructor for compatibility with new API Co-authored-by: laeubi <1331477+laeubi@users.noreply.github.com>
Added the missing extension model classes in commit 9bf6ab5:
The classes match the structure that would have been generated from the Maven 3.9.x MDO file. All tests pass. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@laeubi LGTM, but the PR should be moved to apache/maven instead. |
|
Yeah I'm not 100% sure about this should I proceed on this? Especially as it now references the new API in maven4 maybe it should just be the case? |
Yes, I've seen the switch in the exception, I think it's fine. It's also fine to not try to generate the two classes See apache#11320 |
Many thanks! Closing as replaced by |
Description
Fixes apache#11300 by restoring missing public static constants and extension model classes in the
MavenCliclass that were present in Maven 3.x but are missing in the Maven 4 compatibility layer.Changes
Constants Restored
This PR adds the following deprecated constants to
org.apache.maven.cli.MavenClito maintain backward compatibility with existing code that depends on the Maven 3.x embedder API:LOCAL_REPO_PROPERTY- String constant for "maven.repo.local" propertyUSER_HOME- System property for user home directoryUSER_MAVEN_CONFIGURATION_HOME- Reference to the .m2 directorySTYLE_COLOR_PROPERTY- String constant for "style.color" propertyAll constants are marked with
@Deprecatedand include Javadoc pointing to the equivalent constants in the neworg.apache.maven.api.Constantsclass.Extension Model Classes Restored
This PR also restores the extension model classes that were previously generated from the MDO file in Maven 3.9.x:
org.apache.maven.cli.internal.extension.model.CoreExtension- Deprecated model class representing a build extensionorg.apache.maven.cli.internal.extension.model.CoreExtensions- Deprecated model class representing a collection of extensionsExtensionResolutionException API Fix
Updated
org.apache.maven.cli.internal.ExtensionResolutionExceptionto maintain backward compatibility:getExtension()return type fromorg.apache.maven.api.cli.extensions.CoreExtension(new API) toorg.apache.maven.cli.internal.extension.model.CoreExtension(Maven 3.x API)Rationale
The
MavenCliclass is already deprecated but serves as a compatibility layer for projects migrating from Maven 3.x to Maven 4. These constants and model classes were commonly used in embedder applications and their absence breaks backward compatibility unnecessarily. By restoring them with proper deprecation annotations, we:Extension Classes
The
org.apache.maven.cli.internalpackage contains the necessary extension-related classes:BootstrapCoreExtensionManager(deprecated)ExtensionResolutionException(deprecated, now with backward-compatible API)org.apache.maven.cli.internal.extension.modelpackage withCoreExtensionandCoreExtensionsclassesTesting
As per the issue description, no new tests were added - this change only restores missing API elements.
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.