Jenkins: build step ‘Invoke top-level Maven targets’ marked build as failure

I am using the latest Jenkins in my environment and going to compile a simple Java application source with Maven. But, before doing that, I checked that Maven is successfully installed, and then verified build process outside of Jenkins: version (mvn -v), compilation (mvn compile) and etc.

If you are unable to run mvn commands from any shell, you need to check your system’s (Windows, in my case) environment variables : Win+Break -> Advanced system settings -> Advanced -> Environment variables : variable PATH must have a value <maven bin folder> and JAVA_HOME must have a path to JAVA SDK (as shown in the picture below) . You can also get that values by using a simple PS one-liner:

 Get-ChildItem env:|where-object {$_.Name -like "JAVA*" -or $_.Name -eq "PATH"}|ft -Wrap 

If variables are set correctly and Maven works from cmd/PS, you can switch to Jenkins and try to add a new build job (mvn compile). Unfortunately, the following error may appear while compiling an application source:

\Jenkins\workspace\... was unexpected at this time.
Build step 'Invoke top-level Maven targets' marked build as failure

To resolve this , carry out the following steps:

  • Open Jenkins and go to Manage Jenkins -> Global Tool Configuration
  • Press the GIT , unclear Install automatically and provide name (e.g. Default) and path to GIT executable (C:\Program Files\Git\bin\git.exe , for example)
  • Scroll down and press the Maven Installations button, check Install Automatically, provide a name (e.g. Maven_Latest), and then choose Install From Apache and 3.3.9 version.
  • Go to your project, click on Configure-Build, and choose a name of your new Maven version that we’ve just added (Maven_Latest), and then press Save
  • Re-run the build job and verify that it’s successfully completed

The possible reason – there are some issues with Jenkins and Maven 3.5.x, 3.6.x versions. I’ve tried them all and only 3.3.9 version resolved that problem. If you have any comments/suggestions, please share them.

Webinar: Windows Server 2019 in Action

So you’ve heard all about Windows Server 2019 – now you can see it in action in a live demo webinar on November 8th!

The last WS2019 webinar by Altaro was hugely popular with over 4,500 IT pros registering for the event. Feedback gathered from that webinar and the most popular features will now be discussed and tested live by Microsoft MVP Andy Syrewicze. And you’re invited!

This deep-dive webinar will focus on:

• Windows Admin Center

• Containers on Windows Server

• Storage Migration Service

• Windows Subsystem for Linux

• And more!

Demo webinars are a really great way to see a product in action before you decide to take the plunge yourself. It enables you to see the strengths and weaknesses first-hand and also ask questions that might relate specifically to your own environment.

With the demand so high, the webinar is presented live twice on November 8th to help as many people benefit as possible. The first session is at 2pm CET/8am EST/5am PST and the second is at 7pm CET/1pm EST/10am PST.

With the record number of attendees for the last webinar, some people were unable to attend the sessions which were maxed out. It is advised you save your seat early for this webinar to keep informed and ensure you don’t miss the live event.

Save your seat: https://goo.gl/PFnDmN

Altaro - live Demo Webinar - Windows Server 2019 In Action -1200x628-no-cta1