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

Using multi-release modules fails with base version #158

Open
mdreier-sap opened this issue Nov 11, 2021 · 3 comments
Open

Using multi-release modules fails with base version #158

mdreier-sap opened this issue Nov 11, 2021 · 3 comments

Comments

@mdreier-sap
Copy link

This is a follow-up to #141. The solution in #147 only works for numeric version numbers. However, according to the jdeps documentation, the value base is also valid.

The value is parsed in JdepsExtraArgsExtractor.parseVersionNumber().

Reproduction:

<plugin>
    <groupId>org.moditect</groupId>
    <artifactId>moditect-maven-plugin</artifactId>
    <version>1.0.0.RC2</version>
    <configuration>
        <modules><!-- ... --></modules>
        <jdepsExtraArgs>
            <jdepsExtraArg>--multi-release</jdepsExtraArg>
            <jdepsExtraArg>base</jdepsExtraArg>
        </jdepsExtraArgs>
    <configuration>
</plugin>

Error message:

[ERROR] Failed to execute goal org.moditect:moditect-maven-plugin:1.0.0.RC2:add-module-info (add-module-infos) on project redacted: Execution add-module-infos of goal org.moditect:moditect-maven-plugin:1.0.0.RC2:add-module-info failed: Couldn't parse C:\redacted\target\moditect\dependency\module-info.java -> [Help 1]
@gunnarmorling
Copy link
Member

Interesting, that was news to me. Could you send a PR for fixing this?

@mdreier-sap
Copy link
Author

Sure, but might be some time before I get around to it. Anyone willing to contribute is welcome to do so.

yrodiere added a commit to yrodiere/moditect that referenced this issue Mar 31, 2022
@yrodiere
Copy link
Contributor

yrodiere commented Mar 31, 2022

I'm not sure how to reproduce this problem.

A far as I can see, the current code will log an error, but it will carry on and interpret base as "the module-info.java is at the root and not in the versions/<some-version> directory":

try {
return Optional.of(Integer.parseInt(versionString));
} catch (NumberFormatException ex) {
error("Invalid argument value for " + MULTI_RELEASE_ARGUMENT + ": " + versionString);
return Optional.empty();
}

That's the behavior we can see in your error message, btw:

Couldn't parse C:\redacted\target\moditect\dependency\module-info.java

But as far as I can see, jdeps is supposed to interpret base the same way:

So, I really don't understand what's going on in your case. Maybe my PR #163 will fix this, but I doubt it. In any case, if the problem persists, a reproducer would help, so we can find out where module-info.java actually is in your case.

aseovic added a commit to aseovic/moditect that referenced this issue Apr 15, 2022
)

* moditect#162 Avoid fragile Java version parsing when looking for module-info.java

* Avoid error in logs when passing "--multi-release base" to jdeps

Relates to moditect#158, but most
likely does not fix it.

Co-authored-by: Yoann Rodière <yoann@hibernate.org>
gunnarmorling pushed a commit that referenced this issue Jul 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants