Search code examples
javagitgithubjavafxgit-submodules

Is submodule a correct approach for this GUI problem?


I'm developing a simple study compiler in Java. The application also needs a GUI and I'm using javaFX for this purpose. However, I don't know how to proper wrap the two things together.

I added the compiler github repository as a submodule of the GUI repo.

I want to be able to call the Xpp-Compiler-Main class and pass a command-line argument(in this case a file that was read on the GUI) in this method of the GUI(src/sample/SampleController.java : line 80):

public void actionCompileProgram(ActionEvent actionEvent) {
        System.out.println("Compiling...");
        //something like this:
        Xpp-Compiler.Main(currentFile.getAbsolutePath());
}

How do I "import" the submodule and call the main method of the Xpp-Compiler main class? Is there a better way to wrap those things together?


Solution

  • Is submodule a correct approach for this GUI problem?

    Only if you need the sources of the submodule for the main project to work.
    A Maven approach can help.
    That means, you would generally define a multi-module pom.xml in order for your main project to:

    • compile and install locally (in the maven cache) your submodule content
    • compile itself (which would work, because it would declare in its own pom.xmla dependency to the submodule jar, which was just compiled and installed first)