exasol / error-code-crawler-maven-plugin

Validator and crawler for exasol-error-codes in Java code
MIT License
1 stars 1 forks source link

Crawling project with module-info.java fails #85

Closed kaklakariada closed 1 year ago

kaklakariada commented 1 year ago

Crawling a project with a module-info.java file fails with the following error message:

[ERROR] Failed to execute goal com.exasol:error-code-crawler-maven-plugin:1.2.2:verify (default-cli) 
on project small-json-files-test-fixture: 
Execution default-cli of goal com.exasol:error-code-crawler-maven-plugin:1.2.2:verify failed: 
Ambiguous package name detected. 
If you believe the code you analyzed is correct, please file an issue 
and reference https://github.com/INRIA/spoon/issues/4051. 
Error details: Found 2 non-empty packages with name 'com.exasol.smalljsonfilesfixture'

The issue seems to be caused by the test code because deleting all test classes results in a different error message:

Execution default-cli of goal com.exasol:error-code-crawler-maven-plugin:1.2.1:verify failed: jakarta.json cannot be resolved to a module at $HOME/git/small-json-files-test-fixture/src/main/java/module-info.java:7 

Workaround

Exclude tests from crawling:

            <plugin>
                <groupId>com.exasol</groupId>
                <artifactId>error-code-crawler-maven-plugin</artifactId>
                <configuration>
                    <sourcePaths>src/main/java</sourcePaths>
                </configuration>
            </plugin>

Example projects:

kaklakariada commented 1 year ago

A possible solution could be using the MavenLauncher, see https://spoon.gforge.inria.fr/launcher.html

ckunki commented 1 year ago

Proposal: Close ticket as "won't fix".

Rationale:

kaklakariada commented 1 year ago

Using MavenLauncher is not possible because it does not allow configuring a custom source path and always uses the default Maven source folders.

kaklakariada commented 1 year ago

Please note that module resolution still fails. This must be solved upstream in Spoon: https://github.com/INRIA/spoon/issues/5324