在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):Ozsie/detekt-maven-plugin开源软件地址(OpenSource Url):https://github.com/Ozsie/detekt-maven-plugin开源编程语言(OpenSource Language):Kotlin 100.0%开源软件介绍(OpenSource Introduction):Detekt Maven PluginA maven plugin that wraps the Detekt CLI. It supports the same parameters as the Detekt CLI. How to useBasic configuration<build>
<plugins>
<plugin>
<groupId>com.github.ozsie</groupId>
<artifactId>detekt-maven-plugin</artifactId>
<version>1.21.0.1</version>
<executions>
<execution>
<phase>verify</phase>
<goals><goal>check</goal></goals>
</execution>
</executions>
</plugin>
</plugins>
</build> Using the above configuration, Detekt will scan source files in ${basedir}/src and output the results in ${basedir}/detekt. All parameters available to Detekt version 1.21.0.1 can be configured in the plugin. Remote configurationThe plugin supports remote config over http and https. <build>
<plugins>
<plugin>
<groupId>com.github.ozsie</groupId>
<artifactId>detekt-maven-plugin</artifactId>
<version>1.21.0.1</version>
<executions>
<execution>
<phase>verify</phase>
<goals><goal>check</goal></goals>
<configuration>
<plugins>
<config>https://raw.githubusercontent.com/Ozsie/detekt-maven-plugin/fd0de6d59e6ae1e062a9d2b030a171da1d3225ab/src/test/resources/resolve-config/remote/remote-config.yml</config>
</plugins>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build> Using plugin<build>
<plugins>
<plugin>
<groupId>com.github.ozsie</groupId>
<artifactId>detekt-maven-plugin</artifactId>
<version>1.21.0.1</version>
<executions>
<execution>
<phase>verify</phase>
<goals><goal>check</goal></goals>
<configuration>
<plugins>
<plugin>path/to/plugin.jar</plugin>
</plugins>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build> Or <build>
<plugins>
<plugin>
<groupId>com.github.ozsie</groupId>
<artifactId>detekt-maven-plugin</artifactId>
<version>1.21.0.1</version>
<executions>
<execution>
<phase>verify</phase>
<goals><goal>check</goal></goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>group</groupId>
<artifactId>artifact</artifactId>
<version>version</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build> Specify report files<build>
<plugins>
<plugin>
<groupId>com.github.ozsie</groupId>
<artifactId>detekt-maven-plugin</artifactId>
<version>1.21.0.1</version>
<executions>
<execution>
<phase>verify</phase>
<goals><goal>check</goal></goals>
<configuration>
<report>
<report>txt:reports/detekt.txt</report>
<report>xml:reports/detekt.xml</report>
</report>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build> Alternatively, the configuration can be placed outside of the
<build>
<plugins>
<plugin>
<groupId>com.github.ozsie</groupId>
<artifactId>detekt-maven-plugin</artifactId>
<version>1.21.0.1</version>
<configuration>
<report>
<report>txt:reports/detekt.txt</report>
<report>xml:reports/detekt.xml</report>
</report>
</configuration>
<executions>
<execution>
<phase>verify</phase>
<goals><goal>check</goal></goals>
</execution>
</executions>
</plugin>
</plugins>
</build> Set baselineFirst a baseline file needs to be generated mvn detekt:cb This will generate a baseline file for each module named as <build>
<plugins>
<plugin>
<groupId>com.github.ozsie</groupId>
<artifactId>detekt-maven-plugin</artifactId>
<version>1.21.0.1</version>
<configuration>
<baseline>baseline.xml</baseline>
</configuration>
<executions>
<execution>
<phase>verify</phase>
<goals><goal>check</goal></goals>
</execution>
</executions>
</plugin>
</plugins>
</build> Using Type ResolutionSee Issue #144 for an explanation. <build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<id>generate-classpath-var</id>
<phase>package</phase>
<goals><goal>build-classpath</goal></goals>
<configuration>
<outputProperty>generated.classpath</outputProperty>
<silent>true</silent>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.github.ozsie</groupId>
<artifactId>detekt-maven-plugin</artifactId>
<version>1.21.0.1</version>
<configuration>
<baseline>baseline.xml</baseline>
<classPath>${generated.classpath}</classPath>
<jvmTarget>17</jvmTarget>
</configuration>
<executions>
<execution>
<phase>verify</phase>
<goals><goal>check</goal></goals>
</execution>
</executions>
</plugin>
</plugins>
</build> GoalscheckUsed to run detekt. All cli parameters, excluding -gc and -cb, are available using -Ddetekt.{parameter} Examples
create-baselineUsed to create a baseline. All cli parameters, excluding -gc and -cb, are available using -Ddetekt.{parameter}. By default, a file called baseline-.xml will be generated. If you include -Ddetekt.baseline in the call you can specify some other name for the baseline file. Examples
generate-configUsed to generate a default configuration file Example
For more information on Detekt, have a look at https://github.com/detekt/detekt ContributorsLicense |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论