You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2022/10/24 09:09:42 UTC

[GitHub] [maven] gnodet commented on a diff in pull request #847: Add a README for plexus-utils

gnodet commented on code in PR #847:
URL: https://github.com/apache/maven/pull/847#discussion_r1003073467


##########
plexus-utils/README.md:
##########
@@ -0,0 +1,26 @@
+<!---
+ 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.
+-->
+Apache Maven Plexus Utils
+=========================
+
+This module is a repackaging of the `org.codehaus.plexus:plexus-utils` jar, which contains a few modified classes to allow a seamless transition between the maven 3.x and 4.x apis.
+
+The maven 4.x api is based on immutable data objects. The maven model contains a few classes that contain some open xml data (`Plugin`, `PluginExecution`, `ReportPlugin` and `ReportSet`). So the v3 API which was using the `org.codehaus.plexus.utils.xml.Xpp3Dom` class now wraps the `org.apache.maven.api.Dom` node.  This is completely transparent for existing plugins, but the correct (new) classes have to be used.

Review Comment:
   So the v3 api is unchanged.  It's the v4 api which now uses the new `Dom` interface.
   
   The v3 defines [`ConfigurationContainer#getConfiguration()`](https://maven.apache.org/ref/4-LATEST/apidocs/org/apache/maven/model/ConfigurationContainer.html#getConfiguration--) which returns `Object` but actually returns an `org.codehaus.plexus.util.xml.Xpp3Dom` object.
   The v4 api defines [`ConfigurationContainer#getConfiguration()`](https://maven.apache.org/ref/4-LATEST/apidocs/index.html) which returns a typed `org.apache.maven.api.xml.Dom` object.
   The point is to keep compatibility in v3, and the ability for v3 and v4 to coexists. So one has to wrap the other one.  Given v4 is immutable, v3 has to wrap v4 objects.  This works easily for all the generated classes.  The xml ones are a bit specific and need an adaptation of the plexus `Xpp3Dom` to now wrap the new `Dom` objects.
   
   Modello has no support for `org.apache.maven.api.Dom`.  It knows about a `DOM` type, but the existing generators (which aren't used in maven 4) translates to either `Object` in the interfaces or the plexus-utils `Xpp3Dom` when generating readers/writers.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org