Apache Maven needs to be configured for Jenkins plugin development.
The hpi plugin for Apache Maven requires some additional global configurations to function correctly with older Jenkins plugin environments.
Improper configuration settings can cause Maven to report errors or warnings, including failure to download artifacts during the update process.
To avoid issues, include the following content in the settings.xml
file in your ~/.m2
directory (Windows users will find them in %USERPROFILE%\.m2\settings.xml
):
<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>
To verify that Maven is installed, run the following command:
This command prints some diagnostic output, including the versions of Java and Maven, and which Java installation was found by Maven.
It should indicate a 17 version of Java, and list the path to where Java is located.
If you don’t see this information, see Troubleshooting.