maciejwalkowiak / just

Magical 🪄 command line toolkit for developing 🍃 Spring Boot apps
312 stars 6 forks source link

Support for multi-module maven project #18

Closed fatihdogmus closed 1 year ago

fatihdogmus commented 1 year ago

Hey Maciej,

The product is super cool, but we have a multi-maven project and we can't use it because of that.

Would it be possible to add an option to specify which maven module should be used for running the spring boot:run command? Generally, in spring boot multi-module maven projects, one of the modules contain the main class that runs the application. This module depends on all other modules and used to start the application. If we can specify the module to run the spring boot commands, I think it would be enough to have support for multi-module projects. The mvn command to run the application is something like mvn spring-boot:run -pl main

maciejwalkowiak commented 1 year ago

Great suggestion! I'll see how this could be done.

arey commented 1 year ago

Hi @maciejwalkowiak Thanks for this near amazing tool ;) I have the same requirement as @fatihdogmus I'm working on a multi-maven project with Spring Boot 2.7. A sub-module contains the @SpringBootApplication bean and declares the spring-boot-maven-plugin.

When I executed the just run command onfrom the parent directory I've got the following error message:

 Spring Boot not configured. `just run` supports (for now) only Spring Boot projects.

And when I executed just run command from the sub-module I've got a NullPointerException:

java.lang.NullPointerException: null
        at java.base@17.0.5/java.lang.ProcessBuilder.start(ProcessBuilder.java:1092)
        at java.base@17.0.5/java.lang.ProcessBuilder.start(ProcessBuilder.java:1073)
        at com.maciejwalkowiak.just.command.run.maven.SpringBootMavenRunner.run(SpringBootMavenRunner.java:96)
        at com.maciejwalkowiak.just.command.run.maven.MavenDevRunner.run(MavenDevRunner.java:56)
        at com.maciejwalkowiak.just.command.run.RunCommand.execute(RunCommand.java:86)
        at com.maciejwalkowiak.just.command.BaseCommand.call(BaseCommand.java:49)
        at com.maciejwalkowiak.just.command.BaseCommand.call(BaseCommand.java:16)
        at picocli.CommandLine.executeUserObject(CommandLine.java:2041)
        at picocli.CommandLine.access$1500(CommandLine.java:148)
        at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2461)
        at picocli.CommandLine$RunLast.handle(CommandLine.java:2453)
        at picocli.CommandLine$RunLast.handle(CommandLine.java:2415)
        at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2273)
        at picocli.CommandLine$RunLast.execute(CommandLine.java:2417)
        at picocli.CommandLine.execute(CommandLine.java:2170)
        at com.maciejwalkowiak.just.PicoCliRunner.run(PicoCliRunner.java:24)
        at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:767)
        at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:751)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:315)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1302)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1291)
        at com.maciejwalkowiak.just.Just.runSpringApp(Just.java:60)
        at com.maciejwalkowiak.just.Just.main(Just.java:43)
just   | Ooops something went wrong
maciejwalkowiak commented 1 year ago

@arey thanks for kind words. Working on that!