Open DoNotResuscitate opened 4 years ago
@atg22896 Could you attach a project example?
@atg22896 Could you attach a project example?
@snjeza It's a work project, so I can't exactly share it.
But I can open the project in IntelliJ with no issue. It imports everything just fine.
@atg22896 you could check https://github.com/eclipse/buildship/issues/811
@atg22896 you could check eclipse/buildship#811
@snjeza This does actually seem to be a nested folder issue. Under src -> main -> resources -> templates there is another project structure, with another (src -> main / test) folder structure. A whole other gradle project nested. When I delete the (templates) folder, clean everything up, and restart VS Code, it all works fine.
My settings.json is as follows:
{
"files.exclude": {
"**/.classpath": true,
"**/.project": true,
"**/.settings": true,
"**/.factorypath": true,
},
"java.import.exclusions": [
"**/node_modules/**",
"**/.metadata/**",
"**/archetype-resources/**",
"**/META-INF/maven/**",
"**/src/main/resources/templates/**"
],
"java.configuration.updateBuildConfiguration": "automatic"
}
Is there any way to make the Java plugin ignore this nested directory and instead only process the root gradle project?
Is there any way to make the Java plugin ignore this nested directory and instead only process the root gradle project?
You have already used the java.import.exclusions property.
Is there any way to make the Java plugin ignore this nested directory and instead only process the root gradle project?
You have already used the java.import.exclusions property.
If that is all that is needed, why does it seem to ignore the exclusions and continue to fail because it tries to read this second project?
You could try to call Java: Clean the Java language workspace.
I've tried that a thousand times. I still get the same error listed in my first post. Even with the exclusion property listed, it still tries to read into the nested folder and then fails. Explicitly deleting the templates folder and cleaning allows everything to run fine.
You could try the following settings:
"java.import.exclusions": [
"**/node_modules/**",
"**/.metadata/**",
"**/archetype-resources/**",
"**/META-INF/maven/**",
"**/src/main/resources/templates"
],
or
"java.import.exclusions": [
"**/node_modules/**",
"**/.metadata/**",
"**/archetype-resources/**",
"**/META-INF/maven/**",
"**/templates"
],
Neither of those worked. I also tried:
"java.import.exclusions": [
"**/node_modules/**",
"**/.metadata/**",
"**/archetype-resources/**",
"**/META-INF/maven/**",
"**"
],
And that is properly not importing anything, so I get the messages that the Java files aren't on the classpath as one would expect. But even:
"java.import.exclusions": [
"**/node_modules/**",
"**/.metadata/**",
"**/archetype-resources/**",
"**/META-INF/maven/**",
"**/src/**"
],
and
"java.import.exclusions": [
"**/node_modules/**",
"**/.metadata/**",
"**/archetype-resources/**",
"**/META-INF/maven/**",
"**/src/"
],
do nothing. I have no problem emailing you the project, I just do not want to post it publicly for all.
I have attached a demo project though. This has a nested project structure and I am attempting to ignore it. I get these errors, which I would expect it not to care about if it is ignoring the directory:
demo.zip
Could you try the following build.gradle:
plugins {
id 'org.springframework.boot' version '2.2.4.RELEASE'
id 'io.spring.dependency-management' version '1.0.9.RELEASE'
id 'java'
id 'eclipse'
}
group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter'
testImplementation('org.springframework.boot:spring-boot-starter-test') {
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}
}
test {
useJUnitPlatform()
}
eclipse {
classpath {
file {
whenMerged {
def src = entries.find { it.path == 'src/main/resources' }
src.each {
it.excludes = ["templates/**"]
}
}
}
}
}
That fixed the errors that were shown. Doing the same thing for my other project doesn't work though, I still get the "Cannot nest output folder () inside output folder ()".
Do you want me to email you the project?
Do you want me to email you the project?
Do it, please. My email is snjezana.peco@redhat.com
@atg22896 could you try the following:
// task wrapper(type: Wrapper) { gradleVersion = '2.14.1' }
$ ./gradlew wrapper --gradle-version=6.1.1
$ ./gradlew --version
eclipse {
classpath {
defaultOutputDir = file('target-default')
file {
whenMerged {
cp -> cp.getEntries().forEach {
cpEntry -> if(cpEntry.kind=='src') {
cpEntry.output = cpEntry.output.replace('bin/', 'target/')
}
}
def src = entries.find { it.path == 'src/main/resources' }
src.each {
it.excludes = ["templates/**"]
}
}
}
}
}
I have same problem, for source files generated from Quarkus grpc. My environment is:
If I run a gradle clean, importing the project into VSCode works fine. But if then I generate sources from my proto (via gradle quarkusGenerateCode
), vscode ignores them.
If I try to import or refresh the project with Java: Clean the Java language workspace, I get the blocking error:
Java Model Exception: Error in Java Model (code 964): Cannot nest 'dh-articoli/build/classes/java/quarkus-generated-sources/grpc' inside 'dh-articoli/build/classes/java/quarkus-generated-sources'. To enable the nesting exclude 'grpc/' from 'dh-articoli/build/classes/java/quarkus-generated-sources'
I'm trying to exclude the folder using java.import.exclusions
in settings.json, but no luck so far. Any help is greatly appreciated.
@fdasoghe Appreciate that this is a while a go, but did you manage to come up with a solution? Hitting the exact same issue with Quarkus grpc
@Inlustra I had the same problem but using Eclipse, I therefore don't think this is a VSCode specific issue. The solution to the Eclipse issue was listed as changing project settings to "allow output folders for source folders", see here on StackOverflow. Perhaps there is some VSC equivalent for this.
I am unable to open a gradle project in VS Code without the below error message occurring. It prevents the java imports from processing properly, as it says they cannot be found.
[Error - 6:14:53 PM] Feb 11, 2020 6:14:53 PM Failed to configure project extension-project-starter Cannot nest output folder 'extension-project-starter/bin/main' inside output folder 'extension-project-starter/bin' Java Model Exception: Java Model Status [Cannot nest output folder 'extension-project-starter/bin/main' inside output folder 'extension-project-starter/bin'] at org.eclipse.jdt.internal.core.JavaModelOperation.runOperation(JavaModelOperation.java:798) at org.eclipse.jdt.internal.core.JavaProject.setRawClasspath(JavaProject.java:3573) at org.eclipse.jdt.internal.core.JavaProject.setRawClasspath(JavaProject.java:3533) at org.eclipse.jdt.internal.core.JavaProject.setRawClasspath(JavaProject.java:3546) at org.eclipse.jdt.internal.core.JavaProject.setOutputLocation(JavaProject.java:3489) at org.eclipse.buildship.core.internal.workspace.OutputLocationUpdater.update(OutputLocationUpdater.java:37) at org.eclipse.buildship.core.internal.workspace.BaseConfigurator.synchronizeJavaProjectInTransaction(BaseConfigurator.java:115) at org.eclipse.buildship.core.internal.workspace.BaseConfigurator.access$000(BaseConfigurator.java:40) at org.eclipse.buildship.core.internal.workspace.BaseConfigurator$1.run(BaseConfigurator.java:105) at org.eclipse.jdt.internal.core.BatchOperation.executeOperation(BatchOperation.java:41) at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:736) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2292) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2317) at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:5862) at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:5819) at org.eclipse.buildship.core.internal.workspace.BaseConfigurator.synchronizeJavaProject(BaseConfigurator.java:101) at org.eclipse.buildship.core.internal.workspace.BaseConfigurator.configure(BaseConfigurator.java:91) at org.eclipse.buildship.core.internal.workspace.BaseConfigurator.configure(BaseConfigurator.java:66) at org.eclipse.buildship.core.internal.extension.InternalProjectConfigurator.configure(InternalProjectConfigurator.java:65) at org.eclipse.buildship.core.internal.workspace.ProjectConfigurators.configureConfigurators(ProjectConfigurators.java:68) at org.eclipse.buildship.core.internal.workspace.SynchronizeGradleBuildOperation.synchronizeOpenWorkspaceProject(SynchronizeGradleBuildOperation.java:163) at org.eclipse.buildship.core.internal.workspace.SynchronizeGradleBuildOperation.synchronizeWorkspaceProject(SynchronizeGradleBuildOperation.java:137) at org.eclipse.buildship.core.internal.workspace.SynchronizeGradleBuildOperation.synchronizeGradleProjectWithWorkspaceProject(SynchronizeGradleBuildOperation.java:127) at org.eclipse.buildship.core.internal.workspace.SynchronizeGradleBuildOperation.access$000(SynchronizeGradleBuildOperation.java:42) at org.eclipse.buildship.core.internal.workspace.SynchronizeGradleBuildOperation$1.run(SynchronizeGradleBuildOperation.java:85) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2292) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2312) at org.eclipse.buildship.core.internal.workspace.SynchronizeGradleBuildOperation.synchronizeProjectsWithWorkspace(SynchronizeGradleBuildOperation.java:82) at org.eclipse.buildship.core.internal.workspace.SynchronizeGradleBuildOperation.run(SynchronizeGradleBuildOperation.java:64) at org.eclipse.buildship.core.internal.DefaultGradleBuild$SynchronizeOperation.runInToolingApi(DefaultGradleBuild.java:230) at org.eclipse.buildship.core.internal.operation.DefaultToolingApiOperationManager$WorkspaceRunnableAdapter.run(DefaultToolingApiOperationManager.java:58) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2292) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2317) at org.eclipse.buildship.core.internal.operation.DefaultToolingApiOperationManager.run(DefaultToolingApiOperationManager.java:39) at org.eclipse.buildship.core.internal.DefaultGradleBuild$SynchronizeOperation.run(DefaultGradleBuild.java:192) at org.eclipse.buildship.core.internal.DefaultGradleBuild.synchronize(DefaultGradleBuild.java:100) at org.eclipse.buildship.core.internal.DefaultGradleBuild.synchronize(DefaultGradleBuild.java:86) at org.eclipse.jdt.ls.core.internal.managers.GradleBuildSupport.update(GradleBuildSupport.java:58) at org.eclipse.jdt.ls.core.internal.managers.ProjectsManager$3.runInWorkspace(ProjectsManager.java:537) at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:42) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
Environment
Steps To Reproduce
[attach a sample project reproducing the error] attach logs
Current Result
Project does not configure, and all my java files say imports not found
Expected Result
The project configures
Additional Informations