[SOLVED] The target server failed to respond – Jenkins and Nexus

I encountered this error while I was writing a Maven project. I want to explain what was the problem in my case.

Here is the setup of the project:

  • the project is on Github
  • a trigger on push events is fired to a self-hosted Jenkins installation that builds the artifact
  • an upload step of the artifact to a Nexus repository is done as a post-build step

This is what happens: when Jenkins finishes to test and build the artifact, a jar is assembled and pushed to the Nexus repository.

The upload process succeed if no entry class is defined in the Manifest.

The problem arises when I try to upload an executable jar named myproject-SNAPSHOT-jar-with-dependencies.jar with a Main Class in the manifest causing the upload process failure.

After several tries I found what was happening: Apache with mod_security enabled was blocking the upload of the jar file from Jenkins (no problem if uploaded directly from Nexus!)

So if you are having the same absurd problem try to checkout the error log of your web server, maybe you can find there your answer.

This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.