Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8371753
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T14:14:20+00:00 2026-06-09T14:14:20+00:00

We are using Maven 2.2.1 and Jenkins. We have some 300-400 modules. A few

  • 0

We are using Maven 2.2.1 and Jenkins. We have some 300-400 modules. A few months ago, we finalized the migration from Ant to Maven and at that time the goal was to make sure things built properly under Maven 2.2.1, as we weren’t still willing to move directly to Maven 3.0.x. Yeah, we knew that Maven was relatively stable, but due to the effort required in migrating all of the modules and assemblies (from Ant), we chose to stick with a well-known stable version such as 2.2.1.

In order to make a list of the modules which are not fully compliant with Maven 3.x, I would like to schedule the Jenkins jobs (that currently run them using Maven 2.2.1) to build them using 3.0.4 at a scheduled time during the night. How can I do this?

Thanks in advance!

Martin

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T14:14:21+00:00Added an answer on June 9, 2026 at 2:14 pm

    This is a screaming hack, but should work. As it is a hack, I am going to leave figuring out the exact details to you 😉

    You need to set up two jobs to fence the maven 3 jobs.

    Both jobs will need the Groovy Plugin in order to add a build step.

    You will set up three versions of Maven in the System configuration.

    • Maven 2.2.1
    • Maven 3.0.4
    • Maven 2.2.1 by day 3.0.4 by night

    The first job will access the global configuration and change Maven 2.2.1 by day 3.0.4 by night to point to the same path as Maven 3.0.4. The second job will switch it back.

    The code will need to be something like

    import hudson.tasks.*;
    Maven.DescriptorImpl descriptor = jenkins.model.Jenkins.instance.getDescriptor(Maven.class);
    Maven.MavenInstallation[] installs = descriptor.installations.clone; 
    // clone the array because we will be modifying it
    Maven.MavenInstallation v3 = null;
    for (Maven.MavenInstallation i: installs) {
      if (i.name.equals("Maven 3.0.4")) { v3=i; break;}
    }
    v3.class; // throw NPE if null (should be non-null)
    for (int i = 0; i < installs.length; i++) {
      if (installs[i].name.contains("by night")) { installs[i] = new Maven.MavenInstallation(installs[i].name,v3.home); break;}
    }
    descriptor.setInstallations(installs);
    

    Note I have not checked the above for syntax, but it should be close enough to get you sorted.

    The reverse job should be trivially easy

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We're using maven 2.1.0. I have multiple modules that are completely separate, but still
I'm running some maven builds in Jenkins, using a Master/multi-slave setup. These builds mostly
We are using Maven for a large build process (> 100 modules). We have
I have been using maven for some time and I am quite fond of
I'm running a maven project using Jenkins. The project is using the checkstyle plugin
Im using maven to checkout some projects. I don't want maven to checkout a
Im using maven to build a multi module project. But some projects are in
I am using maven to build applications. I have deployed a WAR file containing
I am using maven to build my java app, Jenkins for CI and Sonar
I am using maven to compile some java classes. One of the classes has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.