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

Fails to import tree printer module in JAVA Module based projects #6

Closed
ShadowXBoss696 opened this issue Jul 23, 2022 · 2 comments
Closed
Assignees
Labels

Comments

@ShadowXBoss696
Copy link

ShadowXBoss696 commented Jul 23, 2022

Hi Devs,
While working on one of my projects, I decided to use your library to print out AST models on the console. But I met with a problem !!!

My project uses Java Module based structure (i.e., uses module-info.java file) as well as Gradle Build System. When I tried to import your library it says ...

error: module not found: tree.printer

My module-info.java file looks like this ...

module org.kodedevs.kode {
    requires info.picocli;
    requires org.fusesource.jansi;
    requires com.install4j.runtime;
    requires tree.printer;

    requires transitive java.scripting;

    opens org.kodedevs.kode.cli to info.picocli;

    provides javax.script.ScriptEngineFactory with
            org.kodedevs.kode.jsr223.KodeScriptEngineFactory;
}

If possible, can you add a module-info.java file to your project ...

With Regards,
Edumate696

@davidsusu
Copy link
Owner

The problem is that the automatic module name tree.printer is not used by gradle (by default). A possible solution is to use some gradle plugin for explicitly generating the module:

buildscript {
    repositories {
        mavenCentral()
        gradlePluginPortal()
    }
    dependencies {
        classpath("de.jjohannes.gradle:extra-java-module-info:0.15")
    }
}

// ...

apply plugin: 'de.jjohannes.extra-java-module-info'

// ...

extraJavaModuleInfo {
    automaticModule('tree-printer-2.0.0.jar', 'tree.printer')
}

This is a java8 compatible project, so I can't add module-info.java without undesirable complications. However, in the next release, I will add Automatic-Module-Name: hu.webarticum.treeprinter to the manifest file.

@ShadowXBoss696
Copy link
Author

This is a java8 compatible project, so I can't add module-info.java without undesirable complications. However, in the next release, I will add Automatic-Module-Name: hu.webarticum.treeprinter to the manifest file.

Hi @davidsusu,
I recognized the issue with module-info.java and Java8 compatibility and also recognized the workaround of using Automatic-Module-Name in the manifest file while experimenting with your project ... Finally I decided it's better to follow the workaround for my own project also, considering the different use cases available at this point ...

Thank You, for your quick reply on this matter ... Hope to work together someday 😊

With Regards,
@Edumate696

@davidsusu davidsusu added the bug label Sep 11, 2022
@davidsusu davidsusu self-assigned this Dec 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants