Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update artifact-handlers.apt #1466

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion maven-core/src/site/apt/artifact-handlers.apt
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Default Artifact Handlers Reference
*--------------------+---------------+------------+------------+-----------+---------------------+-----------------------+
|| type || classifier || extension || packaging || language || added to classpath || includesDependencies ||
*--------------------+---------------+------------+------------+-----------+---------------------+-----------------------+
| <<<pom>>> | | <= type> | <= type> | none | | |
| <<<pom>>> | | <= type>, Note: this differs for POM files outside the repository which usually use <<<xml>>> as filesystem extension. | <= type> | none | | |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

impossible to understand

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would appreciate a more helpful criticism!

Copy link
Member

@hboutemy hboutemy Apr 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry, we had so many discussions that I don't see how to tell.
as said by Tamasz, there is a mix
In addition, such a text will break the table display.

eventually, if you absolutely want to write something, you can add a note at the end of the page that could say something like:

Dependency type <<<pom>>> has an extension <<<.pom>>> because POM is stored in repositories as <<<artifactId-version.pom>>>.
During development, as stored in source control, the POM file is by default named <<<pom.xml>>>: it will be renamed during install/deploy to be later eventually used as a pom dependency

I don't see how useful it is, but it says what you seem to need to say and does not break the dependency type table

*--------------------+---------------+------------+------------+-----------+---------------------+-----------------------+
| <<<jar>>> | | <= type> | <= type> | java | <<<true>>> | |
*--------------------+---------------+------------+------------+-----------+---------------------+-----------------------+
Expand All @@ -57,3 +57,5 @@ Default Artifact Handlers Reference
*--------------------+---------------+------------+------------+-----------+---------------------+-----------------------+
| <<<javadoc>>> | <<<javadoc>>> | <<<jar>>> | <= type> | java | <<<true>>> | |
*--------------------+---------------+------------+------------+-----------+---------------------+-----------------------+

Additional ones can be contributed by {{{/guides/mini/guide-using-extensions.html}extensions}}.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager;
import org.codehaus.plexus.PlexusContainer;
import org.codehaus.plexus.testing.PlexusTest;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.junit.jupiter.api.Test;

import static org.codehaus.plexus.testing.PlexusExtension.getTestFile;
Expand Down Expand Up @@ -75,7 +77,7 @@ void testAptConsistency() throws Exception {

ArtifactHandler handler =
container.lookup(ArtifactHandlerManager.class).getArtifactHandler(type);
assertEquals(handler.getExtension(), extension, type + " extension");
MatcherAssert.assertThat(type + " extension", extension, Matchers.startsWith(handler.getExtension()));
// Packaging/Directory is Maven1 remnant!!!
// assertEquals(handler.getPackaging(), packaging, type + " packaging");
assertEquals(handler.getClassifier(), classifier, type + " classifier");
Expand All @@ -92,7 +94,8 @@ void testAptConsistency() throws Exception {

private String trimApt(String content, String type) {
String value = trimApt(content);
return "= type".equals(value) ? type : value;
// replace placeholder "= type" with the given type
return value.replace("= type", type);
}

private String trimApt(String content) {
Expand Down