guidelines on the apache site'a göre maven pompasında özel bir kontrol düzeni yapılandırması yapmayı denemek çok basit bir durumda çalışmıyor.Maven Checkstyle configLocation yok sayıldı mı?
ben Maven tarafından (yani src/main/java/src/main/kaynaklar) tavsiye edilen dizin düzenini kullanarak bir proje, MyProject, tek bir dosya MyClass.java yarattı:
package com.myproject;
public class MyClass {
public static void main(String[] args) {
System.out.println("This line is longer than 80 characters which returns an error in sun_checks.xml, however my_checks.xml allows for much longer lines and will not return a long line error.");
}
}
boş kılavuzda özelliklerine göre
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.2//EN"
"http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
<module name="Checker">
<property name="severity" value="warning"/>
<module name="TreeWalker">
</module>
</module>
ve pom dosyası:: checkstyle dosya, my_checks.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.myproject</groupId>
<artifactId>A_Project</artifactId>
<name>A Project</name>
<version>1.0.0</version>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.8</version>
<configuration>
<configLocation>my_checks.xml</configLocation>
</configuration>
</plugin>
</plugins>
</reporting>
</project>
'mvn -X checkstyle: checkstyle', my_checks.xml dosyasındaki yapılandırmayı kullanmak yerine sun_checks.xml (varsayılan) 'ı kullanır; bu da hem sonuçta oluşan checkstyle hataları hem de hata ayıklama çıktısı tarafından görülebilir (örn. '[DEBUG] request.getConfigLocation() config/sun_checks.xml').
Checkstyle.config.location, Carboni tarafından numaralı belgede belirtilen stratejiyi kullanan özelliklerde değiştirilebildiğinden, my_checks.xml dosyasının geçerli olduğunu biliyorum, ancak bu durum çok modüllü projelere taşınırken sorunlara neden olur ve 'Resmi' apache maven checkstyle talimatları. Bu benim için çalışıyor
Yapı xml'iniz tam olarak nerede bulunur? – Corubba