Use the class path of the ItelliJ Idea class when launching the Maven target from ItelliJ Idea

Suppose I have two maven projects: moduleA and moduleB.

moduleA has a dependency on module B in it pom.xml.

I am using IntelliJ Idea and I have a Maven Projects tool window where I have both of these maven projects.

And from there you can start maven plugins : I open "Maven Projects" β†’ moduleA β†’ Plugins β†’ jetty β†’ jetty: run. Java is running, module B is in the classpath , but is in the local Maven repository!

So, if I change something in the sources of moduleB and execute jetty: start with Idea, I will not see the code change until module B is installed with mvn install .

Is there any solution in Idea for a solution without mvn install , for example, for launching any maven goals using the ideas module class ?

+4
source share
2 answers
  • I suggest using the Jetty Integration IDEA plugin to launch a stand-alone berth http://github.com/codebrewer/intellij-idea-jetty-integration-plugin

  • If you still want to use jetty: run, you could say that IDEA will install mvn for module B: Run -> Edit Configurations -> select youy maven run config -> Configuration tab -> Before running (below) -> Run Maven Goal

+3
source

This IDEA plugin is no longer developed because IntelliJ now includes its own runtyfig Jetty team.

Here's what worked for me with the multi-module Maven project: In the file, project structure, modules I have all the modules compiled with the same output path ("Use the compile compilation path of the module"). I chose the path "... WEB-INF \ classes" in the folder of the Jetty Deployment folder. Then I must also say that IDEA does not clear output directories when compiling. Otherwise, each module that compiles (one by one) clears the classes from the previous one. Settings, compiler, uncheck "Clear output directory during rebuild."

In addition, I had to first put all my external (maven) dependency bans in the "... WEB-INF \ lib" folder.

Yes, it’s hacked, but it works. If anyone has a better, cleaner solution, I would be interested to know.

+3
source

All Articles