Launching Gradle builds from Eclipse

后端 未结 12 432
终归单人心
终归单人心 2020-12-28 11:59

We\'re looking at converting our Ant build to Gradle.

In regards to integration with Eclipse, we are looking for (conceptually) equivalent functionality for launch

相关标签:
12条回答
  • 2020-12-28 12:19

    There is also Enide Gradle http://www.nodeclipse.org/projects/gradle
    that can be used with or without Gradle IDE by Pivotal.
    In Gradle, Maven or CDT(C++) project.

    run

    As separate plugin, it can have different configuration for Gradle version and Java version to use

    This, Gradle IDE Pack are within Enide

    0 讨论(0)
  • 2020-12-28 12:19

    One more new project in 2016 is EGradle

    https://github.com/de-jcup/egradle

    Also does not require Project to be of particular nature, just existing build.gradle would be enough.

    User guide is in built-in help (F1) or preview at https://rawgit.com/de-jcup/egradle/master/egradle-plugin-main/html/user_guide.html

    0 讨论(0)
  • 2020-12-28 12:22

    You can create a custom launcher from eclipse which would invoke your Gradle build.

    0 讨论(0)
  • 2020-12-28 12:29

    This is kind of an old post, but the SpringSource STS team has released a plugin: http://static.springsource.org/sts/docs/latest/reference/html/gradle/

    Installation instructions can be found here: http://static.springsource.org/sts/docs/latest/reference/html/gradle/installation.html

    My experience has been pretty positive with it so far. For straight-up Java projects it works quite well. I am having some issues generating correct war files through Eclipse, while using the Gradle plugin, but gradle itself does it wonderfully. I am relatively new to gradle and the plugin though, so it could be something that I am missing.

    0 讨论(0)
  • 2020-12-28 12:30

    You can use Buildship as stated by FkYkko. However, one thing to keep in mind is that Ant tasks are considered first-class citizens in gradle. This means you can simply import an ant build script, referencing its tasks the same way you reference gradle tasks. Doing things this way allows you to simply use your ant tasks out of the box with gradle, without converting them to gradle tasks.

    For example, say you have a build script named build.xml in the same directory as your build.gradle, and a task in build.xml named buildProj. You can import build.xml, and call build proj from build.gradle like this:

    task antDeps {
        ant.importBuild 'build.xml'
    }
    
    task buildAll (dependsOn:['buildProj']) {
        // the rest of your gradle task here.
    }
    

    See this, or this for more info.

    0 讨论(0)
  • 2020-12-28 12:32

    Interim work-around more palatable to those with command-line phobia.

    From Eclipse, use pulldown menu Run / External Tools / External Tools Configurations...

    Select "Program" in left navigator panel then click the "New launch configuration" button in the tool bar (first button in my tool bar).

    With Main tab selected, fill out the following fields:

    1. Name: (above the tabs) to "Gradle" (or whatever name you want for the launcher).
    2. Location: Use "Browse File System..." button to navigate to your "gradle.bat" or "gradlew.bat" to run.
    3. Working Directory: Use "Browse Workspace..." button to select directory with the "build.gradle" file for the desired project.
    4. Arguments: Enter "--gui"

    Add to Arguments: the switch "-b filename.gradle" if you use a Gradle build file other than "build.gradle".

    After this, your developers can use the Run / External Tools or tool bar button to launch the Gradle Gui. They can do this and close it after each use, or (to avoid startup lag), minimize it when not in use.

    0 讨论(0)
提交回复
热议问题