nadzieję, że ktoś może pomóc.Jak poprawnie zintegrować Mavena, Jenkinsa, Sonara i Cobertury?
- Nasz projekt jest projektem Eclipse plug-in
- mamy serwerze Jenkins
- nasz projekt wykorzystuje Maven i Tycho (dla projektów typu plug-in) do zarządzania build
- mamy zainstalowany serwer Sonar
- zintegrowaliśmy Sonar do Jenkins Jenkins za pomocą Web-config
teraz, jeśli nie używamy sonar, wszystko jest w porządku. Ale jeśli go włączysz, wtyczka Maven Cobertura dla Sonara będzie generować błędy. Cała reszta (o ile idzie produkcja) jest w porządku.
Teraz, z tego co rozumiem, dodaje się dzieje:
- Jenkins buduje projekt
- Sonar używa statycznej analizy kodu wtyczek i metryki (Findbugs, PMD, RFC, etc.)
- Sonar uruchamia wtyczkę Cobertury
- Cobertura próbuje zbudować projekt PONOWNIE
- Cobertura nie udało się go zbudować, ponieważ buduje go w innej kolejności
- Cobertura nie
kilka fragmentów wyjściowe z Jenkins:
[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"
Później ... Kolejność budowy jest to, że rdzeń jest zbudowany przed ewolucji, lecz ewolucja wydaje się być pierwszą rzeczą Cobertura chce budować ...
[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
Po tym czasie buduje zawsze wynosić mniej więcej tak:
[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
Obserwowani przez ostrzeżeń:
[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
... a ostateczny cios w brzuch:
[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
Domyślam się, że kolejność jest nieprawidłowa budowa w Sonar. Ale jak by się pogubić (skoro Jenkins buduje projekt we właściwej kolejności)?
A dlaczego, na Boga, Cobertura ponownie buduje projekt? Jenkins już to zbudował, a Cobertura mógł korzystać ze skompilowanych klas od tego miejsca ... czy coś nie rozumiem?
Nie mogę odpowiedzieć na główne pytanie, ale myślę, że Cobertura musi przebudować projekt, by splatować kod przechwytujący informacje o zasięgu (używane później przez Sonara). To frustrujące, że kod jest budowany dwa razy. W naszym przypadku przenieśliśmy całą analizę kodu/pokrycie do osobnej pracy Jenkinsa i uruchomiliśmy ją co noc, ponieważ trwa to zbyt długo. – maximdim
@danowar Czy masz może SonarQube + Jenkins + Maven i Cobertura? –