testing - How to include plugin in maven for test build only? -


i want add plugin in maven project. want added build when build project testing purpose.

i found <scope> can used dependency shown below

<dependency>   <groupid>ch.qos.logback</groupid>   <artifactid>logback</artifactid>   <version>0.5</version>   <scope>test</scope> </dependency> 

as can see here <scope>test</scope>is used.

i want similar thing plugin. example plugin code snipplet

   <build>         <plugins>             <plugin>                 <groupid>org.jibx</groupid>                 <artifactid>jibx-maven-plugin</artifactid>                 <version>1.2.4</version>                 <executions>                     <execution>                         <goals>                             <goal>bind</goal>                         </goals>                     </execution>                 </executions>             </plugin>         </plugins>     </build> 

you can create profile activate in test builds:

<profiles>     <profile>         <id>testing</id>         <build>             <plugins>                 <plugin>                     <groupid>org.jibx</groupid>                     <artifactid>jibx-maven-plugin</artifactid>                     <version>1.2.4</version>                     <executions>                         <execution>                             <goals>                                 <goal>bind</goal>                             </goals>                         </execution>                     </executions>                 </plugin>             </plugins>         </build>    </profile> </profile> 

then invoke mvn parameter -p testing activate profile:

mvn test -p testing 

in addition activating profile manually, profiles can activated automatically based on conditions such existence of environment variable or specific file. can find more information on in maven introduction on profiles.


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -