-
Notifications
You must be signed in to change notification settings - Fork 446
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
generated-sources/java is not picked up as a source path #1639
Comments
@gayanper could you attach a project example? |
Could you share which maven plugin is generating the Usually you need to configure the lifecycle-mapping-metadata for the source generation maven plugins you used in your project's pom.xml additionally. #177 (comment) shared several workarounds to handle the extra classpath from generated source. |
Unfortunately i cannot share the project since its a proprietary codebase. |
The plugin is a proprietary plugin. The generation and source compilation happens without issues in maven build. The source folders are not detected in vscode. This was a problem in eclipse as well. For eclipse i wrote a m2e extension to handle the source folders. |
Is there a way i can add my eclipse plugins into vscode java ls plugins folder and make it detect my source folders. |
Got my plugin to work with hacking the config.ini adding my plugins into bundles. May be it would be nice if can add support for non ui plugins when we need to extend ls with private plugins which cannot be bundled by default |
you can create a small vscode extension hosting your plugins (provided it doesn't have any Eclipse UI dependencies): https://github.com/redhat-developer/vscode-java/wiki/Contribute-a-Java-Extension#modify-packagejson |
I am having the exact same problem. I have a custom maven plugin that is generating source code to target/generated-sources/some-proprietary-directory for several modules in a multi-module Maven project. The Maven build succeeds. The VS Code "vscjava.vscode-java-pack" extension does not see these generated sources, thus making my development experience broken and unpleasant. I do not understand the above suggested solutions. Could you please detail how I should change my project to make VS Code comprehend it properly? |
I would look at #177 (comment) as that issue has a pretty comprehensive guide on the options. Generally I just tried a basic Maven project with a a folder
Just a simple save in VS Code, and once the project rebuilt, I could confirm the my-extra-dir sources ended up in the |
Sadly it does not even work with the |
I also meet this problem. |
Add the following line Example:
|
I'd like to point out to a simple repro project with jpa-streamer as a sources generator here. Triggering a full compilation results in Compiling and running the application with the maven CLI results in no problems nor warnings. |
A related issue - eclipse-jdt/eclipse.jdt.core#670 |
Hello - A major project has been working for years with generated sources using org.codehaus.mojobuild-helper-maven-plugin. However, I worked on something else for a couple of weeks (and updated VS Code and related Java extensions in the meantime) and now things are broken and generated sources doesn't get picked up any more. I have not yet dug into the issue but it would seem either VS Code or some extension have introduced the problem. Will update when I find out more. Thanks. |
Updating |
We also had a similar problem, where generated sources by buf.build were not visible in VS Code, but it was fine when running <plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<id>add-source-generated</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
- <source>${basedir}/target/generated-sources</source>
+ <source>${basedir}/target/generated-sources/protobuf</source>
</sources>
</configuration>
</execution> |
I have several projects using the code generator from swagger plugin:
It generates code into target/generated-sources/swagger/src/gen/java/main The projects compile in Maven without any problem and I don't have to add any build-helper-maven-plugin. IntelliJ also recognizes this source folders and I don't have to add anything to the POM file. However, VS Code does not recognize it as a source folder.
to the POM file as suggested here but still I can't get this folder added to the classpath when I look into the Java Projects panel and any file using classes from this folder is still marked as having compilation errors. |
@getaceres Could you show your .classpath file? |
@getaceres You can add
|
I've added that but I still don't get a .classpath file. Instead now I have a bin folder in which the whole project is copied and the project doesn't finish loading. |
Could you try to clean the workspace?
|
Could you try to set
|
Sorry for the delay. I tried adding that. Still the same. The moment I add the build-helper-maven-plugin it starts generating the /bin folder and when I add "java.import.generatesMetadataFilesAtProjectRoot": true, it never finishes loading the project and I still don't get a .classpath file. What's more, even after deleting this line, the project doesn't load anymore. |
Like this? |
Hi, I have the same issue the moment I am building SAP CAP Java project with VS code. To not copy the whole post I am linking to stackoverflow. Someone has idea? Many thanks! |
Thanks a lot, This is the fix that worked for me. However it only worked for me in VS code by breaking up onConfiguration and onIncremental, like so...
|
When importing a maven multi module which has modules which contains generated-sources/java the generated-sources/java folder is not added into the source paths. Only the generated-sources/annotations is added.
The text was updated successfully, but these errors were encountered: