You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "elharo (via GitHub)" <gi...@apache.org> on 2025/02/19 14:10:38 UTC

[PR] Clarify types, extensions, and classifiers [maven-site]

elharo opened a new pull request, #695:
URL: https://github.com/apache/maven-site/pull/695

   I found this page very confusing and hard to follow, so I rewrote it to more clearly distinguish between element values and internal properties. I tried to tighten up the language and indicate that type handlers also effect classifiers.


-- 
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


Re: [PR] Clarify types, extensions, and classifiers [maven-site]

Posted by "elharo (via GitHub)" <gi...@apache.org>.
elharo commented on code in PR #695:
URL: https://github.com/apache/maven-site/pull/695#discussion_r1977482362


##########
content/markdown/repositories/artifacts.md:
##########
@@ -55,50 +55,78 @@ snapshot version "1.0-20220119.164608-1" has the `baseVersion` "1.0-SNAPSHOT".
 So, `version` and `baseVersion` are linked, derived from each other, but **they have different values only in the
 case of snapshots**.
 
-## But where do I set the Artifact extension?
-
-In short, nowhere. Or maybe "you rarely have to". The Maven POM (where you declare your project, parent project,
-dependencies, plugins and other items), maps those elements onto artifact extensions with some extra logic.
-
-In case of "project" and "parent project" POMs (after the POM is made into an effective POM, that is, parent values have been inherited):
-
-| Artifact Property | Project POM (pom.xml) |  POM Artifact  |
-|-------------------|-----------------------|----------------|
-| groupId           | `project/groupId`     | -> groupId     |
-| artifactId        | `project/artifactId`  | -> artifactId  |
-| version           | `project/version`     | -> version     |
-| classifier        | -                     | "" (always)    |
-| extension         | -                     | `pom` (always) |
-
-In the case of "build plugins" and "build extensions", as they are JARs, this is how corresponding elements are mapped
-(for build extension change the XML path prefix to `project/build/extensions/extension[x]`):
-
-| Artifact Property |            Plugin in Project POM             | Plugin/Extension Artifact |
-|-------------------|----------------------------------------------|---------------------------|
-| groupId           | `project/build/plugins/plugin[x]/groupId`    | -> groupId                |
-| artifactId        | `project/build/plugins/plugin[x]/artifactId` | -> artifactId             |
-| version           | `project/build/plugins/plugin[x]/version`    | -> version                |
-| classifier        | -                                            | -> "" (always)            |
-| extension         | -                                            | -> `jar` (always)         |
-
-And finally, in the case of "dependencies", this is the mapping (no, scope is NOT part of artifact coordinates):
-
-| Artifact Property |            Dependency in Project POM            |            Dependency Artifact            |
-|-------------------|-------------------------------------------------|-------------------------------------------|
-| groupId           | `project/dependencies/dependency[x]/groupId`    | -> groupId                                |
-| artifactId        | `project/dependencies/dependency[x]/artifactId` | -> artifactId                             |
-| version           | `project/dependencies/dependency[x]/version`    | -> version                                |
-| classifier        | `project/dependencies/dependency[x]/classifier` | -> classifier                             |
-| extension         | `project/dependencies/dependency[x]/type`       | -> type handler provided, or same as type |
-
-Here, we need to make a short detour to explain "dependency type" and how it becomes an artifact extension.
-
-A dependency type determines how the artifact referenced by the dependency is used.
-For example, should it be added to comple-time classpath, the test classpath, or both?
-Plugins and extensions may define new types. This is usually required for plugins introducing
-a "packaging" (lifecycle mapping) by providing `ArtifactHandler` components with a name corresponding to type name.
-
-Out of the box, Maven Core defines the [following "types" (handled by the same named `ArtifactHandler` components)](/ref/current/maven-core/artifact-handlers.html):
+Maven pom.xml files identify artifacts via coordinates in four different ways, depending
+on what the artifact is and how it will be used.
+
+* A dependency of the project, often though not always a jar archive, is referenced by
+  a `dependency` element in either the `dependencies` or `dependenciesManagement` section.
+* The pom.xml file itself has coordinates given by the top-level `groupId`,
+  `artifactId`, and `version` elements.
+* A build plugin is referenced by a `plugin` element in the `plugins` section.
+* A build extension is referenced by an `extension` element in the `extensions` section.
+
+For POM artifacts that contain a project's pom.xml file, the artifact coordinates are set
+as follows:
+
+| Artifact Coordinate |     POM element      | Coordinate Value  |
+|---------------------|----------------------|-------------------|
+| groupId             | `project/groupId`    | -> group ID       |
+| artifactId          | `project/artifactId` | -> artifact ID    |
+| version             | `project/version`    | -> version string |
+| classifier          | -                    | "" (always)       |
+| extension           | -                    | "pom" (always)    |
+
+Coordinate values are computed after the POM is made into an effective POM;
+that is, after parent values have been inherited.
+
+Build plugin and build extension artifacts are JARs. For build plugins,

Review Comment:
   done



-- 
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


Re: [PR] Clarify types, extensions, and classifiers [maven-site]

Posted by "elharo (via GitHub)" <gi...@apache.org>.
elharo merged PR #695:
URL: https://github.com/apache/maven-site/pull/695


-- 
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


Re: [PR] Clarify types, extensions, and classifiers [maven-site]

Posted by "elharo (via GitHub)" <gi...@apache.org>.
elharo commented on code in PR #695:
URL: https://github.com/apache/maven-site/pull/695#discussion_r1968106299


##########
content/markdown/repositories/artifacts.md:
##########
@@ -115,16 +122,22 @@ Out of the box, Maven Core defines the [following "types" (handled by the same n
 | war          | `war`     |              |
 | **any**      | any       |              |
 
-From the table above, we can see that if we define the dependency type as "war", we will hit the "war" handler. That will
-result in using the `war` extension (which may not be obvious, as the type and extension we end up with are the same, but internally this
-indirection does happen). The "test-jar" is more obvious, as it translates to the `jar` extension. Finally, the **any**
-last row will be used if none of the above match. Hence in that case the "type" is used as the "extension". For example.
-if the dependency type is `<type>tar.gz</type>`, the extension will also be `tar.gz`.
-This table may be extended by plugins and extensions used in the build.
+From the table above, you can see that if the dependency type is "war",
+the extension is also `war` and the classifier is the value of the
+`classifier` element (if present) or the empty string if the `classifier` element
+is not present. If the type is "test-jar", the extension is
+"jar" and the classifier is "tests". If the type is not one of these 11 names, then the
+value of the "type" is used as the "extension". For example, if the `type` element
+is `<type>tar.gz</type>`, the extension will be `tar.gz`, and the classifier will
+be set by the `classifier` element. This
+table may be extended by plugins and extensions used in the build.
+
+<!-- TODO what if an explicit classifier element conflicts with the

Review Comment:
   done



-- 
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


Re: [PR] Clarify types, extensions, and classifiers [maven-site]

Posted by "Bukama (via GitHub)" <gi...@apache.org>.
Bukama commented on code in PR #695:
URL: https://github.com/apache/maven-site/pull/695#discussion_r1965436079


##########
content/markdown/repositories/artifacts.md:
##########
@@ -115,16 +122,22 @@ Out of the box, Maven Core defines the [following "types" (handled by the same n
 | war          | `war`     |              |
 | **any**      | any       |              |
 
-From the table above, we can see that if we define the dependency type as "war", we will hit the "war" handler. That will
-result in using the `war` extension (which may not be obvious, as the type and extension we end up with are the same, but internally this
-indirection does happen). The "test-jar" is more obvious, as it translates to the `jar` extension. Finally, the **any**
-last row will be used if none of the above match. Hence in that case the "type" is used as the "extension". For example.
-if the dependency type is `<type>tar.gz</type>`, the extension will also be `tar.gz`.
-This table may be extended by plugins and extensions used in the build.
+From the table above, you can see that if the dependency type is "war",
+the extension is also `war` and the classifier is the value of the
+`classifier` element (if present) or the empty string if the `classifier` element
+is not present. If the type is "test-jar", the extension is
+"jar" and the classifier is "tests". If the type is not one of these 11 names, then the
+value of the "type" is used as the "extension". For example, if the `type` element
+is `<type>tar.gz</type>`, the extension will be `tar.gz`, and the classifier will
+be set by the `classifier` element. This
+table may be extended by plugins and extensions used in the build.
+
+<!-- TODO what if an explicit classifier element conflicts with the

Review Comment:
   I suggest, we try to find out to leave no TODOs or create and issue for the TODO instead only having one in the code, where it gets forgotten.



-- 
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


Re: [PR] Clarify types, extensions, and classifiers [maven-site]

Posted by "slawekjaranowski (via GitHub)" <gi...@apache.org>.
slawekjaranowski commented on code in PR #695:
URL: https://github.com/apache/maven-site/pull/695#discussion_r1976672225


##########
content/markdown/repositories/artifacts.md:
##########
@@ -55,50 +55,78 @@ snapshot version "1.0-20220119.164608-1" has the `baseVersion` "1.0-SNAPSHOT".
 So, `version` and `baseVersion` are linked, derived from each other, but **they have different values only in the
 case of snapshots**.
 
-## But where do I set the Artifact extension?
-
-In short, nowhere. Or maybe "you rarely have to". The Maven POM (where you declare your project, parent project,
-dependencies, plugins and other items), maps those elements onto artifact extensions with some extra logic.
-
-In case of "project" and "parent project" POMs (after the POM is made into an effective POM, that is, parent values have been inherited):
-
-| Artifact Property | Project POM (pom.xml) |  POM Artifact  |
-|-------------------|-----------------------|----------------|
-| groupId           | `project/groupId`     | -> groupId     |
-| artifactId        | `project/artifactId`  | -> artifactId  |
-| version           | `project/version`     | -> version     |
-| classifier        | -                     | "" (always)    |
-| extension         | -                     | `pom` (always) |
-
-In the case of "build plugins" and "build extensions", as they are JARs, this is how corresponding elements are mapped
-(for build extension change the XML path prefix to `project/build/extensions/extension[x]`):
-
-| Artifact Property |            Plugin in Project POM             | Plugin/Extension Artifact |
-|-------------------|----------------------------------------------|---------------------------|
-| groupId           | `project/build/plugins/plugin[x]/groupId`    | -> groupId                |
-| artifactId        | `project/build/plugins/plugin[x]/artifactId` | -> artifactId             |
-| version           | `project/build/plugins/plugin[x]/version`    | -> version                |
-| classifier        | -                                            | -> "" (always)            |
-| extension         | -                                            | -> `jar` (always)         |
-
-And finally, in the case of "dependencies", this is the mapping (no, scope is NOT part of artifact coordinates):
-
-| Artifact Property |            Dependency in Project POM            |            Dependency Artifact            |
-|-------------------|-------------------------------------------------|-------------------------------------------|
-| groupId           | `project/dependencies/dependency[x]/groupId`    | -> groupId                                |
-| artifactId        | `project/dependencies/dependency[x]/artifactId` | -> artifactId                             |
-| version           | `project/dependencies/dependency[x]/version`    | -> version                                |
-| classifier        | `project/dependencies/dependency[x]/classifier` | -> classifier                             |
-| extension         | `project/dependencies/dependency[x]/type`       | -> type handler provided, or same as type |
-
-Here, we need to make a short detour to explain "dependency type" and how it becomes an artifact extension.
-
-A dependency type determines how the artifact referenced by the dependency is used.
-For example, should it be added to comple-time classpath, the test classpath, or both?
-Plugins and extensions may define new types. This is usually required for plugins introducing
-a "packaging" (lifecycle mapping) by providing `ArtifactHandler` components with a name corresponding to type name.
-
-Out of the box, Maven Core defines the [following "types" (handled by the same named `ArtifactHandler` components)](/ref/current/maven-core/artifact-handlers.html):
+Maven pom.xml files identify artifacts via coordinates in four different ways, depending
+on what the artifact is and how it will be used.
+
+* A dependency of the project, often though not always a jar archive, is referenced by
+  a `dependency` element in either the `dependencies` or `dependenciesManagement` section.
+* The pom.xml file itself has coordinates given by the top-level `groupId`,
+  `artifactId`, and `version` elements.
+* A build plugin is referenced by a `plugin` element in the `plugins` section.
+* A build extension is referenced by an `extension` element in the `extensions` section.
+
+For POM artifacts that contain a project's pom.xml file, the artifact coordinates are set
+as follows:
+
+| Artifact Coordinate |     POM element      | Coordinate Value  |
+|---------------------|----------------------|-------------------|
+| groupId             | `project/groupId`    | -> group ID       |
+| artifactId          | `project/artifactId` | -> artifact ID    |
+| version             | `project/version`    | -> version string |
+| classifier          | -                    | "" (always)       |
+| extension           | -                    | "pom" (always)    |
+
+Coordinate values are computed after the POM is made into an effective POM;
+that is, after parent values have been inherited.
+
+Build plugin and build extension artifacts are JARs. For build plugins,

Review Comment:
   Should we add info about `pluginManagement` as we have for `dependencyManagement`?



-- 
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


Re: [PR] Clarify types, extensions, and classifiers [maven-site]

Posted by "cstamas (via GitHub)" <gi...@apache.org>.
cstamas commented on PR #695:
URL: https://github.com/apache/maven-site/pull/695#issuecomment-2692823575

   LGTM, but as @slawekjaranowski says, let's keep it same (so cover management as well)


-- 
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