You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Maksim Timonin (Jira)" <ji...@apache.org> on 2024/06/20 17:30:00 UTC

[jira] [Commented] (MJAVADOC-797) Exclusion rules works differently for Java 8 and Java 11

    [ https://issues.apache.org/jira/browse/MJAVADOC-797?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17856568#comment-17856568 ] 

Maksim Timonin commented on MJAVADOC-797:
-----------------------------------------

[~michael-o], hi!

The plugin generates different options for {{javadoc(1) }}depending on configuration with different exclude logic. See 2 examples for my case described in the PR [1].

1.  Plugin configuration:

```
          <subpackages>org.apache</subpackages>
          <excludePackageNames>org.apache.internal:org.apache.internal.*</excludePackageNames>
```

it creates the @options file for javadoc. This file is the same for java8 and java11. But the test passes for java8 and failed for java11. Options file content:

```
-sourcepath
'/Users/maksim/work/maven-javadoc-plugin/src/test/resources/unit/subpackages-exclude-packages-test/src/main/java'
-subpackages
org.apache
-exclude
org.apache.internal:org.apache.internal.subpackage

...
```

2. In case I change the plugin configuration to (remove the "subpackages" param)

```
          <excludePackageNames>org.apache.internal:org.apache.internal.*</excludePackageNames>
```

it creates the @options and @packages files for javadoc with such params

```

# @options
-sourcepath
'/Users/maksim/work/maven-javadoc-plugin/src/test/resources/unit/subpackages-exclude-packages-test/src/main/java'

...

 

# @packages

org.apache.project
io
```

It means that "excludePackageNames" doesn't convert to the "-exclude" flag of the {{javadoc(1)}} util. I'm not sure whether this is a bug or not, but it's a little bit misleading.

 

 

> Exclusion rules works differently for Java 8 and Java 11
> --------------------------------------------------------
>
>                 Key: MJAVADOC-797
>                 URL: https://issues.apache.org/jira/browse/MJAVADOC-797
>             Project: Maven Javadoc Plugin
>          Issue Type: Bug
>    Affects Versions: 3.7.0
>            Reporter: Maksim Timonin
>            Priority: Major
>
> The behavior of the "-excludePackageNames" differs for java8 and java11 in case of using an option "-subpackages".
> Reproducer is available in the PR:
>  [1] [https://github.com/apache/maven-javadoc-plugin/pull/289]
> There are possibly, 2 bugs:
> 1. Behavior for "excludePackageNames" is actually depends on whether the "subpackages" setting is specified or not - there are different patterns for exclusion used, see patterns in *JavadocUtil#getExcludedPackages* and *JavadocUtil#getIncludedFiles*
> 2. In case of using "subpackages" the scenario in the PR [1], the plugin prepares equal options for the javadoc util for both java versions. But actually the output for the javadoc util differs (depends on the java version). I'm not sure is it an expected behavior for the javadoc util, but I'd expect the maven-javadoc-plugin will adjust for different java versions and provides equal exclusion result.
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)