Skip to content

Commit

Permalink
Try setting up Jacoco in a manner compatible with Sonar
Browse files Browse the repository at this point in the history
  • Loading branch information
benmccann committed Jan 13, 2020
1 parent 23716aa commit d582875
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 47 deletions.
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ addons:
token:
secure: "PR4ruuSYEYqmUCcTb5d/VNBJ2OcntoRreMpED6sAroMfB72csAVq7JEudQGTecnV8aEVrZOZQLCY5q1QSeQ/MpZ8bcNOohMh6EVLeriI1umE34eQSlipquWti/F5yhF7uSw7+SSNMp8bq8FOfUyoxxiWL/GaeS/hxFg0OJldphIzSePyQxXK04g8Nt8ZrsbkDiNOuAMxyhKB+fA+sHcwr17u2kdv8qiQr3534u59dcQE4b8Wod0anSP2HHjxnCyQuRJbu604XfC23mT/SKgsHGbPtwtT2OXfm7CGrC1c26n7LUsXhWJNn+9tojxlJ8f0dV46rwiQQqcjgKPSfnpyYu6DEu6nDXI8H2EJ95yb/8PKeJzMeAmn4/0lNNFs45x3uyGz8kf7H2pxHDN9TrQ0eXvsTPVG9T7YaQfTPWhOHdqnfXKLK559Uvc8YhvSIZ5S133K1q1Ls8qG2MiNjHC7p0lIEaSX6zlhnKZ+TpSDaBwCCvZsdhkR5V2q81DWz9Ocnp/lb7cHZBGszlB+HGipHLKms9j+xwmwqXA76+queGfxlk0+o5Yyo+IP3AM+5+mrOiJPEa8I3nY2E0aOlkFbFOoEgWYtlWw3WJzYY5itHTrVt8FAha/vIGBJIWm4aQqD8yN0R0EjVtCSSlrFkEJ6kX+TSO8YhnAQr5GUrXQgIVg="

before_install:
install:
- sudo apt-get install jq
- LATEST_VERSION="$(curl -Ls https://api.bintray.com/packages/codacy/Binaries/codacy-coverage-reporter/versions/_latest | jq -r .name)"
- curl -Ls -o codacy-coverage-reporter-assembly.jar "https://dl.bintray.com/codacy/Binaries/${LATEST_VERSION}/codacy-coverage-reporter-assembly.jar"
install:
- export MAVEN_OPTS=-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn
- mvn -B install -DskipTests -Dgpg.skip
script:
# the following command line builds the project, runs the tests with coverage and then execute the SonarCloud analysis
- mvn -B clean org.jacoco:jacoco-maven-plugin:prepare-agent install sonar:sonar -Dsonar.projectKey=jtablesaw_tablesaw
after_success: java -jar codacy-coverage-reporter-assembly.jar report --language Java --coverage-reports aggregate/target/site/jacoco-aggregate/jacoco.xml
after_success:
- find . -name jacoco.xml | xargs java -jar codacy-coverage-reporter-assembly.jar report --language Java --partial --coverage-reports
- java -jar codacy-coverage-reporter-assembly.jar final
35 changes: 0 additions & 35 deletions aggregate/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,45 +8,10 @@
<version>0.37.1-SNAPSHOT</version>
</parent>

<!--
The JaCoCo goal is designed to be configured for specific reporting modules only.
Due to the design of maven if it is not possible to e.g. simply enable it in the parent pom.
We had a lengthy design discussion about this: https://github.com/jacoco/jacoco/wiki/MavenMultiModule
-->
<artifactId>tablesaw-aggregate</artifactId>

<packaging>jar</packaging>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<!-- Jacoco prepare-agent builds some command-line params without -->
<!-- which jacoco will not instrument. Hence it is important to add -->
<!-- those command-line params here (${argLine} holds those params) -->
<argLine>${argLine} -Xms256m -Xmx2048m</argLine>
<forkCount>1</forkCount>
<runOrder>random</runOrder>
<printSummary>false</printSummary>
</configuration>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<executions>
<execution>
<id>report-aggregate</id>
<phase>verify</phase>
<goals>
<goal>report-aggregate</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>tech.tablesaw</groupId>
Expand Down
8 changes: 0 additions & 8 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,6 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>-Duser.language=en-US -Duser.region=US</argLine>
<printSummary>false</printSummary>
</configuration>
</plugin>
</plugins>
</build>

Expand Down
13 changes: 13 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,13 @@
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
Expand All @@ -233,6 +240,12 @@
<configuration>
<argLine>-Duser.language=en-US -Duser.region=US</argLine>
<printSummary>false</printSummary>
<!-- Jacoco prepare-agent builds some command-line params without -->
<!-- which jacoco will not instrument. Hence it is important to add -->
<!-- those command-line params here (${argLine} holds those params) -->
<argLine>${argLine} -Xms256m -Xmx2048m</argLine>
<forkCount>1</forkCount>
<runOrder>random</runOrder>
</configuration>
</plugin>
<plugin>
Expand Down

0 comments on commit d582875

Please sign in to comment.