Skip to content

detectLinks default algorithm is practically broken — flexibility needed! #1293

@stechio

Description

@stechio

Current Behavior

The detection algorithm behind the detectLinks parameter, used to resolve cross-reference Javadoc links for project dependencies, is based on the default Maven convention ${project.url}/apidocs.

Problem

In reality, the overwhelming majority of published artifacts do NOT follow such convention; rather, they typically rely on custom locations or, more commonly, on hosting services like https://javadoc.io/.

As a consequence, most cross-reference Javadoc links do NOT work out of the box: they require tedious manual configuration via dependencyLinks.

Proposed Behavior

What's the point of carrying on with a broken algorithm that most of the times doesn't suit real needs? Instead of forcing venerable dead conventions onto users, it would be much more useful if the detection algorithm dealt with the complexity of the real world.

My proposal is to let users define base URLs whenever dependency links can be automatically resolved — for example:

<linkBases>
  <item>https://javadoc.io/doc/</item>
</linkBases>

The resolution will append GAV coordinates to the path:

$linkBase/$groupId/$artifactId/$version/

For example:

https://javadoc.io/doc/net.bytebuddy/byte-buddy/1.18.2/

For each dependency, the algorithm will probe the default conventional location, then the specified linkBases, until a match is found; to speed things up, the algorithm could cache successful hits.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions