Jenkins: there is no “Launch agent via Java Web Start” method

Jenkins uses a TCP port to communicate with agents launched via the JNLP protocol, such as Windows-based agents. As of Jenkins 2.0, by default this port is disabled. You need to verify that JNLP is enabled and TCP port is defined in the Global Security section.

Go to Manage Jenkins -> Configure Global Security, and then scroll down to Agents, define a static TCP port for JNLP agents (random ports making it difficult to manage firewall rules on agents hosts ’cause port is chosen during the boot of Jenkins master), click Save and get back to agent’s configuration (try to connect the agent to Jenkins by clicking the Launch button, and then verify that agent’s status is “Connected via JNLP agent”)

jenkins jnlp port

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.