Running Selenium Grid from Maven might be not a good idea; it depends on what and how you are going to do.
Normally, you will run Selenium tests in parallel against several/many different environments and this has a considerable resource cost. When you start processes from Maven, they run within its main thread (as child threads), therefore having their resources limited to Maven's configuration. It depends on your machine/s and configuration/s, but starting your grid from Maven and running a few Selenium tests in parallel (the hub and a couple of nodes with 5 instances each) on one average machine will likely make Maven hang for lack of memory. To avoid it, you can adjust the configuration, run the tests sequentially (not in parallel, one node only), etc., but again: it depends on what and how you want to do and perhaps you should consider other ways of running your Selenium tests.
Nevertheless, if you just want to try how Selenium Grid works or it's just a couple of some specific tests that will be running, you can use maven-antrun-plugin
and start your hub and nodes like this:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<phase>pre-integration-test</phase> <!-- your Selenium tests should run in integration phase -->
<configuration>
<target>
<java classname="org.openqa.grid.selenium.GridLauncher"
classpathref="maven.test.classpath"
failonerror="true"
fork="false">
<arg line="-role hub"/>
</java>
<java classname="org.openqa.grid.selenium.GridLauncher"
classpathref="maven.test.classpath"
failonerror="true"
fork="false">
<arg line="-role node
-browser 'browserName=firefox,version=19.0,maxInstances=3'
-browser 'browserName=internet explorer 64bits,version=9.0,maxInstances=2'
-hub http://localhost:4444/grid/register
-port 5555
-timeout 40000"/>
</java>
<java classname="org.openqa.grid.selenium.GridLauncher"
classpathref="maven.test.classpath"
failonerror="true"
fork="false">
<arg line="-role node
-browser 'browserName=chrome,version=24.0.1312.56,maxInstances=3'
-browser 'browserName=internet explorer 64bits,version=9.0,maxInstances=2'
-hub http://localhost:4444/grid/register
-port 5556
-timeout 40000"/>
</java>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
Your should have this dependency in your pom.xml:
<dependency>
<groupId>org.seleniumhq.selenium.server</groupId>
<artifactId>selenium-server-standalone</artifactId>
<version>2.30.0</version>
<scope>test</scope>
</dependency>