Skip to content

Better support for multi-module plugins#1459

Merged
jonesbusy merged 12 commits into
jenkins-infra:mainfrom
PratikMane0112:feature/enhance-addcodeowner-recipe
Jan 14, 2026
Merged

Better support for multi-module plugins#1459
jonesbusy merged 12 commits into
jenkins-infra:mainfrom
PratikMane0112:feature/enhance-addcodeowner-recipe

Conversation

@PratikMane0112
Copy link
Copy Markdown
Contributor

@PratikMane0112 PratikMane0112 commented Jan 9, 2026

Fix issue #1029

Used logic -

  • for single module plugin :
    • Root POM has packaging=hpi, will refer root directory
    • No change in behavior
  • for multi module plugin :
    • Root POM has packaging=pom then search subdirs
    • Find subdir with packaging=hpi
    • Use that subdir's POM

Testing done

With this logic I tried with below plugins & was able to add correct teams

  • --plugins option (local .cache)
plugin-modernizer --plugins openstack-cloud --recipes AddCodeOwner
  • --plugin-path (using test-plugins dir)
plugin-modernizer --plugin-path test-plugins/openstack-cloud --recipes AddCodeOwner

dry-run recipe over other plugins: badge, git plugins (single module) & workflow-cps (multi-module)

The content added to .github/CODEOWNERS w.r.t plugins -

  • openstack-cloud-plugin : * @jenkinsci/openstack-cloud-plugin-developers
  • badge-plugin : * @jenkinsci/badge-plugin-developers
  • git-plugin : * @jenkinsci/git-plugin-developers
  • workflow-cps-plugin : * @jenkinsci/workflow-cps-plugin-developers

Submitter checklist

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests - that demonstrates feature works or fixes the issue

@PratikMane0112
Copy link
Copy Markdown
Contributor Author

PratikMane0112 commented Jan 9, 2026

@jonesbusy @gounthar, I have used a simple logic for detection & adding of correct team as CODEOWNER for plugin,
if any other logic which is better, would also be applied & really appreciated :)

@jonesbusy
Copy link
Copy Markdown
Collaborator

Some comments to address.

Also an integration test would be useful (CommandLineIT)

@jonesbusy jonesbusy changed the title Update AddCodeOwner recipe for multi-module plugins Better support for multi-module plugins Jan 10, 2026
@jonesbusy jonesbusy added the enhancement For changelog: Minor enhancement. use `major-rfe` for changes to be highlighted label Jan 10, 2026
@jonesbusy
Copy link
Copy Markdown
Collaborator

Thanks for the fixes. It will require still few more days before I can continue the review

@PratikMane0112
Copy link
Copy Markdown
Contributor Author

PratikMane0112 commented Jan 10, 2026

Thanks for the fixes. It will require still few more days before I can continue the review

Sure, I respect your time & difficulty of this issue. I'm open for further changes as per your suggestion after review.

That's the way I can improve myself & understand the codebase better.

Copilot AI added a commit that referenced this pull request Jan 12, 2026
Co-authored-by: jonesbusy <825750+jonesbusy@users.noreply.github.com>
Copilot AI added a commit that referenced this pull request Jan 12, 2026
Co-authored-by: jonesbusy <825750+jonesbusy@users.noreply.github.com>
@jonesbusy jonesbusy requested a review from Copilot January 12, 2026 20:41
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request adds support for multi-module Maven plugins in the Jenkins plugin modernizer tool. Previously, the tool assumed all plugins had a single-module structure with the plugin pom.xml at the root. This enhancement enables the tool to detect multi-module projects (with packaging=pom at the root) and automatically locate the actual plugin module (with packaging=hpi) to ensure OpenRewrite recipes operate on the correct pom.xml with the correct artifactId.

Changes:

  • Added adjustForMultiModule() method to detect and adjust the repository path for multi-module plugins
  • Enhanced PluginPathConverter to handle multi-module plugins specified via --plugin-path
  • Added comprehensive test coverage including unit tests and integration tests

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
plugin-modernizer-core/src/main/java/io/jenkins/tools/pluginmodernizer/core/model/Plugin.java Added adjustForMultiModule() and findJenkinsPluginModule() methods to detect multi-module projects and adjust the local repository path to the plugin module
plugin-modernizer-core/src/main/java/io/jenkins/tools/pluginmodernizer/core/impl/PluginModernizer.java Integrated the multi-module adjustment logic to be called after plugin fetching
plugin-modernizer-cli/src/main/java/io/jenkins/tools/pluginmodernizer/cli/converter/PluginPathConverter.java Enhanced to detect multi-module plugins and extract the correct plugin module when using --plugin-path option
plugin-modernizer-core/src/test/java/io/jenkins/tools/pluginmodernizer/core/model/PluginTest.java Added comprehensive unit tests covering single-module, multi-module, edge cases, and error scenarios
plugin-modernizer-cli/src/test/java/io/jenkins/tools/pluginmodernizer/cli/converter/PluginPathConverterTest.java Added unit tests for PluginPathConverter with multi-module plugin scenarios
plugin-modernizer-cli/src/test/java/io/jenkins/tools/pluginmodernizer/cli/CommandLineITCase.java Added integration tests validating multi-module plugins work with AddCodeOwner and FetchMetadata recipes
plugin-modernizer-cli/src/test/resources/multi-module-plugin/* Added test fixture with realistic multi-module plugin structure for testing

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@PratikMane0112
Copy link
Copy Markdown
Contributor Author

@jonesbusy, I will do the changes suggested soon ...

@jonesbusy
Copy link
Copy Markdown
Collaborator

Thanks for your contribution. LGTM

@jonesbusy jonesbusy merged commit c4a56b2 into jenkins-infra:main Jan 14, 2026
17 checks passed
@PratikMane0112 PratikMane0112 deleted the feature/enhance-addcodeowner-recipe branch January 14, 2026 11:32
@PratikMane0112
Copy link
Copy Markdown
Contributor Author

@jonesbusy, If may I allowed to ask, Is plugin modernizer going to take part in gsoc 26 ?

@jonesbusy
Copy link
Copy Markdown
Collaborator

Yes if the project is selected. We also still need to draft the project idea with other mentors

@PratikMane0112
Copy link
Copy Markdown
Contributor Author

PratikMane0112 commented Jan 14, 2026

Yes if the project is selected. We also still need to draft the project idea with other mentors

Okay, thanks. Was just curious that now I am familiar with codebase but it is not present in current draft project ideas list

@jonesbusy
Copy link
Copy Markdown
Collaborator

Yea it's matter of day before it's published

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement For changelog: Minor enhancement. use `major-rfe` for changes to be highlighted

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants