You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Incorrect value of classpathentry element in the .classpath file if in pom.xml the build.sourceDirectory is relative #2216
Short description:
A pom file with a source directory containing "../" isn't imported correctly
Long drescription:
We have a maven "tree" of projects in which some source files have to be shared.
The project is split into components and each component has hundredths of modules (but this doesn't matter for the bug, however that's the reason why we open the code "by components", it's too big to work at the root level).
The simplified version looks like this:
I open, in VS code, the folder B saying that I trust everything which is in the parent folder (so trusting everything which is in ROOT).
It starts importing the projects.
The B1 module is a library which doesn't contain any source files (locally) but, in its pom.xml has
The B2 is a normal module in which file3.java imports A.interface.class1
The B2 module, in its pom, has a dependency on B1.
When I build on maven the build creates these:
B [pom]
B1 [jar]
B2 [jar]
and everything works fine.
Visual studio code, however complains that file3.java has an import that can not be resolved.
This is due to the fact that the module B1 is not "common" because it doesn't have any code in the B1 folder but points to a relative path (which, by the way is one level above the one opened by vscode, but still in the trusted area)
The problem seems to be that in the .classpath file I have this wrong path:
which is wrong because everything with "../../" has been stripped out.
workaround tried:
Editing the .classpath file manually and changing the path. Doesn't work.
Adding the sources dynamically (with the maven build helper). Doesn't work.
The only solution is to copy everything in A/interface/src during the sources generation phase into the B1/target/generated-sources folder. This, of course, wastes lots of times if the sources to copy are a lot.
Activity