title: eclipse maven deploy war to nexus OSS Access denied Error code 401, Unauthorized
body: <p>I want to upload the deployed war file from maven in eclipse to nexus OSS, but I get an error message.</p>
  
  <pre><code>Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project xxx: Failed to deploy artifacts: Could not transfer artifact com.xxx.xxx:xxx:war:5.2.0 from/to nexus (http://xxx.xxx.xxx.xxx:8081/repository/maven-releases/): Access denied to http://xxx.xxx.xxx.xxx:8081/repository/maven-releases/com/xxx/xxx/xxx/5.2.0/xxx-5.2.0.war. Error code 401, Unauthorized -&gt; [Help 1]
  </code></pre>
  
  <p>With the same configuration (<code>pom.xml</code> and <code>settings.xml</code>) I deploy a jar file and it works.</p>
  
  <p>The difference both of them are file type and file size.
  The one is a war file with 80mb and the other is a jar file with only 400kb.</p>
  
  <p>Does someone have ideas, how to solve this? are there configuration, those I miss? It was not happen 1 week ago. I don't change anything, only update the eclipse version from 2019 to 2020.</p>
  
  <p>Thank you</p>
  
  <pre><code>org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project xxx: Failed to deploy artifacts: Could not transfer artifact com.xxx.xxx:xxx:war:5.2.0 from/to nexus (http://192.168.xxx.xxx:8081/repository/maven-releases/): Access denied to http://192.168.xxx.xxx:8081/repository/maven-releases/com/xxx/xxx/xxx/5.2.0/xxx-5.2.0.war. Error code 401, Unauthorized
      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:215)
      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156)
      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
      at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
      at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
      at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
      at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
      at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305)
      at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
      at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
      at org.apache.maven.cli.MavenCli.execute(MavenCli.java:957)
      at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:289)
      at org.apache.maven.cli.MavenCli.main(MavenCli.java:193)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:498)
      at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:282)
      at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225)
      at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406)
      at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)
  Caused by: org.apache.maven.plugin.MojoExecutionException: Failed to deploy artifacts: Could not transfer artifact com.xxx.xxx:xxx:war:5.2.0 from/to nexus (http://192.168.xxx.xxx:8081/repository/maven-releases/): Access denied to http://192.168.xxx.xxx:8081/repository/maven-releases/com/xxx/xxx/xxx/5.2.0/xxx-5.2.0.war. Error code 401, Unauthorized
      at org.apache.maven.plugin.deploy.DeployMojo.execute(DeployMojo.java:193)
      at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210)
      ... 20 more
  Caused by: org.apache.maven.artifact.deployer.ArtifactDeploymentException: Failed to deploy artifacts: Could not transfer artifact com.xxx.xxx:xxx:war:5.2.0 from/to nexus (http://192.168.xxx.xxx:8081/repository/maven-releases/): Access denied to http://192.168.xxx.xxx:8081/repository/maven-releases/com/xxx/xxx/xxx/5.2.0/xxx-5.2.0.war. Error code 401, Unauthorized
      at org.apache.maven.artifact.deployer.DefaultArtifactDeployer.deploy(DefaultArtifactDeployer.java:146)
      at org.apache.maven.plugin.deploy.AbstractDeployMojo.deploy(AbstractDeployMojo.java:167)
      at org.apache.maven.plugin.deploy.DeployMojo.execute(DeployMojo.java:157)
      ... 22 more
  Caused by: org.eclipse.aether.deployment.DeploymentException: Failed to deploy artifacts: Could not transfer artifact com.xxx.xxx:xxx:war:5.2.0 from/to nexus (http://192.168.xxx.xxx:8081/repository/maven-releases/): Access denied to http://192.168.xxx.xxx:8081/repository/maven-releases/com/xxx/xxx/xxx/5.2.0/xxx-5.2.0.war. Error code 401, Unauthorized
      at org.eclipse.aether.internal.impl.DefaultDeployer.deploy(DefaultDeployer.java:301)
      at org.eclipse.aether.internal.impl.DefaultDeployer.deploy(DefaultDeployer.java:213)
      at org.eclipse.aether.internal.impl.DefaultRepositorySystem.deploy(DefaultRepositorySystem.java:386)
      at org.apache.maven.artifact.deployer.DefaultArtifactDeployer.deploy(DefaultArtifactDeployer.java:142)
      ... 24 more
  Caused by: org.eclipse.aether.transfer.ArtifactTransferException: Could not transfer artifact com.xxx.xxx:xxx:war:5.2.0 from/to nexus (http://192.168.xxx.xxx:8081/repository/maven-releases/): Access denied to http://192.168.xxx.xxx:8081/repository/maven-releases/com/xxx/xxx/xxx/5.2.0/xxx-5.2.0.war. Error code 401, Unauthorized
      at io.takari.aether.connector.AetherRepositoryConnector$2.wrap(AetherRepositoryConnector.java:889)
      at io.takari.aether.connector.AetherRepositoryConnector$2.wrap(AetherRepositoryConnector.java:1)
      at io.takari.aether.connector.AetherRepositoryConnector$PutTask.flush(AetherRepositoryConnector.java:732)
      at io.takari.aether.connector.AetherRepositoryConnector.put(AetherRepositoryConnector.java:373)
      at org.eclipse.aether.internal.impl.DefaultDeployer.deploy(DefaultDeployer.java:295)
      ... 27 more
  Caused by: io.takari.aether.connector.AuthorizationException: Access denied to http://192.168.xxx.xxx:8081/repository/maven-releases/com/xxx/xxx/xxx/5.2.0/xxx-5.2.0.war. Error code 401, Unauthorized
      at io.takari.aether.connector.AetherRepositoryConnector.handleResponseCode(AetherRepositoryConnector.java:397)
      at io.takari.aether.connector.AetherRepositoryConnector.access$8(AetherRepositoryConnector.java:391)
      at io.takari.aether.connector.AetherRepositoryConnector$PutTask.run(AetherRepositoryConnector.java:703)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      at java.lang.Thread.run(Thread.java:748)
  </code></pre>
  
  <p>pom.xml</p>
  
  <pre><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
  
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
      &lt;groupId&gt;com.xxx.xxx&lt;/groupId&gt;
      &lt;artifactId&gt;xxxxxx&lt;/artifactId&gt;
      &lt;packaging&gt;war&lt;/packaging&gt;
      &lt;version&gt;1.0.0&lt;/version&gt;
      &lt;name&gt;xxx xxx Maven Webapp&lt;/name&gt;
      &lt;url&gt;http://maven.apache.org&lt;/url&gt;
  
      &lt;distributionManagement&gt;
          &lt;repository&gt;
              &lt;id&gt;nexus&lt;/id&gt;
              &lt;url&gt;http://192.xxx.xxx.xxx:8081/repository/maven-releases/&lt;/url&gt;
          &lt;/repository&gt;
      &lt;/distributionManagement&gt;
  
      &lt;repositories&gt;
          &lt;repository&gt;
              &lt;id&gt;nexus&lt;/id&gt;
              &lt;name&gt;Nexus OSS Internal Repository&lt;/name&gt;
              &lt;url&gt;http://192.xxx.xxx.xxx:8081/repository/maven-public/&lt;/url&gt;
              &lt;releases&gt;
                  &lt;enabled&gt;true&lt;/enabled&gt;
              &lt;/releases&gt;
              &lt;snapshots&gt;
                  &lt;enabled&gt;false&lt;/enabled&gt;
              &lt;/snapshots&gt;
          &lt;/repository&gt;
      &lt;/repositories&gt;
      &lt;pluginRepositories&gt;
          &lt;pluginRepository&gt;
              &lt;id&gt;nexus&lt;/id&gt;
              &lt;name&gt;Nexus OSS Internal Repository&lt;/name&gt;
              &lt;url&gt;http://192.xxx.xxx.xxx:8081/repository/maven-public/&lt;/url&gt;
              &lt;releases&gt;
                  &lt;enabled&gt;true&lt;/enabled&gt;
              &lt;/releases&gt;
              &lt;snapshots&gt;
                  &lt;enabled&gt;false&lt;/enabled&gt;
              &lt;/snapshots&gt;
          &lt;/pluginRepository&gt;
      &lt;/pluginRepositories&gt;
  
      &lt;properties&gt;
  
          &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
          &lt;project.reporting.outputEncoding&gt;UTF-8&lt;/project.reporting.outputEncoding&gt;
  
          &lt;java.version&gt;1.8&lt;/java.version&gt;
  
          &lt;maven.test.skip&gt;true&lt;/maven.test.skip&gt;
      &lt;/properties&gt;
  
      &lt;dependencies&gt;
  
      &lt;/dependencies&gt;
  
      &lt;build&gt;
  
          &lt;finalName&gt;${project.artifactId}-${project.version}&lt;/finalName&gt;
          &lt;defaultGoal&gt;deploy&lt;/defaultGoal&gt;
  
          &lt;resources&gt;
              &lt;resource&gt;
                  &lt;directory&gt;src/main/resources&lt;/directory&gt;
                  &lt;filtering&gt;true&lt;/filtering&gt;
              &lt;/resource&gt;
          &lt;/resources&gt;
  
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
                  &lt;version&gt;3.8.0&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;source&gt;${java.version}&lt;/source&gt;
                      &lt;target&gt;${java.version}&lt;/target&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
  
      &lt;/build&gt;
  
  &lt;/project&gt;
  </code></pre>
  
  <p>setting.xml</p>
  
  <pre><code>    &lt;settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"&gt;
  
    &lt;localRepository&gt;Z:/maven/repository&lt;/localRepository&gt;
  
    &lt;pluginGroups&gt;
    &lt;/pluginGroups&gt;
    &lt;proxies&gt;
    &lt;/proxies&gt;
  
    &lt;servers&gt;
      &lt;server&gt;
        &lt;id&gt;nexus&lt;/id&gt;
        &lt;username&gt;user&lt;/username&gt;
        &lt;password&gt;password&lt;/password&gt;
      &lt;/server&gt;
    &lt;/servers&gt;
  
    &lt;mirrors&gt;
    &lt;/mirrors&gt;
  
    &lt;profiles&gt;
    &lt;/profiles&gt;
  
  &lt;/settings&gt;
  </code></pre>