Linkedresource and .classpath

Anybody can help me telling me how to add an linkedresource to my .classpath under Eclipse 2019-06?.
I have followed all instructions to create linked resources and it is properly generated to my .project but no way to get it added to my .classpath: I have refreshed gradle project, built using eclipseClasspath and eclipse tasks and no result.

I have discovered how to make it work, at last!

I also encountered the same problem, can you tell me how to add it to the classpath? Thank you!

This might help: buildship/LinkedProjectClasspathEntriesTest.groovy at 35d01caad3ab023fdd9fdf4a1b9e9c738bff7fd0 · eclipse/buildship · GitHub

thank you for your reply! But how to use this script? I mean how to implement this function in build.gradle?

Exactly. Copy-paste the code from the test class to your build.gradle file and then run a project synchronization. The build script should look something like this.

plugins {
  id 'java-library'
  id 'eclipse'
}

import org.gradle.plugins.ide.eclipse.model.Library

eclipse {
  project.linkedResource name: 'linked-dir'', type: '2', location: '${(new File("/my/local/dir").)absolutePath}'
    classpath.file.whenMerged {
      entries += new Library(fileReference('linked-dir'))
    }
}

Thank you for your prompt reply. But this has become a library. I need to become a source folder。


I want to be like this, this is my manual addition in eclipse.

You’ll find the concrete classes you can add to entries here:
https://docs.gradle.org/current/javadoc/org/gradle/plugins/ide/eclipse/model/ClasspathEntry.html

Can you help me write a demo, I am not familiar with java groovy scripts, thank you! I just studied for 2 days.

I urgently need to solve this problem and look forward to your reply, thank you!