DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

The software you build is only as secure as the code that powers it. Learn how malicious code creeps into your software supply chain.

Apache Cassandra combines the benefits of major NoSQL databases to support data management needs not covered by traditional RDBMS vendors.

Generative AI has transformed nearly every industry. How can you leverage GenAI to improve your productivity and efficiency?

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workloads.

Related

  • MuleSoft OAuth 2.0 Provider: Password Grant Type
  • Solving Parallel Writing Issues in MuleSoft With Distributed Locking
  • Optimizing MuleSoft Performance With HikariCP: A Complete Guide
  • Generic and Dynamic API: MuleSoft

Trending

  • Building Resilient Networks: Limiting the Risk and Scope of Cyber Attacks
  • Chaos Engineering for Microservices
  • AI-Driven Test Automation Techniques for Multimodal Systems
  • Building Resilient Identity Systems: Lessons from Securing Billions of Authentication Requests
  1. DZone
  2. Software Design and Architecture
  3. Integration
  4. Publish Mule 4 Code Review and Coverage to SonarQube

Publish Mule 4 Code Review and Coverage to SonarQube

In this article, see how to publish Mule 4 code review and coverage to SonarQube.

By 
Sadik Ali user avatar
Sadik Ali
DZone Core CORE ·
Sep. 11, 20 · Tutorial
Likes (6)
Comment
Save
Tweet
Share
14.5K Views

Join the DZone community and get the full member experience.

Join For Free

Mulesoft plugin to support SonarQube:

Follow the below steps:

      1: SonarQube on-prem installation should be available.

      2: If required, create organization and configure it into maven's settings.xml file as below.

XML
 




xxxxxxxxxx
1
17


 
1
<profile>
2
       <id>sonar</id>
3
       <activation>
4
           <activeByDefault>true</activeByDefault>
5
       </activation>
6
       <properties>
7
           <!-- Optional URL to server. Default value is http://localhost:9000 -->
8
        <sonar.host.url>http://localhost:9000</sonar.host.url>
9
       </properties>
10
        <repositories>
11
        <repository>
12
        <id>MuleRepository</id>
13
        <name>Exchange Repository</name>
14
        <url>https://maven.anypoint.mulesoft.com/api/v2/<organizationkey>/maven</url>
15
        <layout>default</layout>
16
       </repository>
17
        </repositories>



My sonar is available on "http://localhost:9000". As I have not created any organization, none of the organization and its credentials are configured here.

3: Download the MuleSoft plugin binary from the below location.

MuleSoft Sonar Plugin

4: Now execute the below command and create a jar file as a plugin to add in sonar

mvn clean package sonar-packaging:sonar-plugin -Dlanguage=mule

Once the plugin is created, copy the jar file in sonar's plugin folder (sonar-home/extensions/plugins).

Restart the Sonar instance after the same.

5: Once the plugin is copied in the plugin folder, copy the rules files in the same plugin folder.

1: https://github.com/mulesoft-catalyst/mule-sonarqube-plugin/blob/master/src/test/resources/rules-4.xml

2: https://github.com/mulesoft-catalyst/mule-sonarqube- plugin/blob/master/src/test/resources/rules-3.xml

And restart sonar once again. (Safer side to reflect changes in UI.)

6: Once it is done, go to Default/Particular created organization in SonarQube->Administration -> Quality Profiles and delete the XML file extension from the rule.

7: Once it is done, refresh the page, and you will be able to see the Mule plugin in quality profiles. By default, it will set the MuleSoft 4 rule, and based on the project, it can be configured for MuleSoft 3 from the drop-down.

Now we're ready to execute the command. 

Let's create a sample MuleSoft application:

Created one sample application: MuleSoft4 sample application

And now, execute the command to scan mu code with the defined rule in the MuleSoft plugin tool.

command: /root/apache-maven-3.6.3/bin/mvn sonar:sonar test -Dsonar.host.url=http://localhost:9000 -Dsonar.sources=src/

You can change commands based on your requirements.

           Here is the resultant SonarQube's dashboard:


Now we have a plugin to perform code review and MunitCode review.

MuleSoft

Opinions expressed by DZone contributors are their own.

Related

  • MuleSoft OAuth 2.0 Provider: Password Grant Type
  • Solving Parallel Writing Issues in MuleSoft With Distributed Locking
  • Optimizing MuleSoft Performance With HikariCP: A Complete Guide
  • Generic and Dynamic API: MuleSoft

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!