jslint-maven-plugin 不读取 jsSourceFolder,但仍读取默认值



我正在尝试使用jslint-maven插件。我把它包含在我的pom文件中

<plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>jslint-maven-plugin</artifactId>
            <version>1.0.1</version>
            <executions>
                <execution>
                    <id>execute-jslint</id>
                    <goals>
                        <goal>jslint</goal>
                        <goal>test-jslint</goal>
                    </goals>
                    <configuration>
                        <sourceJsFolder>
                            <file>${basedir}/src/main/webapp/static/js/</file>  
                        </sourceJsFolder>
                    </configuration>
                </execution>
            </executions>
        </plugin>

但是当我运行这个命令maven jslint:jslint时,我得到了这个错误


[ERROR] Failed to execute goal org.codehaus.mojo:jslint-maven-plugin:1.0.1:jslint (default-cli) on project webshop-core: Execution default-cli of goal org.codehaus.mojo:jslint-maven-plugin:1.0.1:jslint failed: basedir /home/mymac/project1/src/main/js does not exist -> [Help 1]

根据此链接,它仍然从默认值中读取http://mojo.codehaus.org/jslint-maven-plugin/jslint-mojo.html#sourceJsFolder参数。

这里有两个问题。首先,您不需要file标记,因为maven知道您传递给sourceJsFolder的字符串是一条路径。其次,当您调用mvn jslint:jslint时,您正在使用的执行是default-cli,但您尚未为此执行指定sourceJsFolder变量。您有两种选择;您可以将sourceJsFolder配置选项移到执行之外,如下所示:

<plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>jslint-maven-plugin</artifactId>
        <version>1.0.1</version>
        <configuration>
            <sourceJsFolder>${basedir}/src/main/webapp/static/js</sourceJsFolder>
        </configuration>
        <executions>
            <execution>
        ...

或者您也可以指定default-cli执行的配置:

<plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>jslint-maven-plugin</artifactId>
        <version>1.0.1</version>
        <executions>
            <execution>
                <id>default-cli</id>
                <configuration>
                    <sourceJsFolder>${basedir}/src/main/webapp/static/js</sourceJsFolder>
                </configuration>
                ...

最新更新