Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to rename a gradle project in eclipse?

I am new to gradle and trying to use the gradle plugin in eclipse.

Created a java gwt project using an online project generator https://gwt-project-generator.cfapps.io/

enter image description here

It imported all the dependencies very nicely.

Now I am trying to rename the project from demo to gradle-demo and I am confused. It automatically reverts the name to demo each time. In the build.gradle file I see nothing that would indicate enforcement of the name.

Any pointers ?

    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
    }
}

It also shows missing builder in project configuration for gwt enter image description here

like image 881
Gautam Avatar asked Dec 05 '25 08:12

Gautam


2 Answers

Add this to your build.gradle

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

See EclipseProject docs

like image 129
lance-java Avatar answered Dec 06 '25 22:12

lance-java


Eclipse's Refactor->Rename... seems not to work perfectly with Gradle projects.

  • Open settings.gradle and modify rootProject.name accordingly.

    For example:

    rootProject.name = 'coolproject'
    

    Make sure this is in settings.gradle, not build.gradle!

  • Right click the project and click Gradle->Refresh Gradle Project

like image 23
nathanfranke Avatar answered Dec 06 '25 20:12

nathanfranke