![](/img/trans.png)
[英]In maven how to add a local maven project as a dependency with source code
[英]Visual Studio Code maven project - how to add a source folder
我正在嘗試將我們的 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>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.