Monday, March 7, 2011

Maven Plug in For Microsoft Visual Basic Build.

Apache Maven is a software project management and comprehension tool. Based on the concept of a project object model (POM), Maven can manage a project's build, reporting and documentation from a central piece of information. For More information About Maven


Maven Plug in For Microsoft Visual Basic.


We can build the VB6.0 Application using two ways.

1.Exec-maven-plugin

2. Maven-antrun-plugin

Prerequisite

1. JDK 1.6

2. Maven 2.2.1

3. Microsoft Visual Basic 6.0


1. Exec-Maven-Plugin

You can formally specify all the relevant execution information in the plugin configuration. Depending on your use case, you can also specify some or all information using system properties.Here you can use QTP application also.

Exec-Maven-Plugin

<build>

<plugins>

<plugin>

<groupId>org.codehaus.mojo</groupId>

<artifactId>exec-maven-plugin</artifactId>

<version>1.1.1</version>

<executions>

<execution>

<phase>package</phase>

<goals>

<goal>exec</goal>

</goals>

</execution>

</executions>

<configuration>

<!-- Poin the Vb.exe Application Path-->

<executable>C:\Program Files\Microsoft Visual Studio\VB98\VB6.EXE</executable>

<workingDirectory>${basedir}</workingDirectory>

<arguments>

<!-- Pass the make argument to make exe or dll -->

<argument>/make </argument>

<!-- give the Project file -->

<argument>SampleVbApp.vbp</argument>

</arguments>

</configuration>

</plugin>

</plugins>

</build>

For QTP and other application to execute

<plugin>

<groupId>org.codehaus.mojo</groupId>

<artifactId>exec-maven-plugin</artifactId>

<version>1.1.1</version>

<executions>

<execution>

<goals>

<goal>exec</goal>

</goals>

</execution>

</executions>

<configuration>

<executable>[qtp executable]</executable>

<workingDirectory>/target</workingDirectory>

<arguments>

<argument>[an argument to configure QTP]</argument>

<argument>[another argument to configure QTP]</argument>

</arguments>

</configuration>

</plugin>


2. Maven-antrun-plugin

This plugin provides the ability to run Ant tasks from within Maven 2. You can even embed your Ant scripts in the POM. This plugin we can use two ways 1.Run all Ant or Nant task in the pilugin itself. 2. Point the Ant or Nant build file.

Sample for Maven-antrun-plugin

Here i have taken SampleVbApp.vbp and i am going to build from maven using ant or nant comment in the pulgin task tag.

Place the same pom and changes according to your project.


Inline Task

<build>

<plugins>

<plugin>

<artifactId>maven-antrun-plugin</artifactId>

<version>1.6</version>

<executions>

<execution>

<phase>package</phase>

<goals>

<goal>exec</goal>

</goals>

</execution>

</executions>

<configuration>

<target>

<echo message="Ant plugin execution start "/>

<property name="vb.exe" value="C:\Program Files\Microsoft Visual Studio\VB98\VB6.EXE"/>

<exec executable="${vb.exe}" spawn="true" resolveExecutable="true">

<arg line="/make DOCATT.vbp"/>

</exec>

<echo message="Ant plugin execution end "/>

</target>

</configuration>

</plugin>

</plugins>

</build>

Include Build file

This allows Maven to run Ant tasks. To do so, there must be an existing project and maven-antrun-plugin must have its <target> tag configured (although it would still execute without the <target> tag, it would not do anything). Below is the template for maven-antrun-plugin's pom.xml.

The maven-antrun-plugin has only one goal, run


<plugin>

<artifactId>maven-antrun-plugin</artifactId>

<version>1.4</version>

<executions>

<execution>

<id>SourceGeneration</id>

<phase>generate-resources</phase>

<configuration>

<tasks>

<ant antfile="./msbuild.xml" />

</tasks>

</configuration>

<goals>

<goal>run</goal>

</goals>

</execution>

</executions>

</plugin>


To more usage find maven-antrun-plugin