java - How can I execute a plug-in, declared on parent pom.xml, on a spesific child pom.xml in Maven? -


i working on java ee project consists of parent project, , list of sub-projects (modules). have declared , configured plug-in on parent project's pom.xml within <pluginmanagement> tag follows:

parent pom.xml

... <pluginmanagement>   <plugins>     <!-- inmem-db-plugin -->     <plugin>       <groupid>com.btmatthews.maven.plugins.inmemdb</groupid>       <artifactid>inmemdb-maven-plugin</artifactid>       <version>${version.inmemdb-plugin}</version>       <inherited>true</inherited>       <executions>         <execution>           <id>rundb</id>           <goals>             <goal>run</goal>           </goals>           <configuration>             <monitorkey>inmemdb</monitorkey>             <monitorport>11527</monitorport>             <daemon>true</daemon>             <type>derby</type>             <database>localdb</database>             <username>${user}</username>             <password>${pass}</password>             <sources>               <script>                 <sourcefile> create - data.sql </sourcefile>                 <sourcefile> create - table.sql </sourcefile>               </script>             </sources>           </configuration>         </execution>         <execution>           <id>stopdb</id>           <goals>             <goal>stop</goal>           </goals>         </execution>       </executions>     </plugin>   </plugins> </pluginmanagement>      ... 

and have referenced on child's pom.xml file:

... <build>     <plugins>         <plugin>             <groupid>com.btmatthews.maven.plugins.inmemdb</groupid>             <artifactid>inmemdb-maven-plugin</artifactid>         </plugin>     </plugins> </build> ... 

from have read on internet, seems right way of making sure specific plug-in used on specific module have referenced it.

but, when run mvn install command, plug-in needed run wont show @ all. there else needed done, in order plug-in run on spesific module only?

thanks in advance.

update: replaced wrong <phase> values valid ones, still when enclose plugin <pluginmanagement> plugin wont run @ all.

the parent > child configuration looks correct i.e. define plugin in pluginmanagement in parent , engage in child including build/plugins. looks incorrect me: <phase>pre-test</phase>, pre-test not valid phase in maven lifecycle , hooking plugin non existent phase prevent being run. think correct plugin configuration is:

<plugin>   <groupid>com.btmatthews.maven.plugins.inmemdb</groupid>   <artifactid>inmemdb-maven-plugin</artifactid>   <version>${version.inmemdb-plugin}</version>   <inherited>true</inherited>   <executions>     <execution>       <id>rundb</id>       <goals>         <goal>run</goal>       </goals>       <configuration>         ...       </configuration>     </execution>   </executions> </plugin> 

i suspect might have been using 'phases' pre-test , post-test start , stop in-memory db as/when test phase starts , stops? if so, correct maven phases are:

  • pre-integration-test
  • post-integration-test

Comments

Popular posts from this blog

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -