2011-10-25 3 views
13

누군가가 도울 수 있기를 바랍니다.Maven, Jenkins, Sonar 및 Cobertura를 올바르게 통합하려면 어떻게합니까?

  • 우리의 프로젝트는 우리가 젠킨스 서버를 가지고 이클립스 플러그인 프로젝트
  • 입니다
  • 우리의 프로젝트는 메이븐 및 빌드 관리 (플러그인 프로젝트에 대한) 티코는
  • 우리가 소나 서버를 설치 사용
  • 우리는 우리가 수중 음파 탐지기를 사용하지 않는 경우, 모든 것이 괜찮습니다 지금 젠킨스 웹 구성

를 사용하여 젠킨스에 수중 음파 탐지기를 통합. 그러나 우리가 그것을 켜면, Sonar를위한 Maven Cobertura 플러그인은 에러를 던집니다. 그 밖의 모든 것은 (출력이가는 한) 괜찮습니다.

이제 내가 이해에서, 다음과 같은 상황이 발생합니다

  • 젠킨스는
  • 수중 음파 탐지기는 정적 코드 분석 플러그인과 통계 (Findbugs, PMD, RFC 등)
  • 을 사용하는 프로젝트를 빌드 Sonar가 Cobertura 플러그인을 시작합니다.
  • Cobertura가 프로젝트를 빌드하려고합니다.
  • Cobertura가 다른 순서로 빌드하기 때문에 빌드에 성공하지 못합니다.
  • Cobertura는 젠킨스에서

일부 출력 발췌 실패

[INFO] ------------------------------------------------------------------------ 
[INFO] Building Project 
[INFO] ------------------------------------------------------------------------ 

[WARNING] The following dependencies could not be resolved at this point of the build but seem to be part of the reactor: 

[WARNING] o de.tool.core:de.tool.core:eclipse-plugin:1.2.0-SNAPSHOT (provided) 

[WARNING] Try running the build up to the lifecycle phase "package" 

을 나중에 ... 빌드 순서는 코어가 진화하기 전에 내장되어 있다는 것입니다,하지만 진화는 Cobertura 구축하고자하는 첫 번째 일이 될 것 같다 ...

[INFO] Execute maven plugin cobertura-maven-plugin... 
[INFO] Execute org.codehaus.mojo:cobertura-maven-plugin:2.5:cobertura... 
[INFO]                   
[INFO] ------------------------------------------------------------------------ 
[INFO] Building de.tool.evolution 1.0.0-SNAPSHOT 
[INFO] ------------------------------------------------------------------------ 
[INFO] 
[INFO] >>> cobertura-maven-plugin:2.5:cobertura (default-cli) @ de.tool.evolution >>> 
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD FAILURE 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 35.240s 
[INFO] Finished at: Tue Oct 25 11:28:29 CEST 2011 
[INFO] Final Memory: 57M/231M 

것을 항상이 같은 금액 빌드 후 :

[INFO] ------------------------------------------------------------------------ 
[INFO] Building de.tool.core 1.2.0-SNAPSHOT 
[INFO] ------------------------------------------------------------------------ 
[INFO] 
[INFO] >>> cobertura-maven-plugin:2.5:cobertura (default-cli) @ de.tool.core >>> 
[INFO] 
[INFO] --- tycho-packaging-plugin:0.13.0:build-qualifier (default-build-qualifier) @ de.tool.core --- 
[INFO] 
[INFO] --- tycho-packaging-plugin:0.13.0:validate-id (default-validate-id) @ de.tool.core --- 
[INFO] 
[INFO] --- tycho-packaging-plugin:0.13.0:validate-version (default-validate-version) @ de.tool.core --- 
[INFO] 
[INFO] --- maven-resources-plugin:2.4.3:resources (default-resources) @ de.tool.core --- 
[INFO] Using 'Cp1252' encoding to copy filtered resources. 
[INFO] skip non existing resourceDirectory /var/lib/jenkins/jobs/testBuild/workspace/de.tool.core/src/main/resources 
[INFO] 
[INFO] --- tycho-compiler-plugin:0.13.0:compile (default-compile) @ de.tool.core --- 
[INFO] Using compile source roots from build.properties 
[INFO] Nothing to compile - all classes are up to date 
[INFO] 
[INFO] --- cobertura-maven-plugin:2.5:instrument (default-cli) @ de.tool.core --- 
[INFO] Cobertura 1.9.4.1 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file 
Instrumenting 88 files to /var/lib/jenkins/jobs/testBuild/workspace/de.tool.core/target/generated-classes/cobertura 
Cobertura: Saved information on 88 classes. 
Instrument time: 256ms 

[INFO] Instrumentation was successful. 
[INFO] NOT adding cobertura ser file to attached artifacts list. 
[INFO] 
[INFO] --- maven-resources-plugin:2.4.3:testResources (default-testResources) @ de.tool.core --- 
[INFO] Using 'Cp1252' encoding to copy filtered resources. 
[INFO] skip non existing resourceDirectory /var/lib/jenkins/jobs/testBuild/workspace/de.tool.core/src/test/resources 
[INFO] 
[INFO] <<< cobertura-maven-plugin:2.5:cobertura (default-cli) @ de.tool.core <<< 
[INFO] 
[INFO] --- cobertura-maven-plugin:2.5:cobertura (default-cli) @ de.tool.core --- 
[INFO] Cobertura 1.9.4.1 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file 
Cobertura: Loaded information on 88 classes. 
Report time: 800ms 

[INFO] Cobertura Report generation was successful. 
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD FAILURE 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 50.133s 
[INFO] Finished at: Tue Oct 25 11:28:44 CEST 2011 
[INFO] Final Memory: 33M/263M 
경고가 이어

:

[INFO] Java bytecode scan... 
[WARN] Class 'de/tool/core/util/EObjectUtil' is not accessible through the ClassLoader. 
[INFO] Java bytecode scan done: 105 ms 
... 
The following classes needed for analysis were missing: 
    de.tool.core.util.EObjectUtil 

... 그리고 장내 최종 펀치 :

[INFO] ------------------------------------------------------------------------ 
[INFO] Reactor Summary: 
[INFO] 
[INFO] de.tool.core ............................... SUCCESS [2.364s] 
[INFO] de.tool.evolution .......................... FAILURE [0.023s] 
... 
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD FAILURE 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 1:52.418s 
[INFO] Finished at: Tue Oct 25 11:29:46 CEST 2011 
[INFO] Final Memory: 51M/411M 
[INFO] ------------------------------------------------------------------------ 
[ERROR] Failed to execute goal on project de.tool.evolution: Could not resolve dependencies for project de.tool.evolution:de.tool.evolution:eclipse-plugin:1.0.0-SNAPSHOT: Could not find artifact de.tool.core:de.tool.core:eclipse-plugin:1.2.0-SNAPSHOT -> [Help 1] 
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal on project de.tool.evolution: Could not resolve dependencies for project de.tool.evolution:de.tool.evolution:eclipse-plugin:1.0.0-SNAPSHOT: Could not find artifact de.tool.core:de.tool.core:eclipse-plugin:1.2.0-SNAPSHOT 

내 생각 엔 빌드 순서는 수중 음파 탐지기에서 잘못된 것입니다. 그러나 Jenkins가 올바른 순서로 프로젝트를 작성한 이후로 어떻게 뒤죽박죽이 될 것입니까?

왜 지구상에서 Cobertura가 프로젝트를 다시 빌드합니까? Jenkins는 이미 그것을 만들었고 Cobertura는 거기에서 컴파일 된 클래스를 사용할 수있었습니다 ... 아니면 내가 오해하고 있습니까?

+3

나는 주된 질문에 대답 할 수 없다. 그러나 Cobertura가 커버리지 정보를 캡처하는 코드를 짜기 위해 프로젝트를 재구성해야한다고 생각한다. (나중에 Sonar가 사용했다.) 코드가 두 번 빌드되는 것을 좌절하게 만듭니다. 우리의 경우 모든 코드 분석/적용 범위를 별도의 젠킨스 작업으로 옮겼으며 너무 오래 걸리기 때문에 야간에 실행했습니다. – maximdim

+0

@danowar SonarQube + Jenkins + Maven 및 Cobertura가 되셨습니까? –

답변

12

Maven 빌드 프로젝트에서 사용할 수 있도록 Sonar로 회사의 Jenkins 서버를 구성했습니다. 여기까지 가야 할 단계가 있습니다.

내 가슴에.우리는 이미 MySQL을 설치했다, 그래서 우리는 수중 음파 탐지기는 MySQL을 얘기하는 방법에 Wakaleo Consulting의 지시를 따라, 우리의 리눅스 서버를 구축에

 <plugin> 
      <groupId>org.codehaus.mojo</groupId> 
      <artifactId>sonar-maven-plugin</artifactId> 
      <version>1.0-beta-2</version> 
     </plugin> 

: XML은 (Maven2 버전), 나는 다음과 같은 코드를 추가했다. Jenkins 구성 섹션의 MySQL URL에서 이스케이프 된 앰퍼샌드를 참고하십시오. 그것은 우리에게 몇 가지 빌드를위한 루프를 던져주었습니다.

또한, 프로젝트 레벨에서 수중 음파 탐지기를 사용 ... 당신이 당신의 메이븐 목표 라인에 sonar:sonar 대상을 포함하지 필요성을 있다는 사실을 양지는 모든 통계를 수집하기 위해 우리 젠킨스 작업에 충분했다.

나는 그것을 다루고 있다고 생각합니다.

+0

Wakaleo에 대한 링크. –

+0

Wakaleo 링크 un-zombified. – Mike

관련 문제