java-only
The following steps are applicable only for java projects.
1 - Remove the oparent as parent tag in the primary pom.xml https://gerrit.onap.org/r/c/policy/parent/+/137695/1/pom.xml
<parent> <groupId>org.onap.oparent</groupId> <artifactId>oparent</artifactId> <!-- When changing, also change the oparent.version property --> <version>3.3.3</version> <relativePath /> </parent> <properties> <oparent.version>3.3.3</oparent.version> </properties>
2 - Run mvn clean install in the project where oparent was used and any other project that inherits from it.
For PF, oparent parent tag was removed from policy-parent pom.xml only. All other projects inherit from policy-parent
3 - With all the dependency missing on the mvn clean install run, add them to main pom.xml in dependencyManagement tag. Use this tag specifically to avoid cascade dependency addition.
https://gerrit.onap.org/r/c/policy/parent/+/137695/1/integration/pom.xml
4 - After all missed dependencies fixed, fix the plugins dependencies.
sonar https://gerrit.onap.org/r/c/policy/parent/+/137695/1/pom.xml and https://gerrit.onap.org/r/c/policy/parent/+/137724/1/integration/pom.xml
- copy the tags related to sonar properties to main pom.xml
- copy sonar plugins tags to main pom.xml
<properties> . . <sonar-jacoco-listeners.version>3.2</sonar-jacoco-listeners.version> <sonar.core.codeCoveragePlugin>jacoco</sonar.core.codeCoveragePlugin> <!-- Default Sonar configuration --> <sonar.core.codeCoveragePlugin>jacoco</sonar.core.codeCoveragePlugin> <sonar.coverage.jacoco.xmlReportPaths>${project.reporting.outputDirectory}/jacoco-ut/jacoco.xml</sonar.coverage.jacoco.xmlReportPaths> <!-- Note: This list should match jacoco-maven-plugin's exclusion list below --> <sonar.exclusions>org/drools/**/*,**/gen/**,**/generated-sources/**</sonar.exclusions> . . </properties> <plugin> <groupId>org.sonarsource.scanner.maven</groupId> <artifactId>sonar-maven-plugin</artifactId> <version>${sonar.scanner.version}</version> <plugin>
- copy the distributionManagement tags (https://gerrit.onap.org/r/c/policy/parent/+/137695/1/pom.xml)
<distributionManagement> <repository> <id>ecomp-releases</id> <url>${onap.nexus.url}/content/repositories/releases</url> </repository> <snapshotRepository> <id>ecomp-snapshots</id> <url>${onap.nexus.url}/content/repositories/snapshots</url> </snapshotRepository> </distributionManagement>
- copy jacoco properties and plugins configurations (https://gerrit.onap.org/r/c/policy/parent/+/137695/1/integration/pom.xml and https://gerrit.onap.org/r/c/policy/parent/+/137724/1/integration/pom.xml)
<properties> . . <jacoco.destFile>${project.build.directory}/code-coverage/jacoco-ut.exec</jacoco.destFile> . . </properties> <plugins> ... <plugin> <groupId>org.jacoco</groupId> <artifactId>jacoco-maven-plugin</artifactId> <version>${version.jacoco}</version> <configuration> <excludes> <exclude>org/drools/**/*</exclude> <exclude>**/gen/**</exclude> <exclude>**/generated-sources/**</exclude> </excludes> <output>file</output> </configuration> <executions> <execution> <id>pre-unit-test</id> <goals> <goal>prepare-agent</goal> </goals> <configuration> <destFile>${jacoco.destFile}</destFile> <append>true</append> <propertyName>surefireArgLine</propertyName> </configuration> </execution> <execution> <id>post-unit-test</id> <phase>test</phase> <goals> <goal>report</goal> </goals> <configuration> <dataFile>${jacoco.destFile}</dataFile> <outputDirectory>${project.reporting.outputDirectory}/jacoco-ut</outputDirectory> </configuration> </execution> <execution> <id>report-aggregate</id> <phase>verify</phase> <goals> <goal>report-aggregate</goal> </goals> <configuration> <includeCurrentProject>true</includeCurrentProject> </configuration> </execution> </executions> </plugin> ... </plugins>
- copy vulnerability scan profile https://gerrit.onap.org/r/c/policy/parent/+/137695/1/integration/pom.xml
<profile> <id>cve</id> <build> <plugins> <plugin> <groupId>org.owasp</groupId> <artifactId>dependency-check-maven</artifactId> <version>10.0.2</version> <executions> <execution> <goals> <goal>aggregate</goal> </goals> </execution> </executions> </plugin> </plugins> </build> </profile>
5 - Add to project checkstyle module
Copy the module checkstyle from oparent to main project and configure as a new module
Update maven-checkstyle-plugin with the module reference.
https://gerrit.onap.org/r/c/policy/parent/+/137695
https://gerrit.onap.org/r/c/policy/parent/+/138046
6 - Run mvn clean install and fix possible issues with plugins
7 - Run sonar scan for coverage
docker run -d --name sonarqube -e SONAR_ES_BOOTSTRAP_CHECKS_DISABLE=true -p 9000:9000 sonarqube:latest
Login as admin and the add local project. Follow instructions on screen to attach project to the sonarqube instance.