Eclipse plugin doesn't configure source folders

eclipse

#1

I’ve a single gradle file where I’m applying eclipse plugin:

plugins {
    id 'java'
	id 'eclipse'
}

repositories {
	mavenCentral()
}
	
dependencies {
	compile 'javax.servlet:javax.servlet-api:3.1.0'
	compile 'org.codehaus.jettison:jettison:1.3.7'
	compile 'org.apache.directory.api:api-all:1.0.0-M30'
	compile 'com.whalin:Memcached-Java-Client:3.0.2'
	compile 'org.mongodb:mongo-java-driver:2.14.3'
	compile 'commons-configuration:commons-configuration:1.10'
}

task wrapper(type: Wrapper) {
    gradleVersion = '3.1'
}

manifest {
    attributes 'Implementation-Title': '---', 'Implementation-Version': 0.1
}

All my source files are under src/main/java. When I perform gradle eclipse it generates me eclipse artifacts. Then, I import this project using Import > General > Existing project into workspace. Nevertheless, my source folders are not set such as source folder into imported project.

Porject structure:

workspace
└───project
    └───src
        └───main
            ├───java
            └───resources

I’d also like to set other parameters like output folder, java compliance compiler…

Any ideas?


(Stefan Oehme) #2

Can you please provide a reproducible example project on GitHub?


(Joshua Street) #3

Also, you can have Buildship do the import. If it is installed do: File -> Import... -> Gradle -> Gradle Project Newest versions of gradle and buildship have much improved eclipse plugin support so that it can create the proper .project and .classpath files for you. Just make sure you apply the eclipse or eclipse-wtp (for web projects) to the top level project (if it is a multi-module project set).