How to make maven unsuccessful on raw types?

I want to make maven compile fail if somewhere in the code raw types (missing generics) are used. I tried the following:

  • Javac does not recognize these errors (eclipse compiler); Starting with version 7, the -Xlint:rawtypes on javac can be used to issue warnings if raw types are used. Unfortunately, I have to use java 6, which does not support this flag.
  • CheckStyle has no rules for such things.
  • PMD also does not have the ability to check for raw types.

Are there any other maven modules or tricks that generate an error if the original types are used?

+4
source share
1 answer

I don't know if this will help, but you can use the eclipse compiler in maven

 <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.3.2</version> <configuration> <compilerId>eclipse</compilerId> <source>1.6</source> <target>1.6</target> </configuration> <dependencies> <dependency> <groupId>org.codehaus.plexus</groupId> <artifactId>plexus-compiler-eclipse</artifactId> <version>1.8.2</version> </dependency> </dependencies> </plugin> 
0
source

Source: https://habr.com/ru/post/1479730/


All Articles