Skip to content

Reference other unmanaged folders as dependencies #2853

Open

Description

@javierjcf

[provide a description of the issue]

Environment
  • Operating System: ANY
  • JDK version: 11
  • Visual Studio Code version: 1.74.2
  • Java extension version: Any
Steps To Reproduce
  1. Create a javaproject 0, a package and a class
  2. Create other project 1 a package and a class where you use class of project 0.

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.

Activity

  1. changed the title [-]Add src folThe source path must be contained in the project root folder.[/-] [+]Add src follder error: The source path must be contained in the project root folder.[/+] on Jan 3, 2023
  2. jdneo commented on Jan 4, 2023

    @jdneo
    Collaborator

    AFAIK, if you are using project without build tools (unmanaged folder), we do not support referencing another unmanaged folder as a dependency today.

  3. changed the title [-]Add src follder error: The source path must be contained in the project root folder.[/-] [+]Reference other unmanaged folders as dependencies[/+] on Jan 4, 2023
  4. anandbibek commented on Feb 11, 2023

    @anandbibek

    @javierjcf could we try opening the lowest common parent folder in vscode and mark the different unmanaged folders as "src" in .classpath file?

    This plugin will help in setting up a local project in the parent folder.
    https://marketplace.visualstudio.com/items?itemName=mellena1.eclipse-new-java-project

  5. removed
    dependenciesPull requests that update a dependency file
    on Feb 12, 2023
  6. ryanmkurtz commented on Nov 25, 2024

    @ryanmkurtz

    I am looking for a way to add an external bin/main (for example) to my settings.json, such that it gets put on the class path. I think this ticket is asking for the same thing.

  7. cicciozell commented on Jul 31, 2025

    @cicciozell

    Same here, this VSC limitation is incredibly inconvenient and makes it impossible to use in fairly large projects.

  8. cicciozell commented on Sep 20, 2025

    @cicciozell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions