Skip to content

Run Maven, Gradle or other batch-based script from Java (and then Eclipse) #117

@paulvi

Description

@paulvi

asked on http://stackoverflow.com/questions/21177198/run-maven-gradle-or-other-batch-based-script-from-java-and-then-eclipse

I am making Eclipse plugin https://github.com/Nodeclipse/nodeclipse-1/tree/master/org.nodeclipse.enide.maven that run alternative build from within Eclipse
(e.g. for project that have both pom.xml and build.gradle do run with mvn package or gradle build)

But entry point for both of them are batch .bat files on Windows and bash on Linux.
For Windows running from Java would look like

    Runtime.getRuntime().exec("cmd /c start mvn");

but that will start new window, while I want it to see running in Eclipse Console.

There must be something like http://commons.apache.org/proper/commons-exec/ but in Eclipse way I guess. How to run such script from Eclipse and see output in Console?
This is meant to be alternative and not dependent on m2e and Gradle Integration.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions