子模块是解决此 GUI 问题的正确方法吗?
Is submodule a correct approach for this GUI problem?
我正在 Java 开发一个简单的学习编译器。该应用程序还需要一个 GUI,为此我正在使用 javaFX。但是,我不知道如何将这两件事正确地包装在一起。
我添加了 compiler github repository as a submodule of the GUI repo。
我希望能够调用 Xpp-Compiler-Main class 并在 GUI 的此方法中传递命令行参数(在本例中为在 GUI 上读取的文件)( src/sample/SampleController.java : 第 80 行):
public void actionCompileProgram(ActionEvent actionEvent) {
System.out.println("Compiling...");
//something like this:
Xpp-Compiler.Main(currentFile.getAbsolutePath());
}
如何"import" 子模块并调用Xpp-Compiler main class 的main 方法?
有没有更好的方法将这些东西包装在一起?
Is submodule a correct approach for this GUI problem?
仅当您需要主项目的子模块源时。
Maven approach 可以提供帮助。
这意味着,您通常会定义一个 multi-module pom.xml
以便您的主项目:
- 编译并install locally (in the maven cache)你的子模块内容
- 编译自身(这会起作用,因为它会在自己的
pom.xml
中声明对子模块 jar 的依赖,该子模块 jar 是首先编译和安装的)
我正在 Java 开发一个简单的学习编译器。该应用程序还需要一个 GUI,为此我正在使用 javaFX。但是,我不知道如何将这两件事正确地包装在一起。
我添加了 compiler github repository as a submodule of the GUI repo。
我希望能够调用 Xpp-Compiler-Main class 并在 GUI 的此方法中传递命令行参数(在本例中为在 GUI 上读取的文件)( src/sample/SampleController.java : 第 80 行):
public void actionCompileProgram(ActionEvent actionEvent) {
System.out.println("Compiling...");
//something like this:
Xpp-Compiler.Main(currentFile.getAbsolutePath());
}
如何"import" 子模块并调用Xpp-Compiler main class 的main 方法? 有没有更好的方法将这些东西包装在一起?
Is submodule a correct approach for this GUI problem?
仅当您需要主项目的子模块源时。
Maven approach 可以提供帮助。
这意味着,您通常会定义一个 multi-module pom.xml
以便您的主项目:
- 编译并install locally (in the maven cache)你的子模块内容
- 编译自身(这会起作用,因为它会在自己的
pom.xml
中声明对子模块 jar 的依赖,该子模块 jar 是首先编译和安装的)