User
User

Reputation: 4211

Gradle tasks are disabled in eclipse

I'm trying to create a .jar file for my eclipse project. Through export option, I am able to create .jar, but I want to use Gradle build task to do so. Problem is that, all tasks are disabled for this particular project only, as showing in the following image...

Gradle Tasks

For another project, these Gradle tasks are working fine. See its build.gradle file...

apply plugin : 'eclipse'
apply plugin: 'java-library'

repositories {
    jcenter()
    mavenCentral()
}

dependencies {
    compile group:"org.apache.pdfbox", name:"pdfbox", version:"2.0.6"
    compile group:"org.apache.pdfbox", name:"pdfbox-tools", version:"2.0.6"
    compile 'com.google.code.gson:gson:2.8.2'
    compile 'org.json:json:20180130'

    api 'org.apache.commons:commons-math3:3.6.1'

    implementation 'com.google.guava:guava:21.0'

    testImplementation 'junit:junit:4.12'
}

It's settings.gradle file contains a single line that is...

rootProject.name = 'schedule-extractor'

Can anybody suggest what I am missing here?

Upvotes: 5

Views: 5643

Answers (2)

User
User

Reputation: 4211

In my case, It happened when I was using composite build concept of Gradle. According to this approach, One build could be dependent on another build. In this case, the projects may behave like this.

For example, have a look on my composite build setup in settings.gradle...

rootProject.name = 'BackendRESTServices'
includeBuild ('../Algorithms') 
includeBuild ('../Utilities')

Now I won't be able to build Algorithms & Utilities projects from Gradle Tasks tab as shown in the attached image of question.

Upvotes: 0

TahitianGabriel
TahitianGabriel

Reputation: 762

Have you check this buildship's issue: https://github.com/eclipse/buildship/issues/511

The following comment resolved it for me (I was having the same problem) : https://github.com/eclipse/buildship/issues/511#issuecomment-367392031

For those who had a similar problem in include builds - Check the file .setting/org.eclipse.buildship.core.prefs whether the connection.project.dir property is empty. If not, make it empty. In my case the grayed tasks become green again.

Upvotes: 6

Related Questions