Home > Net >  Error in Visual srudio code java extension: Set other project in source path: The source path must b
Error in Visual srudio code java extension: Set other project in source path: The source path must b

Time:01-05

Suppose I have 4 independent Java projects: project0, project1, project2, and project3.

Inside each project, I have the src folder, and inside some packages and classes. Project 1, 2, and 3 use classes from project0.

In Eclipse, I can indicate in a section that the sources of project 0 are used. When I try something similar in VScode, I go to configure the classpath of project one and see that it includes its src folder. When I add the src folder of project0, I get the following error: "The source path must be contained in the project root folder."

I can solve this by creating the .jar of project 0 and adding it to the other projects, but this is very inconvenient when making quick tests.

I know there are tools like Maven or Ant to do these things, but I would like to know if there is any way to indicate in vscode that one project uses classes from another without having to include the .jar as a dependency.

projeca0
-src
 -package0
   -class0

peoject1
 -src
 -package1
  -class1

If class1 uses class0, it will fail. I wish add project0/src as dependency of project1 without creatinfg project0 .jar and add it to project 1.

CodePudding user response:

Copying class0 to project1 is a simple and effective way. Or add project0 to project1's source path.

enter image description here

CodePudding user response:

I post the same question as a Github Issue (here)[https://github.com/redhat-developer/vscode-java/issues/2853]

As they said: "Is not posible support referencing another unmanaged folder as a dependency today"

Vs code calls unmanaged folder any without build tools, so for the moment the only option is to inject dependency as a .jar file

  • Related