mrQWERTY
mrQWERTY

Reputation: 4149

SonarQube - Dependency Issues with Maven

We have a multi-module project built with apache-maven 3.0.5.

Here is the setup:

Here are the warnings I am getting when running a Sonar job.

**These warnings does not seem to have an effect on server results. SonarQube server displays rule violations and no classes seem to be missing there.

Before analysis :

[WARNING] The following dependencies could not be resolved at this point of the build but seem to be part of the reactor:
15:04:52 [WARNING] o com.company.product.plugins:com.company.product.external.libraries:jar:1.0.0-SNAPSHOT (provided)
15:04:52 [WARNING] Try running the build up to the lifecycle phase "package"
15:04:52 [WARNING] The following dependencies could not be resolved at this point of the build but seem to be part of the reactor:
15:04:52 [WARNING] o com.company.product.plugins:com.company.product.capturetool.core:jar:1.0.0-SNAPSHOT (provided)

During analysis :

Class 'com/company/product/core/tools/ocraction/MyClass' is not accessible through the ClassLoader.
    [WARN] [15:05:25.731] Class 'com/company/product/core/tools/ocraction/MyClass' is not accessible through the ClassLoader.

After analysis :

[INFO] com.company.product.core.feature ................ SKIPPED
[INFO] com.company.product.common.feature ... SKIPPED
[INFO] My Product ............................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS

I am confused as to why this is happening. I have scoured the internet without answers. I've got responses such as .m2 directory corruption to running "mvn clean package" instead of "mvn clean install" before Sonar analysis.

Upvotes: 1

Views: 1661

Answers (1)

mrQWERTY
mrQWERTY

Reputation: 4149

I managed to fix this issue. I figured out that Sonar Jenkins plugin does not actually run the command "mvn clean install" by itself. Instead, it merely runs "mvn sonar:sonar" along with any additional arguments.

I executed "mvn clean install" before Sonar's post-build step. This helped to resolve my issue.

Upvotes: 1

Related Questions