Hi Sławomir, Ok, finally got the trick, it is a good one actually and even if a bit more verbose than mine it is more "buit-in", thanks a lot and probleme solved!
Romain Manni-Bucau @rmannibucau <https://twitter.com/rmannibucau> | Blog <https://rmannibucau.metawerx.net/> | Old Blog <http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> | LinkedIn <https://www.linkedin.com/in/rmannibucau> | Book <https://www.packtpub.com/application-development/java-ee-8-high-performance> Le ven. 26 nov. 2021 à 18:27, Slawomir Jaranowski <s.jaranow...@gmail.com> a écrit : > Hi > It can be for both cases. > > You want to configure everything in parent pom - right? > Some executions for all child only and some for parent only. > > So everything can be done in one place, like: > > <build> > <pluginManagment> > <plugin> > <artifactId>frontend-maven-plugin</artifactId> > <execution> > <!-- for all child --> > <id>npm-build</id> > <goals> > <goal>npm</goal> > </goals> > </execution> > </plugin> > </pluginManagment> > > <plugin> > <artifactId>frontend-maven-plugin</artifactId> > <executions> > <execution> > <!-- only skipped in parent pom --> > <inherited>false</inherited> > <!-- the same id as in pluginManagment --> > <id>npm-build</id> > <phase>none</phase> > </execution> > <execution> > <!-- only in parent pom --> > <inherited>false</inherited> > <id>install-node-npm</id> > <goals> > <goal>install-node-and-npm</goal> > </goals> > </execution> > </executions> > </plugin> > </build> > > > > pt., 26 lis 2021 o 17:38 Romain Manni-Bucau <rmannibu...@gmail.com> > napisał(a): > > > Hi Sławomir, > > > > It solves the parent case but not the child one (the exact opposite). So > i > > can install node only in parent but i can't run npm install && npm run in > > all children. Do I miss anything? > > > > Romain Manni-Bucau > > @rmannibucau <https://twitter.com/rmannibucau> | Blog > > <https://rmannibucau.metawerx.net/> | Old Blog > > <http://rmannibucau.wordpress.com> | Github < > > https://github.com/rmannibucau> | > > LinkedIn <https://www.linkedin.com/in/rmannibucau> | Book > > < > > > https://www.packtpub.com/application-development/java-ee-8-high-performance > > > > > > > > > Le ven. 26 nov. 2021 à 16:20, Slawomir Jaranowski < > s.jaranow...@gmail.com> > > a écrit : > > > > > Hi, > > > > > > Try something like in parent pom > > > > > > <build> > > > <pluginManagement> > > > <plugins> > > > <plugin> > > > <artifactId>maven-failsafe-plugin</artifactId> > > > <version>3.0.0-M5</version> > > > <executions> > > > <execution> > > > <id>test-id</id> > > > <goals> > > > <goal>integration-test</goal> > > > <goal>verify</goal> > > > </goals> > > > </execution> > > > </executions> > > > </plugin> > > > </plugins> > > > </pluginManagement> > > > > > > <plugins> > > > <plugin> > > > <artifactId>maven-failsafe-plugin</artifactId> > > > <executions> > > > <execution> > > > <inherited>false</inherited> > > > <id>test-id</id> > > > <phase>none</phase> > > > </execution> > > > </executions> > > > </plugin> > > > </plugins> > > > </build> > > > > > > In build/pluginManagement I have executions and also can have > > > configuration. > > > > > > In build/plugins I bind execution to magic phase none with inherited > set > > to > > > false, so plugin will not execute in parent pom only. > > > > > > > > > pt., 26 lis 2021 o 15:21 Romain Manni-Bucau <rmannibu...@gmail.com> > > > napisał(a): > > > > > > > Hi all, > > > > > > > > I regularly hit an issue with plugin definition: it is not possible > to > > > > define the plugin for children in a parent. > > > > Let me detail a concrete case: i want a parent module to define the > > > plugins > > > > for children modules but I don't want the parent to have these > plugins. > > > > A common solution is to skip=true in the parent and skip=false in > > > children > > > > but it requires N (number of children) undesired flag (vs 1 for the > > > > parent). > > > > An example is when I do an ui/ parent (pom packaging) i want to > define > > > "npm > > > > install && npm run build" using frontend-maven-plugin for all > children > > > > (spa1, spa2 etc) but I don't want ui/ module itself to run npm since > it > > > > does not contain any module. > > > > > > > > Side note: it is the same if you do an images/ subhierarchy or > servers/ > > > > subhierarchy. > > > > > > > > Indeed a trivial trick for the plugin would be to avoid pom packaging > > but > > > > the author rejected the PR doing that saying it is a tool feature > not a > > > > plugin feature - a bit the same argument that skip should be handled > by > > > > mojo executor and not each plugin. > > > > > > > > I did a quick extension workaround ( > > > > https://github.com/rmannibucau/hierarchy-extension) to enable to > > > configure > > > > the skip toggle the plugin luckily has from the parent and not > redefine > > > the > > > > chain/toggle in all children but I think we would need to solve it > more > > > > cleanly at some point. > > > > > > > > I see a few options (and even if a single one would solve my > particular > > > > issue, all can be nice feature IMHO): > > > > > > > > 1. support what I did in the extension in maven-core? > > > > 2. support implicit skip toggle for all mojo executions > > > > 3. add some virtual properties ${project.packaging.isPom}, > > > > ${project.packaging.isNotPom} (potentially others with dynamic > > > evaluations > > > > is[Not]XXX) > > > > 4. support implicit skipPackagings (list<string>) property for all > > mojos > > > > > > > > Overall it ends to either define a pseudo language in placeholders > and > > > > reuse what is in the plugins or add virutal properties in plugin > about > > > the > > > > project structure (what maven itself handles). > > > > Personally I think this last option is saner on the long run (so 2 > and > > 4 > > > > short term) but happy to get some feedback or even existing > workaround > > > > which does not require to rewire some value in all child or write > > another > > > > extension ;). > > > > > > > > Romain Manni-Bucau > > > > @rmannibucau <https://twitter.com/rmannibucau> | Blog > > > > <https://rmannibucau.metawerx.net/> | Old Blog > > > > <http://rmannibucau.wordpress.com> | Github < > > > > https://github.com/rmannibucau> | > > > > LinkedIn <https://www.linkedin.com/in/rmannibucau> | Book > > > > < > > > > > > > > > > https://www.packtpub.com/application-development/java-ee-8-high-performance > > > > > > > > > > > > > > > > > > -- > > > Sławomir Jaranowski > > > > > > > > -- > Sławomir Jaranowski >