We have a project which generates java classes from a .wsdl file. Our jenkins server successfully compiles the project from scratch but our Eclipse IDE configuration requires extra maven lifecycle mapping plugin com.coderplus.m2e.jaxws.
VS Code seems not to be picking up the plugin to generate the wsimport sources.
${project.build.directory}/generated-sources/wsimport is not created
wsimport sources are generated
<plugin>
<groupId>org.jvnet.jax-ws-commons</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>2.3</version>
<executions>
<execution>
<id>wsimport-external-services</id>
<goals>
<goal>wsimport</goal>
</goals>
</execution>
</executions>
<configuration>
<wsdlDirectory>src/main/resources/com/a/b/c/soap</wsdlDirectory>
<wsdlFiles>
<wsdlFile>External_Service.wsdl</wsdlFile>
</wsdlFiles>
<implDestDir>${project.build.directory}/generated-sources/wsimport</implDestDir>
<packageName>com.a.b.c.soap</packageName>
<xjcArgs>
<xjcArg>-mark-generated</xjcArg>
</xjcArgs>
<keep>true</keep>
<genJWS>false</genJWS>
<!-- Needed when JDK_Version >= 8 -->
<vmArgs>
<vmArg>-Djavax.xml.accessExternalSchema=all</vmArg>
</vmArgs>
</configuration>
</plugin>
Can you please provide a sample project?
I have the same problem as @kanchev : Even though the maven plugin jaxws-maven-plugin is defined in pom.xml; after VSCode starts up, the java language server does not generate files into target/generated-sources/ nor target/classes/.
I have to run $ mvn package manually to make the maven plugin jaxws-maven-plugin generate files into target/generated-sources/.
After running $ mvn package, the language server also does not recognize imports from target/generated-sources/ because it keep regenerating target/classes/ folder and deleting all the class files created by $ mvn package from target/generated-sources/ .
@khe817 I have the same problem. It does not recognize imports from target/generated-sources/. This is the only thing keeping me from using vs-code instead of IntelliJ for my Spring Boot projects.
guys please attach a fully functioning sample project reproducing the issue, it'll help us investigate the problem.
guys please attach a fully functioning sample project reproducing the issue, it'll help us investigate the problem.
@fbricon Feel free to git clone this sample maven project:
https://[email protected]/GabrielBB03/jaxws-import-bug.git
When i open a Java class under target/generated-sources, like this one from the project above:

It says the class is not in the classpath:

It must be the reason why the import is not being recognized:

Ok so, m2e, the underlying Maven integration project, doesn't know if the jaxws maven plugin is safe to run during the workspace build. The problem is visible when running in Eclipse, where you might be able to install an m2e-jaxws plugin, but is somewhat hidden in jdt.ls/vscode-java.
Anyways, one way to workaround this issue is to let m2e run the plugin during its project configuration phase.
One way to do that is to add a processing instruction in the pom.xml like <?m2e execute onConfiguration?> in :
<plugin>
<groupId>org.jvnet.jax-ws-commons</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>2.3</version>
<executions>
<execution>
<?m2e execute onConfiguration?>
<goals>
<goal>wsimport</goal>
</goals>
You then need to let vscode update the project configuration:

Or you can execute the "Update project configuration" command manually:

@fbricon WORKS LIKE A CHARM! Back to VS Code /o/ I should have reported this months ago. By the way if this has to be done for any plugin that generate sources, maybe this should be in the troubleshooting wiki
Be aware, this solution, forcing the execution of jaxws-maven-plugin, is not risk free. There's no guarantee it'll work in 100% of the situations or might lead to some memory leaks.
@fbricon I see. For me it works 100% of the time i open VSCode, for a co-worker it never works using same project
We have been running into this issue too. It is a pretty big blocker since all of our projects use OpenApi and generate all the API models and Service interfaces. Is there any ideas why it isn't resolving generated files? (My work around for now is to have my generated files in a separate module and have it build separately. I then pull it in as a dependency from .m2 in the service module).
It would be awesome to fix this bug tho...
Most helpful comment
Ok so, m2e, the underlying Maven integration project, doesn't know if the jaxws maven plugin is safe to run during the workspace build. The problem is visible when running in Eclipse, where you might be able to install an m2e-jaxws plugin, but is somewhat hidden in jdt.ls/vscode-java.
Anyways, one way to workaround this issue is to let m2e run the plugin during its project configuration phase.
One way to do that is to add a processing instruction in the pom.xml like
<?m2e execute onConfiguration?>in :You then need to let vscode update the project configuration:

Or you can execute the "Update project configuration" command manually:
