ARTIFACTORY: What to Do When Your Maven Build with Hide Existence of Unauthorized Resources Enabled Fails with a 404 Error

AuthorFullName__c
Shai Ben-Zvi
articleNumber
000004240
FirstPublishedDate
2018-11-15T15:00:37Z
lastModifiedDate
2025-05-15

ARTIFACTORY: What to Do When Your Maven Build with Hide Existence of Unauthorized Resources Enabled Fails with a 404 Error

By default, Maven supports preemptive authentication. This means that a given client will first send an unauthenticated request. Only after the server responds with a 401 response (as the resource requires authentication), will Maven send an authenticated request. In Artifactory, when the Hide Existence of Unauthorized Resources feature is enabled, the Maven client will receive a 404 response from Artifactory following the initial unauthenticated request instead of a 401 (due to the hidden resource). Once the 404 response has been returned to the Maven client, the expected authenticated request fails.

There are two ways to overcome this behavior:

  1. Via the UI, navigate to Admin tab > Security > Security Configuration and disable this feature. 

  2. Configure your Maven client to send preemptive authentications by adding credentials to your settings.xml file. For example:

    <server>
         <username>*****</username>
         <password>*****</password>
         <id>central</id>
         <configuration>
           <httpConfiguration>
             <all>
               <usePreemptive>true</usePreemptive>
             </all>
           </httpConfiguration>
         </configuration>
     </server>