繁体   English   中英

scala-maven-plugin 中提到时无法找到源目录<configuration>

[英]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>
           [...]                

即使在此用法的 插件文档中提到了sourceDirtestSourceDir

我需要第二种选择,因为我在此执行之后调用了依赖于其他源文件目录的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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM