0

Considering that Java 1.9 is now out for some time, i am still amazed how difficult it is to get a 1.9 project up and running with eclipse and buildship.

I now spend 2 days trying to get this flying and came very far but one issue is something i just get not off the ground:

On top comes this whole "eclipse.classpath.file.whenMerged" stuff in the build.gradle file (my file see below).

Hence my question is two-fold:

  1. Have i missed something that makes the jigsaw support with Gradle and buildship more easy?
  2. What do I have to do to not patch the command line manually (as described in the link above)?

As I am currently evaluating the support of Eclipse/Gradle/Buildship for my team I need to have the second question fixed. Otherwise the developer in my team are going to get nuts. As such I am also contemplating to move away from Eclipse.

Side question: How good is the support in other IDE for modules and Gradle?

I am using

  • Eclipse 2020-12 (4.18.0.v20201202-1800)
  • Eclipse Plug-ins for Gradle 3.1.4.v20200326-1743
  • Java 12
  • Grade 6.7.1

Thank you

/*
 * This file was generated by the Gradle 'init' task.
 *
 * This generated file contains a sample Java library project to get you started.
 * For more details take a look at the 'Building Java & JVM projects' chapter in the Gradle
 * User Manual available at https://docs.gradle.org/6.7.1/userguide/building_java_projects.html
 */

plugins {
    // Apply the java-library plugin for API and implementation separation.
    id 'java-library'
    id 'eclipse'
    id 'application'
}

sourceCompatibility = targetCompatibility = '1.12'

repositories {
    // Use JCenter for resolving dependencies.
    jcenter()
}

dependencies {
    // Use JUnit test framework.
    testImplementation 'junit:junit:4.13'

    // This dependency is used internally, and not exposed to consumers on their own compile classpath.
    implementation 'org.postgresql:postgresql:42.2.18'
}

java {
    modularity.inferModulePath = true
}


application {
    mainModule = 'com.myproduct.mod.lib' // name defined in module-info.java
    mainClass = 'com.myproduct.mod.lib.Library'
}


eclipse {
    classpath {
        
        file {
            whenMerged {
                //Define a module as being either a library or a project dependency.
                //Test sources are excluded because eclipse wants them on the classpath for some reason (1)
                entries.findAll {  (it instanceof org.gradle.plugins.ide.eclipse.model.Library || it instanceof org.gradle.plugins.ide.eclipse.model.ProjectDependency) && !it.entryAttributes.get('gradle_used_by_scope').equals('test') }.each {
                    it.entryAttributes['module'] = 'true'
                }
                
                //Test-scoped stuff should set the appropriate flag
                entries.findAll { (it.properties.kind.equals('src') || it.properties.kind.equals('lib')) && it.entryAttributes.get('gradle_used_by_scope').equals('test') }.each {
                    it.entryAttributes['test'] = 'true'
                }
                
                entries.findAll { isConGradle(it) }.each {
                  it.entryAttributes['module'] = 'true'
                }
            }
        }
    }
}

boolean isConGradle(entry) {
  entry.kind == 'con' && entry.path == 'org.eclipse.buildship.core.gradleclasspathcontainer'
}
  • Looks like https://github.com/eclipse/buildship/pull/1047 Please improve your question: the first two sentence does not provide any information about your issue, just some strange personal views (do not infer from yourself to others). – howlger Dec 31 '20 at 16:01
  • Update site of current snapshots (should contain the fix of the mentioned issue): [`https://download.eclipse.org/buildship/updates/e416/snapshots/3.x/`](https://download.eclipse.org/buildship/updates/e416/snapshots/3.x/). – howlger Dec 31 '20 at 16:26
  • [Issue 658 - Support Jigsaw projects](https://github.com/eclipse/buildship/issues/658) [open] _"There's no short-term plan to work on jigsaw support, so please don't hold your breath."_ – Display Name Feb 01 '21 at 13:05

0 Answers0