Skip to content

Commit

Permalink
[MNG-8097] Outline the two different ways to reference a dependency
Browse files Browse the repository at this point in the history
(with a related artifact handler)
  • Loading branch information
kwin committed May 18, 2024
1 parent 7bf6308 commit 87229d3
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion content/apt/pom.apt.vm
Original file line number Diff line number Diff line change
Expand Up @@ -271,13 +271,20 @@ mvn install:install-file -Dfile=non-maven-proj.jar -DgroupId=some.group -Dartifa
you browse the Maven central repository, you will notice that the classifiers <<<sources>>> and <<<javadoc>>> are used
to deploy the project source code and API docs along with the packaged class files.

The classifier may also be derived from the <<type>> in case the related {{{/ref/current/maven-core/artifact-handlers.html} artifact handler}} defines one.

* <<type>>:\
Corresponds to the chosen dependency type. This defaults to <<<jar>>>. While it usually represents
the extension on the filename of the dependency, that is not always the case: a type can be mapped to a
the extension of the referenced artifact, that is not always the case: a type can be mapped to a
different extension and a classifier. The type often corresponds to the packaging used, though this is
also not always the case. Some examples are <<<jar>>>, <<<ejb-client>>> and <<<test-jar>>>:
see {{{/ref/current/maven-core/artifact-handlers.html}default artifact handlers}} for a list. New types can be
defined by plugins that set <<<extensions>>> to true, so this is not a complete list.

In case there is an artifact handler defined there are <two> different ways of referencing the same dependency:
By using the <extension> or by using the registered <type> value. The former considers all attributes from the artifact handler, while the latter
never adds the dependency to the classpath nor includes its dependencies. Further information in
{{{/repositories/artifacts.html#but-where-do-i-set-artifact-extension}Maven Artifacts}}.

* <<scope>>:\
This element refers to the classpath of the task at hand (compiling and runtime, testing, etc.) as well as
Expand Down

0 comments on commit 87229d3

Please sign in to comment.