[英]scala-maven-plugin unable to find source directory when mentioned in <configuration>
當我編譯Scala源時,這個pom.xml
工作:
<build>
<sourceDirectory>${project.basedir}/src/main/scala</sourceDirectory>
<plugins>
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<version>4.4.0</version>
<executions>
<execution>
<id>scala-compile-first</id>
<phase>process-resources</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
[...]
但不是這個選擇:
<build>
<plugins>
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<version>4.4.0</version>
<executions>
<execution>
<id>scala-compile-first</id>
<phase>process-resources</phase>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<sourceDir>${project.basedir}/src/main/scala</sourceDir>
<testSourceDir>${project.basedir}/src/test/scala</testSourceDir>
</configuration>
</execution>
[...]
即使在此用法的 插件文檔中提到了sourceDir
和testSourceDir
。
我需要第二種選擇,因為我在此執行之后調用了依賴於其他源文件目錄的Java編譯器。
我也嘗試調用add-source
目標。 沒有成功。
你試圖用錯誤的東西覆蓋 de 配置,我猜${project.basedir}
沒有被預期值替換。
您想要的是默認行為,因此您可以簡單地刪除覆蓋
<build>
<plugins>
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<version>4.4.0</version>
<executions>
<execution>
<id>scala-compile-first</id>
<phase>process-resources</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
更新:檢查日志(輸出)以查看插件掃描哪個文件夾進行編譯。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.