java - Visual Studio Code maven 项目 - 如何添加源文件夹
问题描述
我正在尝试将我们的 Maven Java 项目从 Eclipse 迁移到 Visual Studio。
我们的 Maven 项目在 src/main/generated 文件夹中有一个生成的源文件夹(用于我们的肥皂服务模式类)(在 POM 中有适当的 build-helper-maven-plugin 配置)
在eclipse中,我可以手动右键单击模块并“添加源文件夹”来告诉eclipse该文件夹。
我似乎无法在 VSCode 的 maven 插件中找到这样的选项,这会导致数百个“无法解析导入 xxx”错误
我该如何解决这个问题?我们正被迫离开 Eclipse 并进入 Visual Studio,但目前我不能这样做,直到我能解决这个问题。
如果有帮助,这里是相关的 POM 配置:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>src/main/generated</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
...
<pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<versionRange>[2.4.0,)</versionRange>
<goals>
<goal>wsdl2java</goal>
</goals>
</pluginExecutionFilter>
<action>
<execute>
<runOnIncremental>false</runOnIncremental>
</execute>
</action>
</pluginExecution>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<versionRange>[1.7,)</versionRange>
<goals>
<goal>add-source</goal>
</goals>
</pluginExecutionFilter>
<action>
<execute></execute>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
解决方案
推荐阅读
- string - 与 CompareStringOrdinal 对应的构造一个 unicode 小写字符串
- c# - ASP.NET 最小 API - 访问 IConfiguration
- php - 如何在php中将多个数组或json合并为一个?
- r - 通过 Xpaths 从 R 中的文件中删除或过滤 XML 节点
- javascript - 如何在反应js中的标题和折叠之前打开面板?
- python - 用我的标签绘制 tan(x)。我想使用我现有的代码
- javascript - 仅当图片已更改时自动重新加载 html 页面
- swiftui - coredata int32 在文本中没有显示?
- jquery - 在结帐页面 Woocommerce 上强制更新购物车价格
- r - 将一个字符作为项目分隔符插入到R中的字符串中