且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Maven exec:java 多模块项目的目标

更新时间:2022-04-30 00:37:32

多模块项目中的目标,当从父级运行时,将针对所有模块运行.我不认为那是你想要的.你可以试试:

Goals in a multi-module project, when run from the parent, will run against all modules. I don't think that's what you want. You can try:

mvn exec:java -pl module2 -Dexec.mainClass=MyMain

那可能有用吗?更多信息:

That might work? More info:

但是,我认为在运行之前将目录更改为包含可执行文件的子模块更直观.

However, I think it's more intuitive to change directory to the sub-module containing the executable before running it.