jenkins.io
jenkins.io copied to clipboard
Update parent POM - Added a Maven configuration
Added a Maven configuration (settings.xml) in the Update parent POM (Documentation)
Configure "settings.xml" for successful maven-hpi-plugin development.
- [X] Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
- [X] Ensure that the pull request title represents the desired changelog entry
- [X] Please describe what you did
Ideally this information should be in plugin POM and not your local settings -- that way anybody can build the plugin without the need for extra setup. See how e.g. https://github.com/jenkinsci/git-plugin/blob/master/pom.xml#L263 embeds the repository settings
For the <mirrors> setting I'm not sure when it's useful/needed.
as far as I know the only thing that is helpful there is adding:
<pluginGroups>
<pluginGroup>org.jenkins-ci.tools</pluginGroup>
</pluginGroups>
which all it does is help maven resolve the hpi plugin and prevents it from logging a warning to the build.
the rest should be unneeded
I've understood the same that @timja has, that there should not be a need for the additional settings.xml file. @Giridharan002 can you provide examples of plugins that require the settings.xml file in order to update the parent pom?
- Thank you for your question.
I apologize for any confusion my previous response may have caused.
Upon further research, I have learned that the additional settings.xml file is not required for updating the parent pom, it should be done by modifying the 'pom.xml' file directly.
Again, I apologize for any confusion.
I've understood the same that @timja has, that there should not be a need for the additional settings.xml file. @Giridharan002 can you provide examples of plugins that require the
settings.xmlfile in order to update the parent pom?
After reviewing my previous response, I would like to clarify that the use of a "settings.xml" file may be necessary in certain cases when updating a parent POM, particularly if the project has custom repository configurations or requires authentication. In fact, as mentioned by you and Darin Pope in the "Modernizing Jenkins Plugins" video (https://www.youtube.com/live/Fev8KfFsPZE?feature=share), the Scheduled Build Plugin requires a separate "settings.xml" file to update a parent POM.
Therefore, if a user wants to use the Scheduled Build Plugin to trigger Maven builds that involve updating a parent POM, they may need to configure the "settings.xml" file to include any custom repository locations or authentication details.
Hi @kmartens27,
Thank you for reviewing the text and providing suggestions for formatting and syntax. I'm glad to hear that the documentation is clear overall. I will definitely take your suggestions into consideration and make any necessary adjustments.
Just to clarify, do you mean that I should make the changes you mentioned and then resend the pull request?
Thanks again for your help!
Hi @Giridharan002 when making changes, you would do as you said and make the changes locally on the same branch and then push the changes in a new commit to the same pull request.
Other than that, I would update the text according to the insights provided by @MarkEWaite & @timja and add the commit at that point.
@Giridharan002 there are 2 problems this is trying to solve:
- artifacts not downloaded during build: I think the tutorial should suggest adding the
<repositories>and<pluginRepositories>sections to the plugin POM (not to setttings) - resolution of the HPI plugin as mentioned in https://github.com/jenkins-infra/jenkins.io/pull/6113#issuecomment-1455228348 -- that part could be in the settings. Since this is not specific to the tutorial, maybe it could go to a different page, e.g. https://www.jenkins.io/doc/developer/development-environment/ide-configuration/ like #6109 suggests
Hi @Giridharan002, I wanted to check and see if this is still something you are working on. It appears that @zbynek had provided some feedback, but it has been a bit since there was any further action. If there is anything that you have questions or concerns about, let us know!
as far as I know the only thing that is helpful there is adding:
<pluginGroups> <pluginGroup>org.jenkins-ci.tools</pluginGroup> </pluginGroups>which all it does is help maven resolve the hpi plugin and prevents it from logging a warning to the build.
the rest should be unneeded
I did some more detailed testing and came to a different conclusion than @timja. I may be making a mistake somehow in my configuration, but here is what I observed:
No /.m2/settings.xml file
When I compile the embeddable build status plugin or a new plugin created from the archetype, I get a warning in the compiler output that says:
[INFO] Scanning for projects...
[WARNING] The POM for org.jenkins-ci.tools:maven-hpi-plugin:jar:3.38 is missing, no dependency information available
[WARNING] Failed to build parent project for org.jenkins-ci.plugins:embeddable-build-status:hpi:999999-SNAPSHOT
Only pluginGroups in settings.xml
When my ~/.m2/settings.xml contains only:
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
<pluginGroups>
<pluginGroup>org.jenkins-ci.tools</pluginGroup>
</pluginGroups>
</settings>
then the compilation of embeddable build status plugin reports the warning:
[INFO] Scanning for projects...
[WARNING] The POM for org.jenkins-ci.tools:maven-hpi-plugin:jar:3.38 is missing, no dependency information available
[WARNING] Failed to build parent project for org.jenkins-ci.plugins:embeddable-build-status:hpi:999999-SNAPSHOT
Include pluginRepository and pluginGroups in settings.xml
When my ~/.m2/settings.xml contains:
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
<pluginGroups>
<pluginGroup>org.jenkins-ci.tools</pluginGroup>
</pluginGroups>
<profiles>
<profile>
<id>jenkins</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<repositories>
<repository>
<id>repo.jenkins-ci.org</id>
<url>https://repo.jenkins-ci.org/public/</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>repo.jenkins-ci.org</id>
<url>https://repo.jenkins-ci.org/public/</url>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
</settings>
then the compilation of embeddable build status plugin reports no warning.
I'm not skilled enough with Maven settings files to identify a minimum description of the settings that avoid the warning about maven hpi plugin, but as far as I can tell, more than the pluginGroups section is required.
@timja, any suggestions what's different between my configuration and yours?
Please take a moment and address the merge conflicts of your pull request. Thanks!
Superseded by:
- #7194
Thanks for starting us down the path to resolve the issue!