Question

I want to run multiple CMD commands in maven using single pom.xml.

I am using this plugin but its is not working

<pluginManagement>          <plugins>
                <plugin>
                    <!-- ignore unsupported maven operations in eclipse m2e -->
                    <groupId>org.eclipse.m2e</groupId>
                    <artifactId>lifecycle-mapping</artifactId>
                    <version>1.0.0</version>
                    <configuration>
                        <lifecycleMappingMetadata>
                            <pluginExecutions>
                                <pluginExecution>
                                    <pluginExecutionFilter>
                                        <groupId>org.apache.maven.plugins</groupId>
                                        <artifactId>maven-dependency-plugin</artifactId>
                                        <versionRange>[1.0.0,)</versionRange>
                                        <goals>
                                            <goal>unpack</goal>
                                        </goals>
                                    </pluginExecutionFilter>
                                    <action>
                                        <ignore />
                                    </action>
                                </pluginExecution>
                            </pluginExecutions>
                        </lifecycleMappingMetadata>
                    </configuration>
                </plugin>

                <plugin>
                  <groupId>org.codehaus.mojo</groupId>
                  <artifactId>exec-maven-plugin</artifactId>
                  <version>1.2</version>
                  <executions>
                    <execution>
                      <id>run a backup</id>
                      <phase>pre-integration-test</phase>
                      <goals>
                        <goal>exec</goal>
                      </goals>
                      <configuration>
                        <executable>yourscript.sh</executable>
                      </configuration>
                    </execution>
                  </executions>
                </plugin>

            </plugins>      </pluginManagement>

May I know how can I do that?

Was it helpful?

Solution

Try something like

<plugin>  
 <artifactId>maven-antrun-plugin </artifactId>  
   <executions>  
     <execution>  
       <phase>install </phase>  
       <configuration>  
         <tasks name="Run Notepad">    
           <exec  
             dir="${basedir}"  
             executable="${basedir}/notepad.exe"  
             failonerror="true">  
             <arg line=""/>  
           </exec>  
        </tasks>  
       </configuration>  
       <goals>  
         <goal>run </goal>  
       </goals>  
     </execution>  
   </executions>  
 </plugin>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top