From dcc32106a72ec753bb382e2904f81ac9e5e79d3f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 20 Oct 2025 09:40:53 +0000 Subject: [PATCH 1/6] Initial plan From 9b764f53fa2fda1cef03208f724f1f7c90c7127a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 20 Oct 2025 09:51:49 +0000 Subject: [PATCH 2/6] Add missing deprecated constants to MavenCli for backward compatibility Co-authored-by: laeubi <1331477+laeubi@users.noreply.github.com> --- .../java/org/apache/maven/cli/MavenCli.java | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/compat/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java b/compat/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java index fec07d6979ff..5e8373742d89 100644 --- a/compat/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java +++ b/compat/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java @@ -140,8 +140,32 @@ @Deprecated public class MavenCli { + /** + * @deprecated Use {@link org.apache.maven.api.Constants#MAVEN_REPO_LOCAL} instead + */ + @Deprecated + public static final String LOCAL_REPO_PROPERTY = "maven.repo.local"; + public static final String MULTIMODULE_PROJECT_DIRECTORY = "maven.multiModuleProjectDirectory"; + /** + * @deprecated Use {@link System#getProperty(String)} with "user.home" instead + */ + @Deprecated + public static final String USER_HOME = System.getProperty("user.home"); + + /** + * @deprecated Use {@link org.apache.maven.api.Constants#MAVEN_USER_CONF} instead + */ + @Deprecated + public static final File USER_MAVEN_CONFIGURATION_HOME = new File(USER_HOME, ".m2"); + + /** + * @deprecated Use {@link org.apache.maven.api.Constants#MAVEN_STYLE_COLOR_PROPERTY} instead + */ + @Deprecated + public static final String STYLE_COLOR_PROPERTY = "style.color"; + private static final String MVN_MAVEN_CONFIG = ".mvn/maven.config"; private ClassWorld classWorld; From dff0f7f8ccdee28a1cdcafab36d8306941e51a26 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 20 Oct 2025 10:23:49 +0000 Subject: [PATCH 3/6] Add missing extension model classes for backward compatibility - 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> --- .../ExtensionResolutionException.java | 24 +++- .../extension/model/CoreExtension.java | 118 ++++++++++++++++++ .../extension/model/CoreExtensions.java | 72 +++++++++++ 3 files changed, 213 insertions(+), 1 deletion(-) create mode 100644 compat/maven-embedder/src/main/java/org/apache/maven/cli/internal/extension/model/CoreExtension.java create mode 100644 compat/maven-embedder/src/main/java/org/apache/maven/cli/internal/extension/model/CoreExtensions.java diff --git a/compat/maven-embedder/src/main/java/org/apache/maven/cli/internal/ExtensionResolutionException.java b/compat/maven-embedder/src/main/java/org/apache/maven/cli/internal/ExtensionResolutionException.java index 56a601901f13..87e62f8360a4 100644 --- a/compat/maven-embedder/src/main/java/org/apache/maven/cli/internal/ExtensionResolutionException.java +++ b/compat/maven-embedder/src/main/java/org/apache/maven/cli/internal/ExtensionResolutionException.java @@ -18,7 +18,7 @@ */ package org.apache.maven.cli.internal; -import org.apache.maven.api.cli.extensions.CoreExtension; +import org.apache.maven.cli.internal.extension.model.CoreExtension; /** * Exception occurring trying to resolve a plugin. @@ -37,6 +37,28 @@ public ExtensionResolutionException(CoreExtension extension, Throwable cause) { this.extension = extension; } + /** + * Constructor accepting the new API type for internal use. + * + * @param extension the new API extension + * @param cause the cause + */ + public ExtensionResolutionException(org.apache.maven.api.cli.extensions.CoreExtension extension, Throwable cause) { + super( + "Extension " + extension.getId() + " or one of its dependencies could not be resolved: " + + cause.getMessage(), + cause); + // Convert to old type + CoreExtension oldExtension = new CoreExtension(); + oldExtension.setGroupId(extension.getGroupId()); + oldExtension.setArtifactId(extension.getArtifactId()); + oldExtension.setVersion(extension.getVersion()); + if (extension.getClassLoadingStrategy() != null) { + oldExtension.setClassLoadingStrategy(extension.getClassLoadingStrategy()); + } + this.extension = oldExtension; + } + public CoreExtension getExtension() { return extension; } diff --git a/compat/maven-embedder/src/main/java/org/apache/maven/cli/internal/extension/model/CoreExtension.java b/compat/maven-embedder/src/main/java/org/apache/maven/cli/internal/extension/model/CoreExtension.java new file mode 100644 index 000000000000..44ecf0d81514 --- /dev/null +++ b/compat/maven-embedder/src/main/java/org/apache/maven/cli/internal/extension/model/CoreExtension.java @@ -0,0 +1,118 @@ +/* + * 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.maven.cli.internal.extension.model; + +/** + * Describes a build extension to utilise. + * + * @deprecated Use {@link org.apache.maven.api.cli.extensions.CoreExtension} instead + */ +@Deprecated +public class CoreExtension implements java.io.Serializable { + + private String groupId; + + private String artifactId; + + private String version; + + private String classLoadingStrategy = "self-first"; + + /** + * Gets the group ID of the extension's artifact. + * + * @return the group ID + */ + public String getGroupId() { + return this.groupId; + } + + /** + * Sets the group ID of the extension's artifact. + * + * @param groupId the group ID + */ + public void setGroupId(String groupId) { + this.groupId = groupId; + } + + /** + * Gets the artifact ID of the extension. + * + * @return the artifact ID + */ + public String getArtifactId() { + return this.artifactId; + } + + /** + * Sets the artifact ID of the extension. + * + * @param artifactId the artifact ID + */ + public void setArtifactId(String artifactId) { + this.artifactId = artifactId; + } + + /** + * Gets the version of the extension. + * + * @return the version + */ + public String getVersion() { + return this.version; + } + + /** + * Sets the version of the extension. + * + * @param version the version + */ + public void setVersion(String version) { + this.version = version; + } + + /** + * Gets the class loading strategy. + * + * @return the class loading strategy + */ + public String getClassLoadingStrategy() { + return this.classLoadingStrategy; + } + + /** + * Sets the class loading strategy. + * + * @param classLoadingStrategy the class loading strategy + */ + public void setClassLoadingStrategy(String classLoadingStrategy) { + this.classLoadingStrategy = classLoadingStrategy; + } + + /** + * Gets the identifier of the extension. + * + * @return the extension id + */ + public String getId() { + return (groupId != null ? groupId : "") + ":" + (artifactId != null ? artifactId : "") + ":" + + (version != null ? version : ""); + } +} diff --git a/compat/maven-embedder/src/main/java/org/apache/maven/cli/internal/extension/model/CoreExtensions.java b/compat/maven-embedder/src/main/java/org/apache/maven/cli/internal/extension/model/CoreExtensions.java new file mode 100644 index 000000000000..cf385d3b46a6 --- /dev/null +++ b/compat/maven-embedder/src/main/java/org/apache/maven/cli/internal/extension/model/CoreExtensions.java @@ -0,0 +1,72 @@ +/* + * 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.maven.cli.internal.extension.model; + +import java.util.ArrayList; +import java.util.List; + +/** + * Extensions to load. + * + * @deprecated Use {@link org.apache.maven.api.cli.extensions.CoreExtension} instead + */ +@Deprecated +public class CoreExtensions implements java.io.Serializable { + + private List extensions; + + /** + * Gets a set of build extensions to use from this project. + * + * @return the list of extensions + */ + public List getExtensions() { + if (this.extensions == null) { + this.extensions = new ArrayList<>(); + } + return this.extensions; + } + + /** + * Sets a set of build extensions to use from this project. + * + * @param extensions the list of extensions + */ + public void setExtensions(List extensions) { + this.extensions = extensions; + } + + /** + * Adds an extension to the list. + * + * @param extension the extension to add + */ + public void addExtension(CoreExtension extension) { + getExtensions().add(extension); + } + + /** + * Removes an extension from the list. + * + * @param extension the extension to remove + */ + public void removeExtension(CoreExtension extension) { + getExtensions().remove(extension); + } +} From ff3bc7bb0a3de823647bb8427fef36e9830ec90e Mon Sep 17 00:00:00 2001 From: Guillaume Nodet Date: Thu, 23 Oct 2025 20:38:01 +0200 Subject: [PATCH 4/6] Add missing xpp3 reader/writer --- .../extension/model/CoreExtension.java | 123 ++-- .../extension/model/CoreExtensions.java | 77 +- .../io/xpp3/CoreExtensionsXpp3Reader.java | 692 ++++++++++++++++++ .../io/xpp3/CoreExtensionsXpp3Writer.java | 173 +++++ 4 files changed, 1002 insertions(+), 63 deletions(-) create mode 100644 compat/maven-embedder/src/main/java/org/apache/maven/cli/internal/extension/model/io/xpp3/CoreExtensionsXpp3Reader.java create mode 100644 compat/maven-embedder/src/main/java/org/apache/maven/cli/internal/extension/model/io/xpp3/CoreExtensionsXpp3Writer.java diff --git a/compat/maven-embedder/src/main/java/org/apache/maven/cli/internal/extension/model/CoreExtension.java b/compat/maven-embedder/src/main/java/org/apache/maven/cli/internal/extension/model/CoreExtension.java index 44ecf0d81514..c5ece38537d8 100644 --- a/compat/maven-embedder/src/main/java/org/apache/maven/cli/internal/extension/model/CoreExtension.java +++ b/compat/maven-embedder/src/main/java/org/apache/maven/cli/internal/extension/model/CoreExtension.java @@ -24,95 +24,132 @@ * @deprecated Use {@link org.apache.maven.api.cli.extensions.CoreExtension} instead */ @Deprecated +@SuppressWarnings("all") public class CoreExtension implements java.io.Serializable { + // --------------------------/ + // - Class/Member Variables -/ + // --------------------------/ + + /** + * The group ID of the extension's artifact. + */ private String groupId; + /** + * The artifact ID of the extension. + */ private String artifactId; + /** + * The version of the extension. + */ private String version; + /** + * The class loading strategy: 'self-first' (the default), + * 'parent-first' (loads classes from the parent, then from the + * extension) or 'plugin' (follows the rules from extensions + * defined as plugins). + */ private String classLoadingStrategy = "self-first"; + // -----------/ + // - Methods -/ + // -----------/ + /** - * Gets the group ID of the extension's artifact. + * Get the artifact ID of the extension. * - * @return the group ID + * @return String */ - public String getGroupId() { - return this.groupId; - } + public String getArtifactId() { + return this.artifactId; + } // -- String getArtifactId() /** - * Sets the group ID of the extension's artifact. + * Get the class loading strategy: 'self-first' (the default), + * 'parent-first' (loads classes from the parent, then from the + * extension) or 'plugin' (follows the rules from extensions + * defined as plugins). * - * @param groupId the group ID + * @return String */ - public void setGroupId(String groupId) { - this.groupId = groupId; - } + public String getClassLoadingStrategy() { + return this.classLoadingStrategy; + } // -- String getClassLoadingStrategy() /** - * Gets the artifact ID of the extension. + * Get the group ID of the extension's artifact. * - * @return the artifact ID + * @return String */ - public String getArtifactId() { - return this.artifactId; - } + public String getGroupId() { + return this.groupId; + } // -- String getGroupId() /** - * Sets the artifact ID of the extension. + * Get the version of the extension. * - * @param artifactId the artifact ID + * @return String */ - public void setArtifactId(String artifactId) { - this.artifactId = artifactId; - } + public String getVersion() { + return this.version; + } // -- String getVersion() /** - * Gets the version of the extension. + * Set the artifact ID of the extension. * - * @return the version + * @param artifactId a artifactId object. */ - public String getVersion() { - return this.version; - } + public void setArtifactId(String artifactId) { + this.artifactId = artifactId; + } // -- void setArtifactId( String ) /** - * Sets the version of the extension. + * Set the class loading strategy: 'self-first' (the default), + * 'parent-first' (loads classes from the parent, then from the + * extension) or 'plugin' (follows the rules from extensions + * defined as plugins). * - * @param version the version + * @param classLoadingStrategy a classLoadingStrategy object. */ - public void setVersion(String version) { - this.version = version; - } + public void setClassLoadingStrategy(String classLoadingStrategy) { + this.classLoadingStrategy = classLoadingStrategy; + } // -- void setClassLoadingStrategy( String ) /** - * Gets the class loading strategy. + * Set the group ID of the extension's artifact. * - * @return the class loading strategy + * @param groupId a groupId object. */ - public String getClassLoadingStrategy() { - return this.classLoadingStrategy; - } + public void setGroupId(String groupId) { + this.groupId = groupId; + } // -- void setGroupId( String ) /** - * Sets the class loading strategy. + * Set the version of the extension. * - * @param classLoadingStrategy the class loading strategy + * @param version a version object. */ - public void setClassLoadingStrategy(String classLoadingStrategy) { - this.classLoadingStrategy = classLoadingStrategy; - } + public void setVersion(String version) { + this.version = version; + } // -- void setVersion( String ) /** * Gets the identifier of the extension. * - * @return the extension id + * @return The extension id in the form {@code ::}, never {@code null}. */ public String getId() { - return (groupId != null ? groupId : "") + ":" + (artifactId != null ? artifactId : "") + ":" - + (version != null ? version : ""); + StringBuilder id = new StringBuilder(128); + + id.append((getGroupId() == null) ? "[unknown-group-id]" : getGroupId()); + id.append(":"); + id.append((getArtifactId() == null) ? "[unknown-artifact-id]" : getArtifactId()); + id.append(":"); + id.append((getVersion() == null) ? "[unknown-version]" : getVersion()); + + return id.toString(); } } diff --git a/compat/maven-embedder/src/main/java/org/apache/maven/cli/internal/extension/model/CoreExtensions.java b/compat/maven-embedder/src/main/java/org/apache/maven/cli/internal/extension/model/CoreExtensions.java index cf385d3b46a6..6a9f88636db7 100644 --- a/compat/maven-embedder/src/main/java/org/apache/maven/cli/internal/extension/model/CoreExtensions.java +++ b/compat/maven-embedder/src/main/java/org/apache/maven/cli/internal/extension/model/CoreExtensions.java @@ -18,6 +18,7 @@ */ package org.apache.maven.cli.internal.extension.model; +import java.io.Serializable; import java.util.ArrayList; import java.util.List; @@ -27,46 +28,82 @@ * @deprecated Use {@link org.apache.maven.api.cli.extensions.CoreExtension} instead */ @Deprecated -public class CoreExtensions implements java.io.Serializable { +@SuppressWarnings("all") +public class CoreExtensions implements Serializable { + // --------------------------/ + // - Class/Member Variables -/ + // --------------------------/ + + /** + * Field extensions. + */ private List extensions; /** - * Gets a set of build extensions to use from this project. + * Field modelEncoding. + */ + private String modelEncoding = "UTF-8"; + + // -----------/ + // - Methods -/ + // -----------/ + + /** + * Method addExtension. + * + * @param coreExtension a coreExtension object. + */ + public void addExtension(CoreExtension coreExtension) { + getExtensions().add(coreExtension); + } // -- void addExtension( CoreExtension ) + + /** + * Method getExtensions. * - * @return the list of extensions + * @return List */ public List getExtensions() { if (this.extensions == null) { - this.extensions = new ArrayList<>(); + this.extensions = new ArrayList(); } + return this.extensions; - } + } // -- List getExtensions() /** - * Sets a set of build extensions to use from this project. + * Get the modelEncoding field. * - * @param extensions the list of extensions + * @return String */ - public void setExtensions(List extensions) { - this.extensions = extensions; - } + public String getModelEncoding() { + return this.modelEncoding; + } // -- String getModelEncoding() + + /** + * Method removeExtension. + * + * @param coreExtension a coreExtension object. + */ + public void removeExtension(CoreExtension coreExtension) { + getExtensions().remove(coreExtension); + } // -- void removeExtension( CoreExtension ) /** - * Adds an extension to the list. + * Set a set of build extensions to use from this project. * - * @param extension the extension to add + * @param extensions a extensions object. */ - public void addExtension(CoreExtension extension) { - getExtensions().add(extension); - } + public void setExtensions(List extensions) { + this.extensions = extensions; + } // -- void setExtensions( List ) /** - * Removes an extension from the list. + * Set the modelEncoding field. * - * @param extension the extension to remove + * @param modelEncoding a modelEncoding object. */ - public void removeExtension(CoreExtension extension) { - getExtensions().remove(extension); - } + public void setModelEncoding(String modelEncoding) { + this.modelEncoding = modelEncoding; + } // -- void setModelEncoding( String ) } diff --git a/compat/maven-embedder/src/main/java/org/apache/maven/cli/internal/extension/model/io/xpp3/CoreExtensionsXpp3Reader.java b/compat/maven-embedder/src/main/java/org/apache/maven/cli/internal/extension/model/io/xpp3/CoreExtensionsXpp3Reader.java new file mode 100644 index 000000000000..04eb952da494 --- /dev/null +++ b/compat/maven-embedder/src/main/java/org/apache/maven/cli/internal/extension/model/io/xpp3/CoreExtensionsXpp3Reader.java @@ -0,0 +1,692 @@ +/* + * 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.maven.cli.internal.extension.model.io.xpp3; + +// ---------------------------------/ +// - Imported classes and packages -/ +// ---------------------------------/ + +import java.io.IOException; +import java.io.InputStream; +import java.io.Reader; +import java.text.DateFormat; + +import org.apache.maven.cli.internal.extension.model.CoreExtension; +import org.apache.maven.cli.internal.extension.model.CoreExtensions; +import org.codehaus.plexus.util.xml.XmlStreamReader; +import org.codehaus.plexus.util.xml.pull.EntityReplacementMap; +import org.codehaus.plexus.util.xml.pull.MXParser; +import org.codehaus.plexus.util.xml.pull.XmlPullParser; +import org.codehaus.plexus.util.xml.pull.XmlPullParserException; + +/** + * Class CoreExtensionsXpp3Reader. + * + * @deprecated use {@code org.apache.maven.cling.internal.extension.io.CoreExtensionsStaxReader} + */ +@Deprecated +@SuppressWarnings("all") +public class CoreExtensionsXpp3Reader { + + // --------------------------/ + // - Class/Member Variables -/ + // --------------------------/ + + /** + * If set the parser will be loaded with all single characters + * from the XHTML specification. + * The entities used: + *
    + *
  • http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent
  • + *
  • http://www.w3.org/TR/xhtml1/DTD/xhtml-special.ent
  • + *
  • http://www.w3.org/TR/xhtml1/DTD/xhtml-symbol.ent
  • + *
+ */ + private boolean addDefaultEntities = true; + + /** + * Field contentTransformer. + */ + public final ContentTransformer contentTransformer; + + // ----------------/ + // - Constructors -/ + // ----------------/ + + public CoreExtensionsXpp3Reader() { + this(new ContentTransformer() { + public String transform(String source, String fieldName) { + return source; + } + }); + } // -- org.apache.maven.cli.internal.extension.model.io.xpp3.CoreExtensionsXpp3Reader() + + public CoreExtensionsXpp3Reader(ContentTransformer contentTransformer) { + this.contentTransformer = contentTransformer; + } // -- org.apache.maven.cli.internal.extension.model.io.xpp3.CoreExtensionsXpp3Reader(ContentTransformer) + + // -----------/ + // - Methods -/ + // -----------/ + + /** + * Method checkFieldWithDuplicate. + * + * @param parser a parser object. + * @param parsed a parsed object. + * @param alias a alias object. + * @param tagName a tagName object. + * @throws XmlPullParserException XmlPullParserException if + * any. + * @return boolean + */ + private boolean checkFieldWithDuplicate( + XmlPullParser parser, String tagName, String alias, java.util.Set parsed) + throws XmlPullParserException { + if (!(parser.getName().equals(tagName) || parser.getName().equals(alias))) { + return false; + } + if (!parsed.add(tagName)) { + throw new XmlPullParserException("Duplicated tag: '" + tagName + "'", parser, null); + } + return true; + } // -- boolean checkFieldWithDuplicate( XmlPullParser, String, String, java.util.Set ) + + /** + * Method checkUnknownAttribute. + * + * @param parser a parser object. + * @param strict a strict object. + * @param tagName a tagName object. + * @param attribute a attribute object. + * @throws XmlPullParserException XmlPullParserException if + * any. + * @throws IOException IOException if any. + */ + private void checkUnknownAttribute(XmlPullParser parser, String attribute, String tagName, boolean strict) + throws XmlPullParserException, IOException { + // strictXmlAttributes = true for model: if strict == true, not only elements are checked but attributes too + if (strict) { + throw new XmlPullParserException( + "Unknown attribute '" + attribute + "' for tag '" + tagName + "'", parser, null); + } + } // -- void checkUnknownAttribute( XmlPullParser, String, String, boolean ) + + /** + * Method checkUnknownElement. + * + * @param parser a parser object. + * @param strict a strict object. + * @throws XmlPullParserException XmlPullParserException if + * any. + * @throws IOException IOException if any. + */ + private void checkUnknownElement(XmlPullParser parser, boolean strict) throws XmlPullParserException, IOException { + if (strict) { + throw new XmlPullParserException("Unrecognised tag: '" + parser.getName() + "'", parser, null); + } + + for (int unrecognizedTagCount = 1; unrecognizedTagCount > 0; ) { + int eventType = parser.next(); + if (eventType == XmlPullParser.START_TAG) { + unrecognizedTagCount++; + } else if (eventType == XmlPullParser.END_TAG) { + unrecognizedTagCount--; + } + } + } // -- void checkUnknownElement( XmlPullParser, boolean ) + + /** + * Returns the state of the "add default entities" flag. + * + * @return boolean + */ + public boolean getAddDefaultEntities() { + return addDefaultEntities; + } // -- boolean getAddDefaultEntities() + + /** + * Method getBooleanValue. + * + * @param s a s object. + * @param parser a parser object. + * @param attribute a attribute object. + * @throws XmlPullParserException XmlPullParserException if + * any. + * @return boolean + */ + private boolean getBooleanValue(String s, String attribute, XmlPullParser parser) throws XmlPullParserException { + return getBooleanValue(s, attribute, parser, null); + } // -- boolean getBooleanValue( String, String, XmlPullParser ) + + /** + * Method getBooleanValue. + * + * @param s a s object. + * @param defaultValue a defaultValue object. + * @param parser a parser object. + * @param attribute a attribute object. + * @throws XmlPullParserException XmlPullParserException if + * any. + * @return boolean + */ + private boolean getBooleanValue(String s, String attribute, XmlPullParser parser, String defaultValue) + throws XmlPullParserException { + if (s != null && s.length() != 0) { + return Boolean.valueOf(s).booleanValue(); + } + if (defaultValue != null) { + return Boolean.valueOf(defaultValue).booleanValue(); + } + return false; + } // -- boolean getBooleanValue( String, String, XmlPullParser, String ) + + /** + * Method getByteValue. + * + * @param s a s object. + * @param strict a strict object. + * @param parser a parser object. + * @param attribute a attribute object. + * @throws XmlPullParserException XmlPullParserException if + * any. + * @return byte + */ + private byte getByteValue(String s, String attribute, XmlPullParser parser, boolean strict) + throws XmlPullParserException { + if (s != null) { + try { + return Byte.valueOf(s).byteValue(); + } catch (NumberFormatException nfe) { + if (strict) { + throw new XmlPullParserException( + "Unable to parse element '" + attribute + "', must be a byte", parser, nfe); + } + } + } + return 0; + } // -- byte getByteValue( String, String, XmlPullParser, boolean ) + + /** + * Method getCharacterValue. + * + * @param s a s object. + * @param parser a parser object. + * @param attribute a attribute object. + * @throws XmlPullParserException XmlPullParserException if + * any. + * @return char + */ + private char getCharacterValue(String s, String attribute, XmlPullParser parser) throws XmlPullParserException { + if (s != null) { + return s.charAt(0); + } + return 0; + } // -- char getCharacterValue( String, String, XmlPullParser ) + + /** + * Method getDateValue. + * + * @param s a s object. + * @param parser a parser object. + * @param attribute a attribute object. + * @throws XmlPullParserException XmlPullParserException if + * any. + * @return Date + */ + private java.util.Date getDateValue(String s, String attribute, XmlPullParser parser) + throws XmlPullParserException { + return getDateValue(s, attribute, null, parser); + } // -- java.util.Date getDateValue( String, String, XmlPullParser ) + + /** + * Method getDateValue. + * + * @param s a s object. + * @param parser a parser object. + * @param dateFormat a dateFormat object. + * @param attribute a attribute object. + * @throws XmlPullParserException XmlPullParserException if + * any. + * @return Date + */ + private java.util.Date getDateValue(String s, String attribute, String dateFormat, XmlPullParser parser) + throws XmlPullParserException { + if (s != null) { + String effectiveDateFormat = dateFormat; + if (dateFormat == null) { + effectiveDateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSS"; + } + if ("long".equals(effectiveDateFormat)) { + try { + return new java.util.Date(Long.parseLong(s)); + } catch (NumberFormatException e) { + throw new XmlPullParserException(e.getMessage(), parser, e); + } + } else { + try { + DateFormat dateParser = new java.text.SimpleDateFormat(effectiveDateFormat, java.util.Locale.US); + return dateParser.parse(s); + } catch (java.text.ParseException e) { + throw new XmlPullParserException(e.getMessage(), parser, e); + } + } + } + return null; + } // -- java.util.Date getDateValue( String, String, String, XmlPullParser ) + + /** + * Method getDoubleValue. + * + * @param s a s object. + * @param strict a strict object. + * @param parser a parser object. + * @param attribute a attribute object. + * @throws XmlPullParserException XmlPullParserException if + * any. + * @return double + */ + private double getDoubleValue(String s, String attribute, XmlPullParser parser, boolean strict) + throws XmlPullParserException { + if (s != null) { + try { + return Double.valueOf(s).doubleValue(); + } catch (NumberFormatException nfe) { + if (strict) { + throw new XmlPullParserException( + "Unable to parse element '" + attribute + "', must be a floating point number", + parser, + nfe); + } + } + } + return 0; + } // -- double getDoubleValue( String, String, XmlPullParser, boolean ) + + /** + * Method getFloatValue. + * + * @param s a s object. + * @param strict a strict object. + * @param parser a parser object. + * @param attribute a attribute object. + * @throws XmlPullParserException XmlPullParserException if + * any. + * @return float + */ + private float getFloatValue(String s, String attribute, XmlPullParser parser, boolean strict) + throws XmlPullParserException { + if (s != null) { + try { + return Float.valueOf(s).floatValue(); + } catch (NumberFormatException nfe) { + if (strict) { + throw new XmlPullParserException( + "Unable to parse element '" + attribute + "', must be a floating point number", + parser, + nfe); + } + } + } + return 0; + } // -- float getFloatValue( String, String, XmlPullParser, boolean ) + + /** + * Method getIntegerValue. + * + * @param s a s object. + * @param strict a strict object. + * @param parser a parser object. + * @param attribute a attribute object. + * @throws XmlPullParserException XmlPullParserException if + * any. + * @return int + */ + private int getIntegerValue(String s, String attribute, XmlPullParser parser, boolean strict) + throws XmlPullParserException { + if (s != null) { + try { + return Integer.valueOf(s).intValue(); + } catch (NumberFormatException nfe) { + if (strict) { + throw new XmlPullParserException( + "Unable to parse element '" + attribute + "', must be an integer", parser, nfe); + } + } + } + return 0; + } // -- int getIntegerValue( String, String, XmlPullParser, boolean ) + + /** + * Method getLongValue. + * + * @param s a s object. + * @param strict a strict object. + * @param parser a parser object. + * @param attribute a attribute object. + * @throws XmlPullParserException XmlPullParserException if + * any. + * @return long + */ + private long getLongValue(String s, String attribute, XmlPullParser parser, boolean strict) + throws XmlPullParserException { + if (s != null) { + try { + return Long.valueOf(s).longValue(); + } catch (NumberFormatException nfe) { + if (strict) { + throw new XmlPullParserException( + "Unable to parse element '" + attribute + "', must be a long integer", parser, nfe); + } + } + } + return 0; + } // -- long getLongValue( String, String, XmlPullParser, boolean ) + + /** + * Method getRequiredAttributeValue. + * + * @param s a s object. + * @param strict a strict object. + * @param parser a parser object. + * @param attribute a attribute object. + * @throws XmlPullParserException XmlPullParserException if + * any. + * @return String + */ + private String getRequiredAttributeValue(String s, String attribute, XmlPullParser parser, boolean strict) + throws XmlPullParserException { + if (s == null) { + if (strict) { + throw new XmlPullParserException( + "Missing required value for attribute '" + attribute + "'", parser, null); + } + } + return s; + } // -- String getRequiredAttributeValue( String, String, XmlPullParser, boolean ) + + /** + * Method getShortValue. + * + * @param s a s object. + * @param strict a strict object. + * @param parser a parser object. + * @param attribute a attribute object. + * @throws XmlPullParserException XmlPullParserException if + * any. + * @return short + */ + private short getShortValue(String s, String attribute, XmlPullParser parser, boolean strict) + throws XmlPullParserException { + if (s != null) { + try { + return Short.valueOf(s).shortValue(); + } catch (NumberFormatException nfe) { + if (strict) { + throw new XmlPullParserException( + "Unable to parse element '" + attribute + "', must be a short integer", parser, nfe); + } + } + } + return 0; + } // -- short getShortValue( String, String, XmlPullParser, boolean ) + + /** + * Method getTrimmedValue. + * + * @param s a s object. + * @return String + */ + private String getTrimmedValue(String s) { + if (s != null) { + s = s.trim(); + } + return s; + } // -- String getTrimmedValue( String ) + + /** + * Method interpolatedTrimmed. + * + * @param value a value object. + * @param context a context object. + * @return String + */ + private String interpolatedTrimmed(String value, String context) { + return getTrimmedValue(contentTransformer.transform(value, context)); + } // -- String interpolatedTrimmed( String, String ) + + /** + * Method nextTag. + * + * @param parser a parser object. + * @throws IOException IOException if any. + * @throws XmlPullParserException XmlPullParserException if + * any. + * @return int + */ + private int nextTag(XmlPullParser parser) throws IOException, XmlPullParserException { + int eventType = parser.next(); + if (eventType == XmlPullParser.TEXT) { + eventType = parser.next(); + } + if (eventType != XmlPullParser.START_TAG && eventType != XmlPullParser.END_TAG) { + throw new XmlPullParserException( + "expected START_TAG or END_TAG not " + XmlPullParser.TYPES[eventType], parser, null); + } + return eventType; + } // -- int nextTag( XmlPullParser ) + + /** + * Method read. + * + * @param parser a parser object. + * @param strict a strict object. + * @throws IOException IOException if any. + * @throws XmlPullParserException XmlPullParserException if + * any. + * @return CoreExtensions + */ + public CoreExtensions read(XmlPullParser parser, boolean strict) throws IOException, XmlPullParserException { + CoreExtensions coreExtensions = null; + int eventType = parser.getEventType(); + boolean parsed = false; + while (eventType != XmlPullParser.END_DOCUMENT) { + if (eventType == XmlPullParser.START_TAG) { + if (strict && !"extensions".equals(parser.getName())) { + throw new XmlPullParserException( + "Expected root element 'extensions' but found '" + parser.getName() + "'", parser, null); + } else if (parsed) { + // fallback, already expected a XmlPullParserException due to invalid XML + throw new XmlPullParserException("Duplicated tag: 'extensions'", parser, null); + } + coreExtensions = parseCoreExtensions(parser, strict); + coreExtensions.setModelEncoding(parser.getInputEncoding()); + parsed = true; + } + eventType = parser.next(); + } + if (parsed) { + return coreExtensions; + } + throw new XmlPullParserException( + "Expected root element 'extensions' but found no element at all: invalid XML document", parser, null); + } // -- CoreExtensions read( XmlPullParser, boolean ) + + /** + * @see XmlStreamReader + * + * @param reader a reader object. + * @param strict a strict object. + * @throws IOException IOException if any. + * @throws XmlPullParserException XmlPullParserException if + * any. + * @return CoreExtensions + */ + public CoreExtensions read(Reader reader, boolean strict) throws IOException, XmlPullParserException { + XmlPullParser parser = + addDefaultEntities ? new MXParser(EntityReplacementMap.defaultEntityReplacementMap) : new MXParser(); + + parser.setInput(reader); + + return read(parser, strict); + } // -- CoreExtensions read( Reader, boolean ) + + /** + * @see XmlStreamReader + * + * @param reader a reader object. + * @throws IOException IOException if any. + * @throws XmlPullParserException XmlPullParserException if + * any. + * @return CoreExtensions + */ + public CoreExtensions read(Reader reader) throws IOException, XmlPullParserException { + return read(reader, true); + } // -- CoreExtensions read( Reader ) + + /** + * Method read. + * + * @param in a in object. + * @param strict a strict object. + * @throws IOException IOException if any. + * @throws XmlPullParserException XmlPullParserException if + * any. + * @return CoreExtensions + */ + public CoreExtensions read(InputStream in, boolean strict) throws IOException, XmlPullParserException { + return read(new XmlStreamReader(in), strict); + } // -- CoreExtensions read( InputStream, boolean ) + + /** + * Method read. + * + * @param in a in object. + * @throws IOException IOException if any. + * @throws XmlPullParserException XmlPullParserException if + * any. + * @return CoreExtensions + */ + public CoreExtensions read(InputStream in) throws IOException, XmlPullParserException { + return read(new XmlStreamReader(in)); + } // -- CoreExtensions read( InputStream ) + + /** + * Method parseCoreExtension. + * + * @param parser a parser object. + * @param strict a strict object. + * @throws IOException IOException if any. + * @throws XmlPullParserException XmlPullParserException if + * any. + * @return CoreExtension + */ + private CoreExtension parseCoreExtension(XmlPullParser parser, boolean strict) + throws IOException, XmlPullParserException { + String tagName = parser.getName(); + CoreExtension coreExtension = new CoreExtension(); + for (int i = parser.getAttributeCount() - 1; i >= 0; i--) { + String name = parser.getAttributeName(i); + String value = parser.getAttributeValue(i); + + if (name.indexOf(':') >= 0) { + // just ignore attributes with non-default namespace (for example: xmlns:xsi) + } else { + checkUnknownAttribute(parser, name, tagName, strict); + } + } + java.util.Set parsed = new java.util.HashSet(); + while ((strict ? parser.nextTag() : nextTag(parser)) == XmlPullParser.START_TAG) { + if (checkFieldWithDuplicate(parser, "groupId", null, parsed)) { + coreExtension.setGroupId(interpolatedTrimmed(parser.nextText(), "groupId")); + } else if (checkFieldWithDuplicate(parser, "artifactId", null, parsed)) { + coreExtension.setArtifactId(interpolatedTrimmed(parser.nextText(), "artifactId")); + } else if (checkFieldWithDuplicate(parser, "version", null, parsed)) { + coreExtension.setVersion(interpolatedTrimmed(parser.nextText(), "version")); + } else if (checkFieldWithDuplicate(parser, "classLoadingStrategy", null, parsed)) { + coreExtension.setClassLoadingStrategy(interpolatedTrimmed(parser.nextText(), "classLoadingStrategy")); + } else { + checkUnknownElement(parser, strict); + } + } + return coreExtension; + } // -- CoreExtension parseCoreExtension( XmlPullParser, boolean ) + + /** + * Method parseCoreExtensions. + * + * @param parser a parser object. + * @param strict a strict object. + * @throws IOException IOException if any. + * @throws XmlPullParserException XmlPullParserException if + * any. + * @return CoreExtensions + */ + private CoreExtensions parseCoreExtensions(XmlPullParser parser, boolean strict) + throws IOException, XmlPullParserException { + String tagName = parser.getName(); + CoreExtensions coreExtensions = new CoreExtensions(); + for (int i = parser.getAttributeCount() - 1; i >= 0; i--) { + String name = parser.getAttributeName(i); + String value = parser.getAttributeValue(i); + + if (name.indexOf(':') >= 0) { + // just ignore attributes with non-default namespace (for example: xmlns:xsi) + } else if ("xmlns".equals(name)) { + // ignore xmlns attribute in root class, which is a reserved attribute name + } else { + checkUnknownAttribute(parser, name, tagName, strict); + } + } + java.util.Set parsed = new java.util.HashSet(); + while ((strict ? parser.nextTag() : nextTag(parser)) == XmlPullParser.START_TAG) { + if ("extension".equals(parser.getName())) { + java.util.List extensions = coreExtensions.getExtensions(); + if (extensions == null) { + extensions = new java.util.ArrayList(); + } + extensions.add(parseCoreExtension(parser, strict)); + coreExtensions.setExtensions(extensions); + } else { + checkUnknownElement(parser, strict); + } + } + return coreExtensions; + } // -- CoreExtensions parseCoreExtensions( XmlPullParser, boolean ) + + /** + * Sets the state of the "add default entities" flag. + * + * @param addDefaultEntities a addDefaultEntities object. + */ + public void setAddDefaultEntities(boolean addDefaultEntities) { + this.addDefaultEntities = addDefaultEntities; + } // -- void setAddDefaultEntities( boolean ) + + public static interface ContentTransformer { + /** + * Interpolate the value read from the xpp3 document + * @param source The source value + * @param fieldName A description of the field being interpolated. The implementation may use this to + * log stuff. + * @return The interpolated value. + */ + String transform(String source, String fieldName); + } +} diff --git a/compat/maven-embedder/src/main/java/org/apache/maven/cli/internal/extension/model/io/xpp3/CoreExtensionsXpp3Writer.java b/compat/maven-embedder/src/main/java/org/apache/maven/cli/internal/extension/model/io/xpp3/CoreExtensionsXpp3Writer.java new file mode 100644 index 000000000000..95fa069f02df --- /dev/null +++ b/compat/maven-embedder/src/main/java/org/apache/maven/cli/internal/extension/model/io/xpp3/CoreExtensionsXpp3Writer.java @@ -0,0 +1,173 @@ +/* + * 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.maven.cli.internal.extension.model.io.xpp3; + +// ---------------------------------/ +// - Imported classes and packages -/ +// ---------------------------------/ + +import java.io.IOException; +import java.io.OutputStream; +import java.io.Writer; +import java.util.Iterator; + +import org.apache.maven.cli.internal.extension.model.CoreExtension; +import org.apache.maven.cli.internal.extension.model.CoreExtensions; +import org.codehaus.plexus.util.xml.pull.MXSerializer; +import org.codehaus.plexus.util.xml.pull.XmlSerializer; + +/** + * Class CoreExtensionsXpp3Writer. + * + * @deprecated use {@code org.apache.maven.cling.internal.extension.io.CoreExtensionsStaxWriter} + */ +@Deprecated +@SuppressWarnings("all") +public class CoreExtensionsXpp3Writer { + + // --------------------------/ + // - Class/Member Variables -/ + // --------------------------/ + + /** + * Field NAMESPACE. + */ + private static final String NAMESPACE = null; + + /** + * Field fileComment. + */ + private String fileComment = null; + + // -----------/ + // - Methods -/ + // -----------/ + + /** + * Method setFileComment. + * + * @param fileComment a fileComment object. + */ + public void setFileComment(String fileComment) { + this.fileComment = fileComment; + } // -- void setFileComment( String ) + + /** + * Method write. + * + * @param writer a writer object. + * @param coreExtensions a coreExtensions object. + * @throws IOException IOException if any. + */ + public void write(Writer writer, CoreExtensions coreExtensions) throws IOException { + XmlSerializer serializer = new MXSerializer(); + serializer.setProperty("http://xmlpull.org/v1/doc/properties.html#serializer-indentation", " "); + serializer.setProperty("http://xmlpull.org/v1/doc/properties.html#serializer-line-separator", "\n"); + serializer.setOutput(writer); + serializer.startDocument(coreExtensions.getModelEncoding(), null); + writeCoreExtensions(coreExtensions, "extensions", serializer); + serializer.endDocument(); + } // -- void write( Writer, CoreExtensions ) + + /** + * Method write. + * + * @param stream a stream object. + * @param coreExtensions a coreExtensions object. + * @throws IOException IOException if any. + */ + public void write(OutputStream stream, CoreExtensions coreExtensions) throws IOException { + XmlSerializer serializer = new MXSerializer(); + serializer.setProperty("http://xmlpull.org/v1/doc/properties.html#serializer-indentation", " "); + serializer.setProperty("http://xmlpull.org/v1/doc/properties.html#serializer-line-separator", "\n"); + serializer.setOutput(stream, coreExtensions.getModelEncoding()); + serializer.startDocument(coreExtensions.getModelEncoding(), null); + writeCoreExtensions(coreExtensions, "extensions", serializer); + serializer.endDocument(); + } // -- void write( OutputStream, CoreExtensions ) + + /** + * Method writeCoreExtension. + * + * @param coreExtension a coreExtension object. + * @param serializer a serializer object. + * @param tagName a tagName object. + * @throws IOException IOException if any. + */ + private void writeCoreExtension(CoreExtension coreExtension, String tagName, XmlSerializer serializer) + throws IOException { + serializer.startTag(NAMESPACE, tagName); + if (coreExtension.getGroupId() != null) { + serializer + .startTag(NAMESPACE, "groupId") + .text(coreExtension.getGroupId()) + .endTag(NAMESPACE, "groupId"); + } + if (coreExtension.getArtifactId() != null) { + serializer + .startTag(NAMESPACE, "artifactId") + .text(coreExtension.getArtifactId()) + .endTag(NAMESPACE, "artifactId"); + } + if (coreExtension.getVersion() != null) { + serializer + .startTag(NAMESPACE, "version") + .text(coreExtension.getVersion()) + .endTag(NAMESPACE, "version"); + } + if ((coreExtension.getClassLoadingStrategy() != null) + && !coreExtension.getClassLoadingStrategy().equals("self-first")) { + serializer + .startTag(NAMESPACE, "classLoadingStrategy") + .text(coreExtension.getClassLoadingStrategy()) + .endTag(NAMESPACE, "classLoadingStrategy"); + } + serializer.endTag(NAMESPACE, tagName); + } // -- void writeCoreExtension( CoreExtension, String, XmlSerializer ) + + /** + * Method writeCoreExtensions. + * + * @param coreExtensions a coreExtensions object. + * @param serializer a serializer object. + * @param tagName a tagName object. + * @throws IOException IOException if any. + */ + private void writeCoreExtensions(CoreExtensions coreExtensions, String tagName, XmlSerializer serializer) + throws IOException { + if (this.fileComment != null) { + serializer.comment(this.fileComment); + } + serializer.setPrefix("", "http://maven.apache.org/EXTENSIONS/1.1.0"); + serializer.setPrefix("xsi", "http://www.w3.org/2001/XMLSchema-instance"); + serializer.startTag(NAMESPACE, tagName); + serializer.attribute( + "", + "xsi:schemaLocation", + "http://maven.apache.org/EXTENSIONS/1.1.0 https://maven.apache.org/xsd/core-extensions-1.1.0.xsd"); + if ((coreExtensions.getExtensions() != null) + && (coreExtensions.getExtensions().size() > 0)) { + for (Iterator iter = coreExtensions.getExtensions().iterator(); iter.hasNext(); ) { + CoreExtension o = (CoreExtension) iter.next(); + writeCoreExtension(o, "extension", serializer); + } + } + serializer.endTag(NAMESPACE, tagName); + } // -- void writeCoreExtensions( CoreExtensions, String, XmlSerializer ) +} From e5da309dbb90c7d7ec48abdbe7188e80857cc7dd Mon Sep 17 00:00:00 2001 From: Guillaume Nodet Date: Mon, 27 Oct 2025 10:43:19 +0100 Subject: [PATCH 5/6] Do not add @Deprecated on constants since the class already is --- .../src/main/java/org/apache/maven/cli/MavenCli.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/compat/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java b/compat/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java index 5e8373742d89..455a41547765 100644 --- a/compat/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java +++ b/compat/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java @@ -143,27 +143,26 @@ public class MavenCli { /** * @deprecated Use {@link org.apache.maven.api.Constants#MAVEN_REPO_LOCAL} instead */ - @Deprecated public static final String LOCAL_REPO_PROPERTY = "maven.repo.local"; + /** + * @deprecated Use {@link org.apache.maven.api.Session#getRootDirectory()} instead + */ public static final String MULTIMODULE_PROJECT_DIRECTORY = "maven.multiModuleProjectDirectory"; /** * @deprecated Use {@link System#getProperty(String)} with "user.home" instead */ - @Deprecated public static final String USER_HOME = System.getProperty("user.home"); /** * @deprecated Use {@link org.apache.maven.api.Constants#MAVEN_USER_CONF} instead */ - @Deprecated public static final File USER_MAVEN_CONFIGURATION_HOME = new File(USER_HOME, ".m2"); /** * @deprecated Use {@link org.apache.maven.api.Constants#MAVEN_STYLE_COLOR_PROPERTY} instead */ - @Deprecated public static final String STYLE_COLOR_PROPERTY = "style.color"; private static final String MVN_MAVEN_CONFIG = ".mvn/maven.config"; From 3b1422231f08f5d14d319aa14e117294e03767e8 Mon Sep 17 00:00:00 2001 From: Guillaume Nodet Date: Mon, 27 Oct 2025 10:47:29 +0100 Subject: [PATCH 6/6] Add two other missing constants --- .../src/main/java/org/apache/maven/cli/MavenCli.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/compat/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java b/compat/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java index 455a41547765..ebcb335ac074 100644 --- a/compat/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java +++ b/compat/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java @@ -160,6 +160,17 @@ public class MavenCli { */ public static final File USER_MAVEN_CONFIGURATION_HOME = new File(USER_HOME, ".m2"); + /** + * @deprecated Use {@link org.apache.maven.api.Constants#MAVEN_USER_TOOLCHAINS} instead + */ + public static final File DEFAULT_USER_TOOLCHAINS_FILE = new File(USER_MAVEN_CONFIGURATION_HOME, "toolchains.xml"); + + /** + * @deprecated Use {@link org.apache.maven.api.Constants#MAVEN_INSTALLATION_TOOLCHAINS} instead + */ + public static final File DEFAULT_GLOBAL_TOOLCHAINS_FILE = + new File(System.getProperty("maven.conf"), "toolchains.xml"); + /** * @deprecated Use {@link org.apache.maven.api.Constants#MAVEN_STYLE_COLOR_PROPERTY} instead */