Hi again, Thank you for the responses. I think I figured my problem. Running the plugin on a specific module (changing work directory or using -pl) was always working fine. What I was trying to do was to run it for every module at once from the parent directory. And when defining the configuration in the parent, module1 and parent were fine but obviously grandparent didn't know about it and exec:exec would fail. In addition grandparent is the first to run and its failure hides the potential success of parent and module1.
Now I'll try to find a way around this. - Maybe defining a no-op exec:exec configuration in the grandparent. - Could I do something like running a specific execution id and skipping projects that don't have this execution id defined? On Fri, Jul 17, 2020 at 12:21 AM Anders Hammar <[email protected]> wrote: > Also, what version of Maven is used? I think there was something related to > relative path for parent fixed in some version. > > /Anders > > On Fri, Jul 17, 2020 at 9:18 AM Martin Kanters <[email protected]> > wrote: > > > You are right! My bad, I haven't used pluginManagement that much. > > I verified that `mvn exec:exec` in the module1 child project works with > the > > example project that Clément gave (including the pluginManagement > change). > > > > I also verified that if you put the pluginManagement part in the > > "grandparent", it still works. > > It is quite an unusual setup I think to include "grandparent" pom as a > > submodule to the root pom (or "parent" pom in this case), but somehow > it's > > valid. > > > > Clément, as you are saying that your test project didn't work for you, > are > > you executing `mvn exec:exec` or something different? > > > > Martin > > > > > > Op vr 17 jul. 2020 om 09:01 schreef Anders Hammar <[email protected]>: > > > > > On Fri, Jul 17, 2020 at 7:58 AM Martin Kanters < > [email protected] > > > > > > wrote: > > > > > > > The <pluginManagement> section, much like the <dependencyManagement> > > > > section, is a place where you can define "blueprints". The child POMs > > can > > > > then activate this plugin by adding the plugin normally, with limited > > > > configuration. > > > > In your example your parent pom (/pom.xml) is great. To activate it > you > > > > would have to add this in /module1/pom.xml: > > > > > > > > <build> > > > > <plugins> > > > > <plugin> > > > > <groupId>org.codehaus.mojo</groupId> > > > > <artifactId>exec-maven-plugin</artifactId> > > > > </plugin> > > > > </plugins> > > > > </build> > > > > > > > > > > I'm fairly sure this is not required. The build/plugins section is for > > > binding to the build lifecycle, but when you execute a mojo directly > > (like > > > maven exec:exec) the build lifecycle is not executed. I like to view > this > > > as there are actually two ways of using Maven: > > > 1) As a build tool. You execute the build lifecycle, like "mvn verify". > > > 2) As a utility tool. You then execute a specific mojo, that could do > > > pretty much anything. Like "mvn exec:exec". > > > > > > Thinking harder about this specific scenario (which I don't really > > > understand though, why two parents in the same build?), I believe that > > the > > > problem could be that the build lifecycle is not executed. Thus, there > is > > > no reactor and then the grand-parent might be retrieved from the local > > repo > > > instead of from the subfolder (if you execute from the root folder). > I.e. > > > the relative path specified doesn't work. Just guessing here... > > > > > > What you could do is inspect the effective pom ("mvn > help:effective-pom") > > > and verify that the maven-exec-plugin configuration exists (in the > > > pluginManagement section). > > > > > > /Anders > > > > > > > > > > > > > > Then, when executing the command mvn exec:exec in the /module1/ > > > directory, > > > > you will see: > > > > [INFO] --- exec-maven-plugin:3.0.0:exec (default-cli) @ > > test-cli-module1 > > > > --- > > > > hello world jar > > > > > > > > It would also work if you put this pluginManagement section in your > > > > "grand-parent" pom. > > > > > > > > Hope that helps, > > > > Martin > > > > > > > > Op vr 17 jul. 2020 om 00:49 schreef Clément Guillaume > > > > <[email protected] > > > > >: > > > > > > > > > Hum, I tried that > > > > > < > > > > > > > > > > > > > > > https://github.com/guillaumecle/maven-configuration-test/commit/8b8caabd93a799dd5d68346338b5fa02c899cc8d > > > > > > > > > > > and it still not working > > > > > > > > > > On Thu, Jul 16, 2020 at 12:16 AM Anders Hammar <[email protected]> > > > > wrote: > > > > > > > > > > > If you want to be able to execute the plugin from commandline > (like > > > > "mvn > > > > > > exec:exec) and use the plugin config from the pom, the > > configuration > > > > > needs > > > > > > to be in the pluginManagement section. Change that and it should > > work > > > > > > regardless if it's in the parent or the "grand-parent". > > > > > > > > > > > > /Anders > > > > > > > > > > > > On Thu, Jul 16, 2020 at 3:22 AM Clément Guillaume > > > > <[email protected] > > > > > > > > > > > > wrote: > > > > > > > > > > > > > Hello, > > > > > > > > > > > > > > I have a setup with 2 parent poms, one being the parent of the > > > other. > > > > > > > I'm not able to run a plugin configuration (the configuration > is > > > not > > > > > > found) > > > > > > > from command line if it's defined in the (first level) parent > > pom. > > > > > > > But it does work if the configuration is defined in the > > > "grandparent" > > > > > > pom.. > > > > > > > > > > > > > > Is it a bug, or designed to be like that? > > > > > > > If it's designed to be like that, am I missing something to get > > the > > > > > > > configuration defined in my parent pom to be recognized? > > > > > > > > > > > > > > Here is a sample project to reproduce > > > > > > > https://github.com/guillaumecle/maven-configuration-test > > > > > > (test-cli-parent > > > > > > > has the configuration for exec:exec but it's not found) > > > > > > > > > > > > > > mvn exec:exec > > > > > > > > [INFO] Scanning for projects... > > > > > > > > [INFO] > > > > > > > > > > > > > > > > > > > > ------------------------------------------------------------------------ > > > > > > > > [INFO] Reactor Build Order: > > > > > > > > [INFO] > > > > > > > > [INFO] test-cli-grand-parent > > > > > > > > [pom] > > > > > > > > [INFO] test-cli-parent > > > > > > > > [pom] > > > > > > > > [INFO] test-cli-module1 > > > > > > > > [jar] > > > > > > > > [INFO] > > > > > > > > [INFO] ----------------< bzh.guillaume:test-cli-grand-parent > > > > > > > > >----------------- > > > > > > > > [INFO] Building test-cli-grand-parent 0.0.1-SNAPSHOT > > > > > > > > [1/3] > > > > > > > > [INFO] --------------------------------[ pom > > > > > > > > ]--------------------------------- > > > > > > > > [INFO] > > > > > > > > [INFO] --- exec-maven-plugin:3.0.0:exec (default-cli) @ > > > > > > > > test-cli-grand-parent --- > > > > > > > > [INFO] > > > > > > > > > > > > > > > > > > > > ------------------------------------------------------------------------ > > > > > > > > [INFO] Reactor Summary for test-cli-parent 0.0.1-SNAPSHOT: > > > > > > > > [INFO] > > > > > > > > [INFO] test-cli-grand-parent .............................. > > > > FAILURE [ > > > > > > > > 0.586 s] > > > > > > > > [INFO] test-cli-parent .................................... > > > SKIPPED > > > > > > > > [INFO] test-cli-module1 ................................... > > > SKIPPED > > > > > > > > [INFO] > > > > > > > > > > > > > > > > > > > > ------------------------------------------------------------------------ > > > > > > > > [INFO] BUILD FAILURE > > > > > > > > [INFO] > > > > > > > > > > > > > > > > > > > > ------------------------------------------------------------------------ > > > > > > > > [INFO] Total time: 1.034 s > > > > > > > > [INFO] Finished at: 2020-07-15T18:09:15-07:00 > > > > > > > > [INFO] > > > > > > > > > > > > > > > > > > > > ------------------------------------------------------------------------ > > > > > > > > [ERROR] Failed to execute goal > > > > > > > > org.codehaus.mojo:exec-maven-plugin:3.0.0:exec (default-cli) > on > > > > > project > > > > > > > > test-cli-grand-parent: The parameter 'executable' is missing > or > > > > > invalid > > > > > > > -> > > > > > > > > [Help 1] > > > > > > > > [ERROR] > > > > > > > > [ERROR] To see the full stack trace of the errors, re-run > Maven > > > > with > > > > > > the > > > > > > > > -e switch. > > > > > > > > [ERROR] Re-run Maven using the -X switch to enable full debug > > > > > logging. > > > > > > > > [ERROR] > > > > > > > > [ERROR] For more information about the errors and possible > > > > solutions, > > > > > > > > please read the following articles: > > > > > > > > [ERROR] [Help 1] > > > > > > > > > > > > > > > > > > > > http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException > > > > > > > > > > > > > > > > > > > > > Thank you, > > > > > > > > > > > > > > > > > > > > > > > > > > > >
