咨询:Jenkins 1.651.3中如何获取Maven 3.5.0及以上版本
Got it, let's tackle this problem head-on. Jenkins 1.651.3 is a pretty dated release, so its built-in Maven installer doesn't include newer versions like 3.5.0 by default. Here are two key parts to solve this: getting Maven 3.5.0 working with your Jenkins instance, and trying to get the installer to recognize newer versions.
Fixing the Maven 3.5.0 Compatibility Issue
The most reliable way (especially for older Jenkins versions) is to install Maven manually on your server and then point Jenkins to it:
Manually install Maven 3.5.0 on your Jenkins server
- SSH into the server running Jenkins.
- Download the Maven 3.5.0 binary archive:
wget https://archive.apache.org/dist/maven/maven-3/3.5.0/binaries/apache-maven-3.5.0-bin.tar.gz - Extract it to a stable directory (e.g.,
/opt/maven):sudo tar -xzf apache-maven-3.5.0-bin.tar.gz -C /opt/maven/ - (Optional) Set up environment variables so the system recognizes Maven globally:
Edit your shell profile (e.g.,~/.bashrcor/etc/profile) and add:
Apply the changes withexport MAVEN_HOME=/opt/maven/apache-maven-3.5.0 export PATH=$MAVEN_HOME/bin:$PATHsource ~/.bashrc.
Configure Jenkins to use the manually installed Maven
- Open your Jenkins dashboard, go to Manage Jenkins > Global Tool Configuration.
- Scroll down to the Maven section.
- Click Add Maven, then uncheck the Install automatically box.
- Give this Maven installation a name (e.g.,
Maven 3.5.0), then paste the path to your installed Maven in the MAVEN_HOME field (/opt/maven/apache-maven-3.5.0in our example). - Save the configuration. Now when you set up or edit a Jenkins job, you can select this
Maven 3.5.0version from the Maven dropdown.
Getting the Jenkins Installer to Recognize Newer Maven Versions
If you prefer using Jenkins' automatic installer, here's what you can try (note: success depends on plugin compatibility with your old Jenkins version):
Update the Maven Installer Plugin
- Go to Manage Jenkins > Manage Plugins.
- Switch to the Available tab, search for Maven Installer.
- Check if there's an updated version of the plugin that's compatible with Jenkins 1.651.3. Install it, then restart Jenkins.
- After restarting, go back to Global Tool Configuration > Maven—you should now see newer Maven versions (including 3.5.0) in the dropdown when you check Install automatically.
Manually enter the Maven version
- Some older Jenkins versions let you bypass the dropdown and manually type the version number. Go to Global Tool Configuration > Maven, click Add Maven, check Install automatically, then type
3.5.0directly into the Version field. - Save the configuration—Jenkins will attempt to download and install Maven 3.5.0 automatically. If this works, great! If not, stick with the manual installation method above.
- Some older Jenkins versions let you bypass the dropdown and manually type the version number. Go to Global Tool Configuration > Maven, click Add Maven, check Install automatically, then type
Important Note
Jenkins 1.651.3 is no longer supported (it was released in 2016), so you might run into other compatibility issues with newer tools or plugins. If possible, upgrading to a supported Jenkins version is the long-term solution—but if you're stuck with 1.651.3, the manual installation method is your safest bet.
内容的提问来源于stack exchange,提问作者DenCowboy

