2011-06-15 11 views
5

Hudson/Jenkins'de düzgün bir şekilde çalışması için bir kontrol modeli oluşturmaya çalışırken sorun yaşıyorum. Şöyle bir ebeveyn pom varCheckstyle özel kuralı Hudson/Jenkins'de çalışmaya başlama

<?xml version="1.0"?> 
<!DOCTYPE module PUBLIC 
      "-//Puppy Crawl//DTD Check Configuration 1.3//EN" 
      "http://www.puppycrawl.com/dtds/configuration_1_3.dtd"> 

<module name="Checker"> 
    <module name="RegexpSingleline"> 
     <property name="format" value="\s+$" /> 
     <property name="minimum" value="0" /> 
     <property name="maximum" value="0" /> 
     <property name="message" value="Line has trailing spaces." /> 
    </module> 
</module> 

-:

Ben (tıpkı o çalışıp çalışmadığını görmek için) ve bazı sunucuya yerleştirin içinde çok az kuralları ile özel bir checkstyle üstünlüğünü getiren -

<?xml version="1.0" encoding="UTF-8"?> 
<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>a.b</groupId> 
    <artifactId>c</artifactId> 
    <packaging>pom</packaging> 
    <version>1.0</version> 

    <build> 
     <plugins> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-compiler-plugin</artifactId> 
       <version>2.3.2</version> 
       <configuration> 
        <source>1.5</source> 
        <target>1.5</target> 
       </configuration> 
      </plugin> 
     </plugins> 
    </build> 

    <reporting> 
     <plugins> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-checkstyle-plugin</artifactId> 
       <version>2.4</version> 
       <configuration> 
        <configLocation>http://server/checkstyle.xml</configLocation> 
       </configuration> 
      </plugin> 
     </plugins> 
    </reporting> 
</project> 

fiili proje böyle ebeveyn pom içerecektir: -

<?xml version="1.0" encoding="UTF-8"?> 
<project> 
    <parent> 
     <groupId>a.b</groupId> 
     <artifactId>c</artifactId> 
     <version>1.0</version> 
    </parent> 

    <modelVersion>4.0.0</modelVersion> 
    <groupId>some</groupId> 
    <artifactId>project</artifactId> 
    <packaging>jar</packaging> 
    <version>1.0</version> 

    ... 
</project> 

Ben execu Eclipse te mvn clean site, sadece iyi çalışıyor. Varsayılan config/sun_checks.xml kullanarak 1000+ checkstyle hataları görmek yerine, sadece 27 tane checkstyle hatası alıyorum.

Bunu Jenkins'de çalıştırdığımda, herhangi bir nedenden ötürü, özel bir denetim kuralı kuralımı almıyor. Jenkins'den 1000+ kontrol modeli hatası alıyorum. "Konsol Çıktısı" kaydını kontrol ettim ve kontrol stilinde herhangi bir hata/uyarı göremiyorum. Jenkins dan yürütülen maven komut şu şekilde görünür: -

<===[HUDSON REMOTING CAPACITY]===>channel started 
Executing Maven: -B -f D:\hudson\jobs\test\workspace\pom.xml clean site 
[INFO] Scanning for projects... 
... 

ben daha sağlam bir günlüğünü görmek için -e veya -X seçeneği eklemek için muktedir umuyorum, ama bunları eklemek için bir yer bulamıyor Jenkins.

Özel checkstyle kuralımı Hudson/Jenkins ile çalışacak şekilde nasıl alabilirim?

Çok teşekkürler.

cevap

0

-e ve -X anahtarını "Hedefler ve Optionen" alanına ekleyebilirsiniz.

Checkstyle'ü harici bir konumdan mı gönderiyorsunuz? Eğer öyleyse, VCS'nizde projenize kontrol modeli eklemeyi deneyebilirsiniz (bu, bir ağ sorunu olduğunda işe yararsa). VCS'nize checkstyle.xml eklenmesi de, sizin (ve VCS'nin sunması gereken diğer faydalar) yapılarınızın tekrarlanabilirliğine sahip olmanızın avantajına sahiptir. Maven farklı

belki o da Jenkins çalışma alırsınız benim checkstyle.xml configLocation nasıl bulduğu

0

ben kurulumu.

Ayrıca hala bir maven hedefi yürütebileceği Jenkins yerine bir maven işinin standart bir iş oluşturursanız ve sadece burada Yazılı parametreleri

<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/xsd/maven-4.0.0.xsd"> 

    ... 

    <properties> 
    <checkstyle.config.location>http://server/checkstyle.xml</checkstyle.config.location> 
    </properties> 

    <build> 
    ... 

     <plugin> 
     <groupId>org.apache.maven.plugins</groupId> 
     <artifactId>maven-checkstyle-plugin</artifactId> 
     <version>2.9.1</version> 
     </plugin> 
    </plugins> 
    </build> 

</project> 

ekleyebilirsiniz:

http://blog.blundell-apps.com/create-your-own-checkstyle-check/

kaynak kodu buraya: