Showing posts with label Maven. Show all posts
Showing posts with label Maven. Show all posts

Wednesday, May 2, 2012

Configuration to make maven plugin work in eclipse

1. Update eclipse.ini file with the option
-vm
C:/Program Files/Java/jdk1.6.0_10/bin/javaw.exe

2.Configure eclipse to use jre in jdk definition from(Preference -> java -> installed jre)


Saturday, December 17, 2011

Maven ant run plugin

Simulate all the tasks of ant script and also used to call external ant targets from a maven pom.


<groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-antrun-plugin</artifactId>
    <version>1.7</version>
    <configuration>
      <tasks>
        <echo message="hello ant, from Maven!" />
        <echo>Maybe this will work?</echo>

        <ant antfile="${basedir}/build.xml">
          <target name="test" />
        </ant>

       <exec dir="${basedir}" executable="cmd"
         failonerror="true">
         <arg line="/K start" />
         <arg line="one.bat" />
       </exec>

      </tasks>
    </configuration>
   </plugin>
Sample Usage : mvn antrun:run

Monday, August 22, 2011

Start a maven project for selenium

Create a new Maven project using eclipse. The "artifactId" given for the project will be the name of the project.
Now a a new project is created. It will be having the following two directory structures.

All classes for the project will be under src/main/java  and all unit tests will be under  src/test/java.

For a selenium project there will be no need for both these folder. So we can omit src/test/java and add all tests to src/main/java. The pom file should be updated with the entry  <testSourceDirectory>${basedir}/src/main/java</testSourceDirectory> to point that all tests are in folder structure src/main/java. If only configured like this,  the surefire plugin will execute the tests.

User should specify the class which needs to be executed. It can be specified using "test" option of surefire plugin.
So if all testng tests are written in the file BaseFile.java. Then use this command from cmd mvn test -Dtest=BaseFile.java to run the test. Else the class which needs to be executed can be specified in a suite file and the "suiteXmlFiles" option of surefire  be used.

eg :
      <suiteXmlFiles>
             <suiteXmlFile>sample.xml</suiteXmlFile>
       </suiteXmlFiles>

Use "reportsDirectory"   option of surefire plugin to create a custom folder to store the emailable report.

eg:
     <reportsDirectory>${directory}</reportsDirectory>

Where 'directory' is the argument passed from cmd.