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

JPMS #465

Open
xenoterracide opened this issue Sep 11, 2023 · 10 comments
Open

JPMS #465

xenoterracide opened this issue Sep 11, 2023 · 10 comments

Comments

@xenoterracide
Copy link

please add a module-info or automatic module name so this can be used with java modules

/home/xeno/IdeaProjects/ai-wh40k/module/game/src/main/java/module-info.java:3: error: module not found: freebuilder
  requires freebuilder;
@alicederyn
Copy link
Collaborator

PRs welcome

@xenoterracide
Copy link
Author

Are you trying to maintain support for pre java 9?

@alicederyn
Copy link
Collaborator

I'm not sure of the Java landscape these days. What does Android compatibility entail?

@xenoterracide
Copy link
Author

I don't know what android's up to. Automatic module naming is backwards compatible for sure though.

@xenoterracide
Copy link
Author

I believe recent-er versions of gradle can generate the automatic module manifest (I need to do some research) are you amenable to upgrading if that's the path of least resistance?

@alicederyn
Copy link
Collaborator

Absolutely.

@xenoterracide
Copy link
Author

Honestly, I went to do this, this morning, but I can't get the project to build. I'm not sure why you've done some things... so I don't want to mess around with a project that doesn't build

 Where:
Script '/home/xeno/IdeaProjects/FreeBuilder/gradle/java-compatibility.gradle' line: 34

* What went wrong:
A problem occurred evaluating root project 'FreeBuilder'.
> Could not get unknown property 'HOME' for root project 'FreeBuilder' of type org.gradle.api.Project.

to fix this you might want to upgrade to gradle 8 (it was introduced in 7, but I'm not sure which version), and use the Java Toolchain feature. I'm only guessing at what you're trying to do though.

to fix the actual issue I brought up here it should be as simple as

jar {
    manifest {
        attributes 'Automatic-Module-Name': 'org.inferred.freebuilder'
    }
}

https://stackoverflow.com/a/53912585/206466

https://blog.joda.org/2017/05/java-se-9-jpms-automatic-modules.html

@xenoterracide
Copy link
Author

hacky workaround (mostly using it to decide if freebuilder works for me, if not... then I have to decide what I want to do about that)

plugins {
  id("org.gradlex.extra-java-module-info").version("1.+")
}

extraJavaModuleInfo {
  automaticModule("org.inferred:freebuilder", "org.inferred.freebuilder")
  failOnMissingModuleInfo.set(false)
}

not sure if if this adds the manifest to the jar, simply gives it a name on the cli or what https://github.com/gradlex-org/extra-java-module-info

@alicederyn
Copy link
Collaborator

alicederyn commented Sep 27, 2023

I can't get the project to build

That error's coming from these lines here:

throw new RuntimeException("Set the property $propertyName in your"
+ "$HOME/.gradle/gradle.properties, pointing to a Java $version installation")

It's supposed to write out an error message, but apparently the $HOME needs escaping in the string before it can do that. (It was supposed to be a literal dollar sign in the output.)

@xenoterracide
Copy link
Author

Yeah, I'm just thinking there might be a better way to do whatever you're trying to do than there was in 6. You should just be able to copy and paste those jar lines somewhere though and have add the manifest.MF when you build the jar. I haven't tested it though because... Oh because I didn't want to spend a ton of time making your build work. Especially with My IDE.

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

2 participants