Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use default maven properties for jacoco report files #14385

Merged
merged 2 commits into from
Mar 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions generators/ci-cd/templates/.gitlab-ci.yml.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -235,10 +235,13 @@ maven-test:
- ./mvnw -ntp verify -P-webapp -Dmaven.repo.local=$MAVEN_USER_HOME <% if (insideDocker && databaseTypeSql) { %>-Dspring.profiles.active=testcontainers<% } %>
artifacts:
reports:
junit: target/test-results/**/TEST-*.xml
junit:
- target/surefire-reports/TEST-*.xml
- target/failsafe-reports/TEST-*.xml
paths:
- target/test-results
- target/jacoco
- target/surefire-reports
- target/failsafe-reports
- target/site
expire_in: 1 day

<%_ if (!skipClient) { _%>
Expand Down
4 changes: 2 additions & 2 deletions generators/ci-cd/templates/jenkins/Jenkinsfile.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ node {
<%= indent %> } catch(err) {
<%= indent %> throw err
<%= indent %> } finally {
<%= indent %> junit '**/target/test-results/**/TEST-*.xml'
<%= indent %> junit '**/target/surefire-reports/TEST-*.xml,**/target/failsafe-reports/TEST-*.xml'
<%= indent %> }
<%= indent %> }

Expand All @@ -87,7 +87,7 @@ node {
<%= indent %> } catch(err) {
<%= indent %> throw err
<%= indent %> } finally {
<%= indent %> junit '**/target/test-results/**/TEST-*.xml'
<%= indent %> junit '**/target/test-results/TESTS-results-jest.xml'
<%= indent %> }
<%= indent %> }

Expand Down
8 changes: 6 additions & 2 deletions generators/common/templates/sonar-project.properties.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,16 @@ sonar.tests=<%= TEST_DIR %>
<%_ } _%>
<%_ if (!skipServer) { _%>
<%_ if (buildTool === 'maven') { _%>
sonar.coverage.jacoco.xmlReportPaths=target/jacoco/test/jacoco.xml,target/jacoco/integrationTest/jacoco.xml
sonar.coverage.jacoco.xmlReportPaths=target/site/**/jacoco*.xml
<%_ } else { _%>
sonar.coverage.jacoco.xmlReportPaths=build/reports/jacoco/test/jacocoTestReport.xml
<%_ } _%>
sonar.java.codeCoveragePlugin=jacoco
sonar.junit.reportPaths=<%_ if (buildTool === 'maven') { _%>target<%_ } else { _%> build<%_ } _%>/test-results/test,<%_ if (buildTool === 'maven') { _%>target<%_ } else { _%> build<%_ } _%>/test-results/integrationTest
<%_ if (buildTool === 'maven') { _%>
sonar.junit.reportPaths=target/surefire-reports,target/failsafe-reports
<%_ } else { _%>
sonar.junit.reportPaths=build/test-results/test, build/test-results/integrationTest
<%_ } _%>
<%_ } _%>
<%_ if (!skipClient) { _%>
sonar.testExecutionReportPaths=<%_ if (buildTool === 'maven') { _%>target<%_ } else { _%> build<%_ } _%>/test-results/jest/TESTS-results-sonar.xml
Expand Down
24 changes: 0 additions & 24 deletions generators/server/templates/pom.xml.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,6 @@
<%_ } _%>
<properties-maven-plugin.version>1.0.0</properties-maven-plugin.version>
<sonar-maven-plugin.version>3.8.0.2131</sonar-maven-plugin.version>
<jacoco.utReportFolder>${project.build.directory}/jacoco/test</jacoco.utReportFolder>
<jacoco.utReportFile>${jacoco.utReportFolder}/test.exec</jacoco.utReportFile>
<jacoco.itReportFolder>${project.build.directory}/jacoco/integrationTest</jacoco.itReportFolder>
<jacoco.itReportFile>${jacoco.itReportFolder}/integrationTest.exec</jacoco.itReportFile>
<junit.utReportFolder>${project.testresult.directory}/test</junit.utReportFolder>
<junit.itReportFolder>${project.testresult.directory}/integrationTest</junit.itReportFolder>
<!-- jhipster-needle-maven-property -->
</properties>

Expand Down Expand Up @@ -1135,10 +1129,6 @@
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<!-- Sets the path to the file which contains the execution data. -->
<destFile>${jacoco.utReportFile}</destFile>
</configuration>
</execution>
<!-- Ensures that the code coverage report for unit tests is created after unit tests have been run -->
<execution>
Expand All @@ -1147,20 +1137,12 @@
<goals>
<goal>report</goal>
</goals>
<configuration>
<dataFile>${jacoco.utReportFile}</dataFile>
<outputDirectory>${jacoco.utReportFolder}</outputDirectory>
</configuration>
</execution>
<execution>
<id>pre-integration-tests</id>
<goals>
<goal>prepare-agent-integration</goal>
</goals>
<configuration>
<!-- Sets the path to the file which contains the execution data. -->
<destFile>${jacoco.itReportFile}</destFile>
</configuration>
</execution>
<!-- Ensures that the code coverage report for integration tests is created after integration tests have been run -->
<execution>
Expand All @@ -1169,10 +1151,6 @@
<goals>
<goal>report-integration</goal>
</goals>
<configuration>
<dataFile>${jacoco.itReportFile}</dataFile>
<outputDirectory>${jacoco.itReportFolder}</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
Expand Down Expand Up @@ -1386,7 +1364,6 @@
<configuration>
<!-- Force alphabetical order to have a reproducible build -->
<runOrder>alphabetical</runOrder>
<reportsDirectory>${junit.utReportFolder}</reportsDirectory>
<excludes>
<exclude>**/*IT*</exclude>
<exclude>**/*IntTest*</exclude>
Expand All @@ -1403,7 +1380,6 @@
<classesDirectory>${project.build.outputDirectory}</classesDirectory>
<!-- Force alphabetical order to have a reproducible build -->
<runOrder>alphabetical</runOrder>
<reportsDirectory>${junit.itReportFolder}</reportsDirectory>
<includes>
<include>**/*IT*</include>
<include>**/*IntTest*</include>
Expand Down