0

我已经在 Ubuntu 14.04 上安装了 gradle 2.0,我想用 Gradle 运行一个小 Web 应用程序,但是当我在 Eclipse Luna 上构建 Gradle 项目时(我已经为 Eclipse 4.4 安装了 Gradle 集成插件)并输入“gradle tasks” " 在终端上它不显示任务 "jettyEclipse" 来运行 servlet。

这是我的build.gradle

buildscript {
        repositories {
            jcenter() 
        }

        dependencies {
            classpath (group: 'com.sahlbach.gradle', name: 'gradle-jetty-eclipse-plugin',     version: '1.9.2')
        }
    }

    apply plugin: 'java'
    apply plugin: 'war'
    apply plugin: 'jettyEclipse'
    apply plugin: 'eclipse'
    apply plugin: 'eclipse-wtp'


    repositories {
       mavenCentral()                                               
    }

    dependencies {
       providedCompile 'javax.servlet:javax.servlet-api:3.0.1'
    }

这里是编译输出:

[sts] -----------------------------------------------------
[sts] Starting Gradle build for the following tasks: 
[sts]      :cleanEclipse
[sts]      :eclipse
[sts] -----------------------------------------------------
:cleanEclipseClasspath
:cleanEclipseJdt
:cleanEclipseProject
:cleanEclipseWtpComponent
:cleanEclipseWtpFacet
:cleanEclipseWtp
:cleanEclipse
:eclipseClasspath
:eclipseJdt
:eclipseProject
:eclipseWtpComponent
:eclipseWtpFacet
:eclipseWtp
:eclipse

BUILD SUCCESSFUL

Total time: 1.14 secs
[sts] -----------------------------------------------------
[sts] Build finished succesfully!
[sts] Time taken: 0 min, 1 sec
[sts] -----------------------------------------------------

这里是我的“gradle tasks”输出:

:tasks

------------------------------------------------------------
All tasks runnable from root project
------------------------------------------------------------

Build Setup tasks
-----------------
init - Initializes a new Gradle build. [incubating]
wrapper - Generates Gradle wrapper files. [incubating]

Help tasks
----------
dependencies - Displays all dependencies declared in root project 'me'.
dependencyInsight - Displays the insight into a specific dependency in root project 'me'.
help - Displays a help message
projects - Displays the sub-projects of root project 'me'.
properties - Displays the properties of root project 'me'.
tasks - Displays the tasks runnable from root project 'me'.

To see all tasks and more detail, run with --all.

BUILD SUCCESSFUL

Total time: 3.35 secs

我也尝试过 1.9 和 2.1 gradle 版本。

谁能帮我?

4

1 回答 1

0

gradle tasks在我的主目录中执行,而不是在项目目录中(我有build.gradle.Peter 感谢您的帮助。

于 2014-10-10T19:22:55.930 回答