0

I'm testing Theia as an Eclipse replacement IDE for my Java projects and am trying to replicate the familiar project structure: a workspace directory containing a folder per project, each project depends on external jars and other projects. E.g.

  • prjA depends on some.jar (copied into the lib subdirectory)
  • prjB depends on other.jar and on prjA

Even though Theia is not a fork of VSCode, its structure is heavily influenced by it (for extensions compatibility I guess?) but I was unable to find anything for VSCode too.

I have been able to create my two Java projects, each with .vscode/settings.json (and also .theia/settings.jsons, which I put to the same content):

  • prjA/.vscode/settings.json:
{
    "java.project.sourcePaths": ["src"],
    "java.project.outputPath": ".bin",
    "java.project.referencedLibraries": [
        "lib/**/*.jar"
    ]
}
  • prjB/.vscode/settings.json:
{
    "java.project.sourcePaths": ["src"],
    "java.project.outputPath": ".bin",
    "java.project.referencedLibraries": [
        "lib/**/*.jar",
        "../prjA/.bin"
    ]
}

(note the added "../prjA/.bin" in prjB).

Yet, I cannot have intellisense detecting the classpath correctly in prjB: classes from external jars are properly identified, but the ones from prjA still show with red waves with The import xxx cannot be resolved.

I tried adding ../prjA/src as an additionnal sourcePaths (through a link because it won't let me add a source folder not in its root), but it compiles prjA's classes into prjB/.bin, which I obviously don't want (but the "import cannot be resolved" errors disappear though).

So, how should I approach Java projects dependencies in a multi-root workspace? (Preferably for Theia, but curious about VSCode as well).

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.