maven-antrun-plugin on windows and linux - linux

I am trying to get my maven project to work on both windows 7 and ubuntu 13.04. In a pom.xml file I use maven-antrun-plugin to call scons which I have installed on both my linux and windows machine. On both os's I have verified that I can run scons from shell/cmd so its on the PATH. The pom looks like this:
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>run-scons</id>
<phase>generate-resources</phase>
<configuration>
<target name="run-scons">
<exec executable="scons" dir="${basedir}/../../../" failonerror="true">
<arg value="-j4" />
</exec>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
But when I build on windows7 I get:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.7:run (run-scons) on project my-project: An Ant BuildExcept
ion has occured: Execute failed: java.io.IOException: Cannot run program "scons" (in directory "C:\Users\u\samples"): CreateProcess error=2,
The system cannot find the file specified
[ERROR] around Ant part ...<exec dir="C:\Users\u\samples...." executable="scons" failonerror="true">
If I open a cmd and run it from there I get:
C:\Users\u\samples\>scons
scons: Reading SConscript files ...
Using configuration: scons/win32mscdbg.py
Why can't I call scons from the antrun plugin? If I specify the full path to scons on windows it works (eg. C:\Python26\Scripts\scons.bat) but that is a no-go since developers are only required to have scons in their path, but can decide the location themselves.

Would maven exec plugin make a difference?
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<id>run-scons</id>
<phase>generate-resources</phase>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>scons</executable>
<workingDirectory>${basedir}/../../../</workingDirectory>
<arguments>
<argument>-j4</argument>
</arguments>
</configuration>
</plugin>
I can't test this, but it looks like you can run bat files (1, 2) as "executables" in maven as opposed to ant where you run the shell with the bat file as argument (read here under win users). The linked examples are all with absolute path, which is not your case. I advise to try and feedback.

This approach has worked for me with other commands.
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>run-scons</id>
<phase>generate-resources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<!-- TODO: fill in the correct os property value -->
<exec executable="scons" dir="${basedir}/../../../" failonerror="true"
os="<os.name property value for Ubuntu>"
<arg value="-j4" />
</exec>
<exec executable="cmd" dir="${basedir}/../../../" failonerror="true"
os="Windows 7"
<arg line="/C scons />
<arg value="-j4" /> <!-- /j4 on windows? never used scons -->
</exec>
</target>
</configuration>
</execution>
</executions>
</plugin>

Related

Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.3.2:exec (npm run build) on project npm

I am trying to deploy my web-app to heroku. To run my app i need to execute
npm run build
So i need to install npm to Heroku. I found maven plugins which does it.And a plugin which executes a script.
<build>
<plugins>
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<!-- Use the latest released version:
https://repo1.maven.org/maven2/com/github/eirslett/frontend-maven-plugin/ -->
<version>1.7.5</version>
<executions>
<execution>
<!-- optional: you don't really need execution ids, but it looks nice in your build log. -->
<id>install node and npm</id>
<goals>
<goal>install-node-and-npm</goal>
</goals>
<!-- optional: default phase is "generate-resources" -->
<phase>generate-resources</phase>
</execution>
</executions>
<configuration>
<nodeVersion>v11.15.0</nodeVersion>
<npmDownloadRoot>https://nodejs.org/dist/v6.11.3/win-x64/node.exe</npmDownloadRoot>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.3.2</version>
<executions>
<execution>
<id>npm run build</id>
<goals>
<goal>exec</goal>
</goals>
<phase>compile</phase>
<configuration>
<executable>npm</executable>
<arguments>
<argument>run</argument>
<argument>build</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
But when i try to push it to heroku I get this:
Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.3.2:exec (npm run build) on project vstup: Command execution failed. Cannot run program "npm" (in directory "/tmp/build_6883506630fbb2f73ce1bcb9a5d6cf3d"): error=2, No such file or directory -> [Help 1]
I had a same error today with GitLab-ci and the spring-boot app.
I had to run before script to install the missing npm:
before_script:
- 'apt-get update'
- 'apt-get install -y npm'
script:
- 'mvn deploy'
This will install npm before running the maven exec plugin with the npm executable.
My mvn plugin configuration was:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<configuration>
<workingDirectory>${project.basedir}/src/main/frontend</workingDirectory>
</configuration>
<executions>
<execution>
<id>exec-npm-install</id>
<phase>generate-sources</phase>
<configuration>
<executable>npm</executable>
<arguments>
<argument>install</argument>
</arguments>
</configuration>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
</plugin>
Hint:
maybe you can try to use after_script and before_script to run ls -Ra and see if a file or directory is missing, but it wasn't my case

Linux executable fails using javafx-maven-plugin

I have a multimodule maven project with JavaFX up and running. I can create an jar file containing all classes that is executable through a maven assembly, so I know the packaged bundle works.
For conveniance I want to create a native bundle/executable using the javafx-maven-plugin
<profile>
<id>build-installer</id>
<properties>
<native.output.dir>${project.build.directory}/jfx/native/${project.build.finalName}</native.output.dir>
<native.output.dir.app>${native.output.dir}/app</native.output.dir.app>
<native.output.dir.security>${native.output.dir}/runtime/jre/lib/security</native.output.dir.security>
<native.app.jar>${native.output.dir.app}/${project.build.finalName}-jfx.jar</native.app.jar>
</properties>
<dependencies>
<dependency>
<groupId>ch.sahits.game</groupId>
<artifactId>OpenPatricianDisplay</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>com.zenjava</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>8.1.2</version>
<configuration>
<mainClass>ch.sahits.game.OpenPatrician</mainClass>
<verbose>true</verbose>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>native</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>create zip archive</id>
<phase>install</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<echo>Creating self-contained zip</echo>
<zip destfile="${project.build.directory}/OpenPatrician-${project.version}.zip" basedir="${native.output.dir}" />
</target>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
This works fine on Windows, creates an exe file that can be run. However executing the same thing on Linux, Maven runs through but the executable fails to start properly with these two messages:
OpenPatricianDisplay-0.5.0-SNAPSHOT No main class specified
OpenPatricianDisplay-0.5.0-SNAPSHOT Failed to launch JVM
Taking a look at the cfg files of the Windows and Linux bundle shows that they are different. When replacing the Linux one with the one from Windows a different errors is created. So I do not think the fact that they are different is the cause.
Creating a single module JavaFX demo app with the plugin on Linux works. To figure out if it is the Maven plugin or the underlying packager, I tried the following the Ant examples. The Hello World example works fine (chapter 10.4.1) however when trying the example with external jar files (chapter 10.4.3) even the build fails:
BUILD FAILED
/home/andi/eclipse/intellij/jdk1.8.0_60/demo/javafx_samples/src/Ensemble8/build.xml:34: You must specify at least one fileset to be packed.
The build.xml
<?xml version="1.0" encoding="UTF-8" ?>
<project name="Ensemble8 JavaFX Demo Application" default="default" basedir="."
xmlns:fx="javafx:com.sun.javafx.tools.ant">
<property name="JAVA_HOME" value="/usr/lib/jvm/java-8-oracle"/>
<path id="CLASSPATH">
<pathelement location="lib/lucene-core-3.2.0.jar"/>
<pathelement location="lib/lucene-grouping-3.2.0.jar"/>
<pathelement path="classes"/>
</path>
<property name="build.src.dir" value="src"/>
<property name="build.classes.dir" value="classes"/>
<property name="build.dist.dir" value="dist"/>
<target name="default" depends="clean,compile">
<taskdef resource="com/sun/javafx/tools/ant/antlib.xml"
uri="javafx:com.sun.javafx.tools.ant"
classpath="${JAVA_HOME}/lib/ant-javafx.jar"/>
<fx:application id="ensemble8"
name="Ensemble8"
mainClass="ensemble.EnsembleApp"/>
<fx:resources id="appRes">
<fx:fileset dir="${build.dist.dir}" includes="ensemble8.jar"/>
<fx:fileset dir="lib"/>
<fx:fileset dir="${build.classes.dir}"/>
</fx:resources>
<fx:jar destfile="${build.dist.dir}/ensemble8.jar">
<fx:application refid="ensemble8"/>
<fx:resources refid="appRes"/>
</fx:jar>
<fx:deploy outdir="." embedJNLP="true"
outfile="ensemble8"
nativeBundles="all">
<fx:application refId="ensemble8"/>
<fx:resources refid="appRes"/>
<fx:info title="Ensemble8 JavaFX Demo Application"
vendor="Oracle Corporation"/>
</fx:deploy>
</target>
<target name="clean">
<mkdir dir="${build.classes.dir}"/>
<mkdir dir="${build.dist.dir}"/>
<delete>
<fileset dir="${build.classes.dir}" includes="**/*"/>
<fileset dir="${build.dist.dir}" includes="**/*"/>
</delete>
</target>
<target name="compile" depends="clean">
<javac includeantruntime="false"
srcdir="${build.src.dir}"
destdir="${build.classes.dir}"
fork="yes"
executable="${JAVA_HOME}/bin/javac"
source="1.8"
debug="on"
classpathref="CLASSPATH">
</javac>
<!-- Copy resources to build.classes.dir -->
<copy todir="${build.classes.dir}">
<fileset dir="src/app/resources"/>
<fileset dir="src/generated/resources"/>
<fileset dir="src/samples/resources"/>
</copy>
</target>
</project>
So it looks the examples are not up to date with Java 1.8.0_60. The only difference to the build.xml from the example is the path to the JAVA_HOME.
Does anyone have an idea on:
a) how to approach the issue with the ant build to prove/disprove that the packager is the problem or
b) even better have some insights into what might be the problem when running the maven plugin.
Environment:
Linux Mint 17.2 KDE
JDK 1.8.0_60
Ant 1.9.3
Maven 3.0.5
javafx-maven-plugin 8.1.4
This is at least a partial answer to the issue with the build for ant. As it turns out the documentation is outdated, but I figured it out when taking a look at the Ant task definition.
The <fx:jar> elements requires some more children for it to work:
<fx:application id="ensemble8"
name="Ensemble8"
mainClass="ensemble.EnsembleApp"/>
<fx:resources id="appRes">
<fx:fileset dir="${build.dist.dir}" includes="ensemble8.jar"/>
<fx:fileset dir="lib"/>
<fx:fileset dir="${build.classes.dir}"/>
</fx:resources>
<fx:jar destfile="${build.dist.dir}/ensemble8.jar">
<fx:application refid="ensemble8"/>
<fx:resources refid="appRes"/>
<fx:fileset dir="${build.classes.dir}"/>
<!-- Customize jar manifest (optional) -->
<manifest>
<attribute name="Implementation-Vendor" value="Samples Team"/>
<attribute name="Implementation-Version" value="1.0"/>
<attribute name="Main-Class" value="ensemble.EnsembleApp" />
</manifest>
</fx:jar>
Especially the <manifest> and the <fx:fileset>. With that in place I can create the demo application as native bundle that is executable.
EDIT: The original issue with the javafx-maven-plugin turns out to be a problem in the packager itself and the lookup of the configuration file. Updating to version 8.1.5 and adding <bundler>linux.app</bundler> in the <configuration> is a workaround until the issue is fixed in the JDK.-

How to target maven executions to the build folder only?

I have a project using Maven and the frontend-maven-plugin (com.github.eirslett).
As I run mvn install all the executions from the plugin run, and they create a node_modules, bower_components, and node folders in the src/main/webapp root, where the actual frontend code is.
The thing is, I wanted to mvn install only execute and create those in war the package generated in the build directory, not in the versioned application code, just like it does with Java libraries.
Is there a way to achieve that?
This is the relevant part of my pom.xml:
<build>
<directory>build</directory>
<outputDirectory>build/classes</outputDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<encoding>UTF-8</encoding>
<webResources>
<resource>
<filtering>true</filtering>
<directory>src/main/webapp</directory>
<includes>
<include>WEB-INF/weblogic.xml</include>
</includes>
</resource>
</webResources>
</configuration>
</plugin>
...
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>0.0.20</version>
<configuration>
<workingDirectory>src/main/webapp</workingDirectory>
</configuration>
<executions>
<execution>
<id>install node and npm</id>
<goals>
<goal>install-node-and-npm</goal>
</goals>
<configuration>
<nodeVersion>v0.10.34</nodeVersion>
<npmVersion>2.1.11</npmVersion>
</configuration>
</execution>
<execution>
<id>npm install</id>
<goals>
<goal>npm</goal>
</goals>
<configuration>
<arguments>install</arguments>
</configuration>
</execution>
<execution>
<id>bower install</id>
<goals>
<goal>bower</goal>
</goals>
<configuration>
<arguments>install</arguments>
</configuration>
</execution>
<execution>
<id>grunt build</id>
<goals>
<goal>grunt</goal>
</goals>
</execution>
</executions>
</plugin>
...
</plugins>
</build>
It's possible to use <installDirectory> configuration parameter to choose where to install NodeJS.
frontend-maven-plugin will install node_modules in the place where it founds package.json. That's why you need to provide copy of your web resources with package.json to some target/<sub-path>.
Then frontend-maven-plugin may be configured by this way:
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>0.0.24</version>
<configuration>
<nodeVersion>v0.11.14</nodeVersion>
<npmVersion>2.13.4</npmVersion>
<installDirectory>target/<sub-path></installDirectory>
<workingDirectory>target/<sub-path></workingDirectory>
</configuration>
...
The plugin (frontend-maven-plugin) mostly supports this. The "workingDirectory" parameter tells plugin where to do the work (i.e. npm install). That requires though that the build files (i.e. package.json, gruntFile.js) be in that workingDirectory. To accomodate this I added a antrun execution to copy those files over (with filtering) before the rest of the build. My grunt file then references the files from source when appropriate and any output goes in my target-grunt folder.
Here is my config:
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>0.0.20</version>
<configuration>
<workingDirectory>target-grunt</workingDirectory>
</configuration>
<executions>
...
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>prepare-grunt</id>
<phase>generate-resources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<!-- copy, filter, rename -->
<filter token="moduleName" value="${moduleName}" />
<filter token="project.version" value="${project.version}" />
<filter token="project.artifactId" value="${project.artifactId}" />
<copy file="${basedir}/target-grunt/imported-js/main/js/com/verisk/underwriting/config/grunt/npm-package-module/0.0.1/npm-package-module-0.0.1.js" tofile="${basedir}/target-grunt/package.json" filtering="true" failonerror="true" verbose="true" />
<copy file="${basedir}/Gruntfile.js" tofile="${basedir}/target-grunt/Gruntfile.js" failonerror="true" verbose="true" />
</target>
</configuration>
</execution>
</executions>
</plugin>
A possible way in order to do not dirty the frontend resources dir, contained as example in src/main/frontendResources, coming from GIT (or another source repo) with the node_modules, bower_components, ..., directories and files generated during npm, bower and grunt execution is:
using maven-resources-plugin, copy the sources directory src/main/frontendResources
in /target/webappStagingDir subfolder during
initialization phase
set the workingDirectory and
installDirectory in frontend-maven-plugin to /target/webappStagingDir
set the bower output directory as
subfolder of /target/webappStagingDir. In example put
{"directory":
"bower_components"}
in .bowerrc file
after bower build, using
maven-resources-plugin, copy the output built sources contained in
bower_components folder to /target/${artifactId}-${version} during
prepare-package phase (before war building)
Here is the pom slice:
...
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>1.6</version>
<configuration>
<workingDirectory>${basedir}/target/frontendResourcesStagingDir</workingDirectory>
<installDirectory>${basedir}/target/frontendResourcesStagingDir</installDirectory>
</configuration>
<executions>
<execution>
<id>install node and npm</id>
<phase>generate-resources</phase>
<goals>
<goal>install-node-and-npm</goal>
</goals>
<configuration>
<nodeVersion>v8.12.0</nodeVersion>
<npmVersion>6.4.1</npmVersion>
</configuration>
</execution>
<execution>
<id>npm install</id>
<phase>generate-resources</phase>
<goals>
<goal>npm</goal>
</goals>
<configuration>
<arguments>install</arguments>
</configuration>
</execution>
<execution>
<id>bower install</id>
<phase>generate-resources</phase>
<goals>
<goal>bower</goal>
</goals>
<configuration>
<arguments>install</arguments>
</configuration>
</execution>
<execution>
<id>grunt build</id>
<phase>generate-resources</phase>
<goals>
<goal>grunt</goal>
</goals>
<configuration>
<arguments>build</arguments>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.1.0</version>
<executions>
<!--
Copy of the /frontendResources directory, coming from GIT, in /target directory
executed before the compiling and build of frontend resources
That dir will be the working directory of npm, bower, grunt
in order to avoid the creation of the direcotries node, node_modules, bower_components, ...
(they may be committed in repository)
-->
<execution>
<id>copy-frontendResources-toStagingDir-beforeBuild</id>
<phase>initialize</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/target/frontendResourcesStagingDir</outputDirectory>
<resources>
<resource>
<directory>${basedir}/src/main/frontendResources</directory>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
<!--
Copy of the /frontendResourcesStagingDir/grunt_output directory in /target/ directory
executed after build of frontend resources and before the war pachage creation
it contains the output of grunt install execution
-->
<execution>
<id>copy-frontendResources-afterBuild</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/target/${artifactId}-${version}</outputDirectory>
<resources>
<resource>
<directory>${basedir}/target/frontendResourcesStagingDir/grunt_output</directory>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
...
This solution is useful also for mixed projects with frontend in Node.js and backend in Java that has a single .war file as output deliverable

jaxb2 goal is not invoked

I am using maven-jaxb2-plugin to generate some classes from xsd.
It is defined in child pom as follows:
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>0.8.0</version>
<executions>
<execution>
<id>jaxb2-generate</id>
<phase>generate-sources</phase>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<configuration>
<forceRegenerate>true</forceRegenerate>
<!-- Generate classes from XSD (XML Schema) using JAXB -->
<schemaDirectory>src/main/resources/com/reportcenter/settings/</schemaDirectory>
<generatePackage>com.reportcenter.settings</generatePackage>
<schemaIncludes>
<include>**/*.xsd</include>
</schemaIncludes>
<strict>false</strict>
<extension>true</extension>
<plugins>
<plugin>
<groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>jaxb2-basics</artifactId>
<version>0.6.2</version>
</plugin>
<plugin>
<groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>jaxb2-basics-annotate</artifactId>
<version>0.6.2</version>
</plugin>
</plugins>
<args>
<arg>-Xannotate</arg>
<arg>-XtoString</arg>
<arg>-Xcopyable</arg>
</args>
</configuration>
</plugin>
</plugins>
</pluginManagement>
The problem is the jaxb2 is not called from mvn install or mvn compile or mv generate-sources.
If I call mvn jaxb2:generate (as the name of the goal) the classes are created OK.
I looked at some questions here and used the answers provided, but I am still missing something.
Thank you.
Disclaimer: I am the author of the maven-jaxb2-plugin.
Seems like you only configure the plugin in pluginManagement but don't actualy use it in your build part.
This is how it should look like:
<project ...>
...
<build>
<plugins>
...
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>0.12.3</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
</plugin>
...
</plugins>
</build>
...
</project>
Few other comments on your configuration:
0.8.0 is a very old version, 0.12.3 is the actual one.
With modern Maven you no longer need to configure maven-compiler-plugin with source/target version 1.6.
Do not use forceRegenerate.
Consider using binding files instead of generatePackage.
Current version of jaxb2-basics is 0.9.2.
I ran into an error related to this plugin, and the Eclipse Maven integration.
Most searches for an answer were fruitless, but often lead to this thread. So, I'm going to post the issue, and a workaround here, for any others that run into it.
While using the maven-jaxb2-plugin:0.12.3 plugin correctly in maven on the command line - in Eclipse, source generation would fail with the following error:
Execution default of goal
org.jvnet.jaxb2.maven2:maven-jaxb2-plugin:0.12.3:generate failed: A
required class was missing while executing
org.jvnet.jaxb2.maven2:maven-jaxb2-plugin:0.12.3:generate:
com/sun/xml/bind/api/ErrorListener
Various attempts at adding jar files that contain the class it was looking for would just result in another class missing, going to a rabbit hole of jar file hell and mis-matched classes that wasn't resolvable.
I don't know if the problem here is something that is broken in the Eclipse / M2E integration, or if the problem is in the dependency stack of maven-jaxb2-plugin.
But the solution is to launch Eclipse itself (not the JREs / JDKs installed into eclipse) with a JDK, instead of a JRE.
The easiest way to do that is to add -vm parameter to your eclipse.ini file:
-startup plugins/org.eclipse.equinox.launcher_1.3.0.v20140415-2008.jar
-vm C:\Program Files\Java\jdk1.8.0_31\bin\javaw.exe
--launcher.library plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.200.v20150204-1316
-product
...snip...
Upgrade to version 0.13.2 +
Kudos to #lexicore for the comment below

How to Execute DOS commands through maven?

I got solution for ant but how can I execute DOS command through maven ?
I am building my script in gruntjs and for run that I use node command prompt but I want to execute that command through maven. Any Idea???
This might be a use case for Maven's Exec Plugin.
Experiment with exec:exec goal in the plugin.
<plugin>
<artifactId>exec-maven-plugin</artifactId>
<groupId>org.codehaus.mojo</groupId>
<executions>
<execution>
<id>Script Run</id>
<phase>generate-sources</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>${basedir}/<relativepathinyourproject>/yourscript.bat</executable>
</configuration>
</execution>
</executions>
</plugin>

Resources