简体   繁体   中英

Groovy check for unused imports

I want to fail my build if there are unused imports, I tried using the Checkstyle Plugin but it doesn't work. Is there any other way/plugin that can help me check for unused imports in Groovy files.

My pom file looks like

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-checkstyle-plugin</artifactId>
        <dependencies>
          <dependency>
            <groupId>org.apache.pulsar</groupId>
            <artifactId>buildtools</artifactId>
            <version>${project.version}</version>
          </dependency>
        </dependencies>
      </plugin>

试试CodeNarc,它有一个UnusedImport规则: http ://codenarc.sourceforge.net/codenarc-rules-imports.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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