Import configuration troubles

I’ve installed BuildShip plugin 1.0.20 in eclipse.

This is my project structure:

infrastructure
|
+---living_authz
+---living_community
+---living_dsl
+---living_webapi
+---living_lib
+---settings.gradle
+---build.gradle

The content of settings.gradle is:

include ":living_lib", ":living_webapi", ":living_authz", ":living_dsl", ":living_community"

I’ve imported these projects using base location of infrastructure. So, the other projects have been imported in Eclipse.

Each time I click on Gradle -> Refresh Project it:

  • Add a infrastructure project in eclipse, creating a infrastructure folder inside base infrastructure folder (infrastructure/infrastructure).
  • Sometimes it tells me that its not able to nest source folders:
    Cannot nest 'living_webapi/src/main/java/com/living/persistence/entities' inside 'living_webapi/src/main/java'. To enable the nesting exclude 'com/' from 'living_webapi/src/main/java']
  • Sometimes it’s telling me that: A project with the name infrastructure already exists.

Could anybody give me some light?
Thanks for all.

Hi,

Without a sample project I can only guess, but the cannot nest... kind of exception happens when your project defines multiple source folders where one contains the other (like src and src/main/java).

Regarding the already exists exception, it might be that when you - unsuccessfully - try to import the project, the root project gets created and you have to delete it manually before retrying. If you use working sets to categorize projects in Eclipse, then this root project can be hidden by default.

I’m using additional configurations, and I set several srcDirs:

configurations {
    jpamodelgen
    querydsl
}

sourceSets {	
	jpamodelgen {
        java {
            srcDirs = ['src/main/java/com/living/persistence/entities']
        }
    }
    querydsl {
        java {
            srcDirs = [
            	'src/main/java/com/living/persistence/entities',
            	'src/main/java/com/living/persistence/entities/metainfos/values',
            	'src/main/java/com/living/persistence/entities/metainfos',
            	'src/main/java/com/living/rest/dto/metainfos'
            ]
        }
    }
}

I’ve just realized each srcDir specified on those configurations are added as source folders in eaclipse project as well.

Is there some way to exclude them?

In my eclipse classpath configuration I’ve already set I want to exclude them using minusConfigurations, however, gradle is adding these srcDirs as source folders:

eclipse {
	classpath {
		downloadSources = true
		downloadJavadoc = true
		
		//customizing the classes output directory:
    	defaultOutputDir = file('build-eclipse')
	   
    	minusConfigurations += [ configurations.querydsl ]
	}

You can unset the src/main/java source folder with the following configuration:

sourceSets.main.java.srcDirs = []

Also, since Buildship 1.0.18 (+Gradle 3.0) you can customize the entire classpath as you wish. You’ll find samples in the release announcement.