繁体   English   中英

如何在 eclipse 中重命名 gradle 项目?

[英]How to rename a gradle project in eclipse?

我是 gradle 的新手,并尝试在 eclipse 中使用 gradle 插件。

使用在线项目生成器https://gwt-project-generator.cfapps.io/创建了 java gwt 项目

在此处输入图像描述

它很好地导入了所有依赖项。

现在我正在尝试将项目从 demo 重命名为 gradle-demo,我很困惑。 它每次都会自动将名称恢复为演示。 在 build.gradle 文件中,我看不到任何表明名称强制执行的内容。

任何指针?

    buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'de.richsource.gradle.plugins:gwt-gradle-plugin:0.6'
    }
}

apply plugin: 'gwt'
apply plugin: 'war'

// In this section you declare where to find the dependencies of your project
repositories {
    jcenter()
}

repositories { mavenCentral() }

// In this section you declare the dependencies for your production and test code
dependencies {
    providedCompile('fr.lteconsulting:angular2-gwt:1.6')
    providedCompile('com.google.dagger:dagger-gwt:2.8')
    providedCompile('org.jboss.gwt.elemento:elemento-core:0.5')
    providedCompile('com.vaadin.polymer:vaadin-gwt-polymer-elements:1.7.0.0')
    providedCompile('org.gwtbootstrap3:gwtbootstrap3:0.9.3')
    providedCompile('com.github.tdesjardins:gwt-ol3:2.9.0')
    providedCompile('com.googlecode.gwtquery:gwtquery:2.1.0')
    providedCompile('com.github.gwtreact:gwt-react:0.3.0')
    providedCompile('com.gwidgets:gwty-leaflet:0.4')
    providedCompile('com.sksamuel.jqm4gwt:jqm4gwt-remote:2.1.0')
    providedCompile('com.intendia.gwt:rxjava-gwt:1.0.14-beta1')
    testCompile('junit:junit:4.11')
    testCompile('com.google.gwt.gwtmockito:gwtmockito:1.1.6')

}

gwt {
    gwtVersion='2.8.0'

    modules 'com.ainosoft.firstGradleGwt'

    maxHeapSize = "1024M"

    superDev {
        noPrecompile=true
    }
}

它还显示 gwt 的项目配置中缺少构建器在此处输入图像描述

将此添加到您的build.gradle

apply plugin: 'eclipse'
eclipse {
    project {
        name = 'some-better-name'
    }
}

请参阅EclipseProject 文档

Eclipse 的Refactor->Rename...似乎不能与 Gradle 项目完美配合。

  • 打开settings.gradle并相应地修改rootProject.name

    例如:

     rootProject.name = 'coolproject'

    确保这是在settings.gradle ,而不是build.gradle

  • 右键单击项目,然后单击Gradle->Refresh Gradle Project

重命名 eclipse 中的 Gradle 项目。

1)右键单击项目->重构->重命名->键入新名称并勾选更新引用并单击确定

2)打开settings.gradle并相应修改rootProject.name并保存

例如:

rootProject.name = 'coolproject'

3)右键项目,点击Gradle->Refresh Gradle项目。

4)在此之后也显示错误,然后关闭 eclipse 并重新打开。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM