Usage

Configuration For Expandable Applications

The expanded root pom.xml must contain the following properties & profiles. There should never be any credentials here, as they are injected only on Jenkins.

-- anchor:custom-properties:start
    <!-- disable git checks, because expanded code does not have a history -->
    <sonar.scm.disabled>true</sonar.scm.disabled>
    <!-- probably unnecessary right now, but ignore .gitignore (because expansions/ is an excluded directory -->
    <sonar.scm.exclusions.disabled>true</sonar.scm.exclusions.disabled>
    <!-- disable code duplication for now; we need to implement extra filtering, as the raw results are useless -->
    <sonar.cpd.exclusions>**/*</sonar.cpd.exclusions>
    <!-- exclude base components -->
    <sonar.exclusions>
      components/account/**/*,
      components/assets/**/*,
      components/utils/**/*,
      components/validation/**/*,
      components/workflow/**/*
    </sonar.exclusions>
    <!-- use filtered jacoco reports that exclude expanded lines; experimental/WIP -->
    <sonar.coverage.jacoco.xmlReportPaths>target/site/jacoco/jacoco-filtered.xml</sonar.coverage.jacoco.xmlReportPaths>
-- anchor:custom-properties:end
-- anchor:custom-profiles:start
    <profile>
      <id>sonar</id>
      <activation>
        <property>
          <name>env.JENKINS_HOME</name>
        </property>
      </activation>
      <build>
        <plugins>
          <!-- run jacoco -->
          <plugin>
            <groupId>org.jacoco</groupId>
            <artifactId>jacoco-maven-plugin</artifactId>
            <version>0.8.11</version>
            <configuration>
              <excludes>
                <!-- exclude base components; it doesn't seem to work for some reason
                     or maybe the base components tests should be ignored instead -->
                <exclude>components/account/**/*</exclude>
                <exclude>components/assets/**/*</exclude>
                <exclude>components/utils/**/*</exclude>
                <exclude>components/validation/**/*</exclude>
                <exclude>components/workflow/**/*</exclude>
              </excludes>
            </configuration>
            <executions>
              <execution>
                <id>coverage</id>
                <goals>
                  <goal>prepare-agent</goal>
                  <goal>report</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <!-- run jacoco filter to ignore expanded code -->
          <plugin>
            <groupId>net.democritus.maven.plugins</groupId>
            <artifactId>expansion-validation-maven-plugin</artifactId>
            <version>2024.0.0</version>
            <executions>
              <execution>
                <phase>verify</phase>
                <goals>
                  <goal>jacoco</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <!-- run sonar -->
          <plugin>
            <groupId>org.sonarsource.scanner.maven</groupId>
            <artifactId>sonar-maven-plugin</artifactId>
            <version>3.11.0.3922</version>
            <executions>
              <execution>
                <id>sonar</id>
                <phase>verify</phase>
                <goals>
                  <goal>sonar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
-- anchor:custom-profiles:end