Creation of Source Folder during eclipse task

Hi, when i try to execute “eclipse” task it automatically creates the following source folder:

src/main/java
src/main/resources
src/test/java
src/test/resources

Is there a way to exclude the creation of “src/main/resources” and “src/test/resources” during eclipse task? how? thanks

Which version of Gradle are you using? It definitely should not create these directories.

im using gradle 2.11…

bwt below is my the script in my build.gradle:

buildscript {
repositories {
jcenter()
mavenCentral()
}

dependencies {
    classpath 'com.bmuschko:gradle-tomcat-plugin:2.0'

}

}

apply plugin: 'eclipse’
eclipse {
classpath {
downloadSources=true
}
}

apply plugin: 'java’
compileJava.options.encoding = 'UTF-8’
dependencies {

	// Spring Framework Libraries
	compile 'org.springframework:spring-beans:4.2.4.RELEASE'
	compile 'org.springframework:spring-context:4.2.4.RELEASE'
	compile 'org.springframework:spring-core:4.2.4.RELEASE'
	compile 'org.springframework:spring-web:4.2.4.RELEASE'
	compile 'org.springframework:spring-webmvc:4.2.4.RELEASE'
	compile 'org.springframework.data:spring-data-jpa:1.9.2.RELEASE'
	compile 'org.springframework:spring-jdbc:4.2.4.RELEASE'
	compile 'org.springframework:spring-orm:4.2.4.RELEASE'
compile 'org.springframework:spring-test:4.2.4.RELEASE'
	compile 'org.springframework:spring-webmvc:4.1.6.RELEASE'


	// Hibernate Libraries
	compile 'org.hibernate:hibernate-core:5.1.0.Final'
	compile 'org.apache.commons:commons-dbcp2:2.1.1'
	compile 'commons-beanutils:commons-beanutils:1.9.2'
	compile 'org.hibernate:hibernate-validator:5.0.1.Final'

	// JSON Databinding Libraries
	compile 'com.fasterxml.jackson.core:jackson-core:2.7.1'
	compile 'com.fasterxml.jackson.core:jackson-databind:2.7.1-1'

	// Tomcat Dependencies
	// compile 'org.apache.tomcat:tomcat-annotations-api:7.0.42'
	// compile 'org.apache.tomcat:tomcat-el-api:7.0.42'
	// compile 'org.apache.tomcat:tomcat-jasper:7.0.42'
	// compile 'org.apache.tomcat:tomcat-jsp-api:7.0.42'
	// compile 'org.apache.tomcat:tomcat-servlet-api:7.0.42'
	// compile 'org.apache.tomcat:tomcat-api:7.0.42'

	// Other Dependencies
	compile 'org.slf4j:slf4j-simple:1.7.7'
	compile 'org.javassist:javassist:3.15.0-GA'
	compile 'mysql:mysql-connector-java:5.1.38'
  compile 'org.mockito:mockito-all:1.10.19'
  compile 'junit:junit:4.12'
	compile 'javax.validation:validation-api:1.1.0.Final'

// Spock Dependencies
  compile 'org.spockframework:spock-core:1.0-groovy-2.4'
  compile 'org.spockframework:spock-spring:1.0-groovy-2.4'
  compile 'cglib:cglib-nodep:3.2.1'

// Groovy Dependencies
compile 'org.codehaus.groovy:groovy-all:2.4.4'

// Servlet API
	//		provided 'javax.servlet.jsp:jsp-api:2.2'
	compile 'javax.servlet:javax.servlet-api:3.1.0'
	compile 'commons-logging:commons-logging:1.2'


}

apply plugin: 'war’
apply plugin: ‘com.bmuschko.tomcat’

// JDK version source compatibility
sourceCompatibility = 1.7
// project version
version = ‘1.0’
// War file name
war.baseName = ‘WebGradle’
// Web directory, this overrides the default value "webapp"
project.webAppDirName = ‘WebContent’

repositories {
mavenLocal()
mavenCentral()
}

test {
testLogging {
// Show that tests are run in the command-line output
events “passed”, “skipped”, “failed”, “standardOut”, “standardError”
}
dependsOn ‘cleanTest’
}

// dependencies to run on tomcat, are mandatory for tomcat plugin
dependencies {
def tomcatVersion = '7.0.57’
tomcat “org.apache.tomcat.embed:tomcat-embed-core:${tomcatVersion}”,
"org.apache.tomcat.embed:tomcat-embed-logging-juli:${tomcatVersion}"
tomcat(“org.apache.tomcat.embed:tomcat-embed-jasper:${tomcatVersion}”) {
exclude group: ‘org.eclipse.jdt.core.compiler’, module: ‘ecj’
}

}

task prepareBuild {
delete 'build/reports’
delete ‘build/test-results’
}

// context where tomcat is deployed, by defautl localhost:8080/
tomcatRun.contextPath = '/'
tomcatRunWar.contextPath = ‘/’

i added the code below and it works

delete(‘src/main/resources’)
delete(‘src/test/resources’)

eclipse {
classpath {
delete(‘src/main/resources’)
delete(‘src/test/resources’)
downloadSources=true
}
}

Again, the eclipse plugin does not create these folders. There must be something else going on in your build.

Your solution will delete those folders every time you try to invoke gradle (because you are executing it during configuration time). I urge you to remove it from your build script.

Please create a small, reproducible example project, so we can see where the problem is. I tried out your buildscript above and I cannot reproduce the problem.