【问题标题】:detekt doesn't generate reportdetekt 不生成报告
【发布时间】:2018-09-11 16:45:40
【问题描述】:

我正在通过 maven 构建我的项目。在official documentation的基础上添加了detekt配置:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-antrun-plugin</artifactId>
    <version>1.8</version>
    <inherited>false</inherited>
    <executions>
        <execution>
            <!-- This can be run separately with mvn antrun:run@detekt -->
            <id>detekt</id>
            <phase>validate</phase>
            <configuration>
                <target name="detekt">
                    <java taskname="detekt" dir="${project.basedir}"
                          fork="true"
                          failonerror="false"
                          classname="io.gitlab.arturbosch.detekt.cli.Main"
                          classpathref="maven.plugin.classpath">
                        <arg value="--input"/>
                        <arg value="${project.basedir}/src/main/kotlin"/>
                        <arg value="--config"/>
                        <arg value="${project.basedir}/src/main/resources/sv_detekt.yml"/>
                        <arg value="--filters"/>
                        <arg value=".*/test/.*,.*/target/.*,.*/resources/.*"/>
                        <arg value="--output"/>
                        <arg value="${project.build.directory}/detekt-reports"/>
                        <arg value="--output-name"/>
                        <arg value="checkstyle-result"/>
                        />
                    </java>
                </target>
            </configuration>
            <goals>
                <goal>run</goal>
            </goals>
        </execution>
    </executions>
    <dependencies>
        <dependency>
            <groupId>io.gitlab.arturbosch.detekt</groupId>
            <artifactId>detekt-cli</artifactId>
            <version>1.0.0.RC8</version>
        </dependency>
    </dependencies>
</plugin>

然后,我尝试通过以下命令执行它:mvn antrun:run@detekt

结果如下:

$ mvn antrun:run@detekt
[INFO] Scanning for projects...
[INFO]
[INFO] -------------------------< com.my:opd >--------------------------
[INFO] Building opd 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-antrun-plugin:1.3:run (detekt) @ opd ---
[INFO] Executing tasks
[INFO] Executed tasks
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.295 s
[INFO] Finished at: 2018-08-10T11:46:02+03:00
[INFO] ------------------------------------------------------------------------

看起来不错,但文件夹${project.build.directory}/detekt-reports 没有创建,也没有任何报告。我做错了什么?

【问题讨论】:

  • 您可以运行mvn-X 以获取有关正在发生的事情的更多信息吗?

标签: kotlin maven-plugin detekt


【解决方案1】:

我不确定问题出在哪里,但是当通过 intellij 中的 maven 工具执行 detekt 时,它工作正常。可能是windows终端的问题...

【讨论】:

    猜你喜欢
    • 2023-03-21
    • 2011-03-02
    • 2011-04-21
    • 1970-01-01
    • 2017-06-11
    • 2015-10-13
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多