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

Invalid catalog definition #23

Closed
michaelcarrano opened this issue Feb 9, 2022 · 6 comments
Closed

Invalid catalog definition #23

michaelcarrano opened this issue Feb 9, 2022 · 6 comments

Comments

@michaelcarrano
Copy link

Hi,

First off, thanks for making this plugin. Has made the migration to version catalog easier even if I have to make manual adjustments.

Just wanted to share some issues I have ran into. Depending on what dependencies you have, the name for it might not be valid, specifically, I ran into issues where dependencies ended in either plugin or versions.

org.gradle.api.InvalidUserDataException: Invalid catalog definition:
  - Problem: In version catalog libs, alias 'com-github-ben-manes-versions' is not a valid alias.

* Exception is:
java.lang.RuntimeException: org.gradle.api.InvalidUserDataException: Invalid catalog definition:
  - Problem: In version catalog libs, alias 'com-github-ben-manes-versions' is not a valid alias.
    
    Reason: It shouldn't end with 'versions'.
    
    Possible solution: Use a different alias which doesn't end with 'bundle', 'bundles', 'plugin', 'plugins', 'version' or 'versions'.
    

Looks like there are some reserved keywords that we should not be using, so wondering if there is a way to detect and provide an alternate naming? I'm not quite sure what the naming would look like.

@hvisser
Copy link
Contributor

hvisser commented Feb 9, 2022

Yeah this is kind of tricky and these naming rules have been relaxt a bit for different Gradle versions, which version are you on?

The naming strategy is pretty simple now and could probably be updated a bit to make sure none of the generated names end with these reserved words. The question is what to change in that case 🤔

One solution could be just to drop the offending part, or if that is not possible (because it would clash or whatever) add -generated or something to it...wdyt?

@michaelcarrano
Copy link
Author

Oops, knew I left out some needed details. We are currently using gradle 7.2 with plans to upgrade in the next few weeks.

I've been thinking about naming and I don't have a good idea, right now I just added -changeme to the dependencies that errored on me as I switch things over and clean up the toml file.

@hvisser
Copy link
Contributor

hvisser commented Feb 9, 2022

👍 Adding -changeme or -generated is probably the most pragmatic option for now, especially since this only happens when you use --create (or maybe also for new versions, but I'd have to check that)

@hvisser
Copy link
Contributor

hvisser commented Oct 14, 2022

I think that with the relaxation of those rules in Gradle this can probably be closed, or are you still running into situations where a generated key is invalid?

@FyiurAmron
Copy link

I'd say that with Gradle 7.6 and 8.1 around and this problem being related to a release that's about a year old, it's more or less time to actually consider this a non-issue with the solution being simply "upgrade your Gradle or patch the file manually" :D

@hvisser
Copy link
Contributor

hvisser commented May 31, 2023

Yep I agree!

@hvisser hvisser closed this as completed May 31, 2023
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