title: Maven deployment location vs download location
body: <p>I have a problem setting up things correctly; my end goal is to pull artifacts from one nexus (I'm going to refer to it as Nexus1) and deploy to another nexus (Nexus2), two are hosted in different locations with different domains.</p>
  
  <p>Here's my settings.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &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;distributionManagement&gt;
    &lt;repository&gt;
       &lt;id&gt;deployment&lt;/id&gt;
       &lt;name&gt;Internal Releases&lt;/name&gt;
       &lt;url&gt;http://Nexus2/content/repositories/releases/&lt;/url&gt;
    &lt;/repository&gt;
    &lt;snapshotRepository&gt;
       &lt;id&gt;deployment&lt;/id&gt;
       &lt;name&gt;Internal Releases&lt;/name&gt;
       &lt;url&gt;http://Nexus2/content/repositories/snapshots/&lt;/url&gt;
    &lt;/snapshotRepository&gt;
  &lt;/distributionManagement&gt;
    &lt;mirrors&gt;
      &lt;mirror&gt;
        &lt;id&gt;company-central&lt;/id&gt;
        &lt;name&gt;CompanyCentral&lt;/name&gt;
        &lt;url&gt;http://Nexus1/content/groups/public/&lt;/url&gt;
        &lt;mirrorOf&gt;central&lt;/mirrorOf&gt;
      &lt;/mirror&gt;
    &lt;/mirrors&gt;
    &lt;profiles&gt;
      &lt;profile&gt;
        &lt;id&gt;default-repositories&lt;/id&gt;
        &lt;activation&gt;
          &lt;activeByDefault&gt;true&lt;/activeByDefault&gt;
        &lt;/activation&gt;
        &lt;repositories&gt;
          &lt;repository&gt;
            &lt;id&gt;core-releases&lt;/id&gt;
            &lt;url&gt;http://Nexus1/content/repositories/core-release&lt;/url&gt;
            &lt;releases&gt;
              &lt;enabled&gt;true&lt;/enabled&gt;
              &lt;checksumPolicy&gt;fail&lt;/checksumPolicy&gt;
            &lt;/releases&gt;
            &lt;snapshots&gt;
              &lt;enabled&gt;false&lt;/enabled&gt;
            &lt;/snapshots&gt;
          &lt;/repository&gt;
          &lt;repository&gt;
            &lt;id&gt;core-snapshots&lt;/id&gt;
            &lt;url&gt;http://Nexus1/content/repositories/core-snapshot&lt;/url&gt;
            &lt;releases&gt;
              &lt;enabled&gt;false&lt;/enabled&gt;
            &lt;/releases&gt;
            &lt;snapshots&gt;
              &lt;enabled&gt;true&lt;/enabled&gt;
              &lt;checksumPolicy&gt;fail&lt;/checksumPolicy&gt;
            &lt;/snapshots&gt;
          &lt;/repository&gt;
          &lt;repository&gt;
            &lt;id&gt;releases&lt;/id&gt;
            &lt;url&gt;http://Nexus1/content/repositories/releases&lt;/url&gt;
            &lt;releases&gt;
              &lt;enabled&gt;true&lt;/enabled&gt;
              &lt;checksumPolicy&gt;fail&lt;/checksumPolicy&gt;
            &lt;/releases&gt;
            &lt;snapshots&gt;
              &lt;enabled&gt;false&lt;/enabled&gt;
            &lt;/snapshots&gt;
          &lt;/repository&gt;
          &lt;repository&gt;
            &lt;id&gt;snapshots&lt;/id&gt;
            &lt;url&gt;http://Nexus1/content/repositories/snapshots&lt;/url&gt;
            &lt;releases&gt;
              &lt;enabled&gt;false&lt;/enabled&gt;
            &lt;/releases&gt;
            &lt;snapshots&gt;
              &lt;enabled&gt;true&lt;/enabled&gt;
              &lt;checksumPolicy&gt;fail&lt;/checksumPolicy&gt;
            &lt;/snapshots&gt;
          &lt;/repository&gt;
        &lt;/repositories&gt;
      &lt;/profile&gt;
      &lt;profile&gt;
           &lt;id&gt;inject-liferay-properties&lt;/id&gt;
           &lt;properties&gt;
             &lt;liferay.auto.deploy.dir.val&gt;/Users/dmadathil/Documents/Portal/workspace/X-Portal-11.0.0/bundles/deploy&lt;/liferay.auto.deploy.dir.val&gt;
             &lt;liferay.app.server.deploy.dir.val&gt;/Users/dmadathil/Documents/Portal/workspace/X-Portal-11.0.0/bundles&lt;/liferay.app.server.deploy.dir.val&gt;
             &lt;liferay.app.server.lib.global.dir.val&gt;/Users/dmadathil/Documents/Portal/workspace/X-Portal-11.0.0/bundles/tomcat-7.0.42/lib&lt;/liferay.app.server.lib.global.dir.val&gt;
             &lt;liferay.app.server.portal.dir.val&gt;/Users/dmadathil/Documents/Portal/workspace/X-Portal-11.0.0/bundles/tomcat-7.0.42/webapps/ROOT&lt;/liferay.app.server.portal.dir.val&gt;
           &lt;/properties&gt;
       &lt;/profile&gt;    
   &lt;/profiles&gt;
   &lt;activeProfiles&gt;
     &lt;activeProfile&gt;inject-liferay-properties&lt;/activeProfile&gt;
   &lt;/activeProfiles&gt;
  &lt;/settings&gt;
  </code></pre>
  
  <p>And here's my 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;parent&gt;
          &lt;groupId&gt;com.company&lt;/groupId&gt;
          &lt;artifactId&gt;super-pom&lt;/artifactId&gt;
          &lt;version&gt;1.1.0&lt;/version&gt;
      &lt;/parent&gt;
  
      &lt;artifactId&gt;covlogs&lt;/artifactId&gt;
      &lt;version&gt;0.0.2-SNAPSHOT&lt;/version&gt;
  
      &lt;dependencies&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
  
              &lt;exclusions&gt;
                  &lt;exclusion&gt;
                      &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
                      &lt;artifactId&gt;log4j-over-slf4j&lt;/artifactId&gt;
                  &lt;/exclusion&gt;
                  &lt;exclusion&gt;
                      &lt;groupId&gt;ch.qos.logback&lt;/groupId&gt;
                      &lt;artifactId&gt;logback-classic&lt;/artifactId&gt;
                  &lt;/exclusion&gt;
              &lt;/exclusions&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-starter-test&lt;/artifactId&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
              &lt;artifactId&gt;slf4j-log4j12&lt;/artifactId&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;com.company.platform.group.client&lt;/groupId&gt;
              &lt;artifactId&gt;group-client&lt;/artifactId&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;com.company.platform.user.client&lt;/groupId&gt;
              &lt;artifactId&gt;user-client&lt;/artifactId&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;junit&lt;/groupId&gt;
              &lt;artifactId&gt;junit&lt;/artifactId&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.mockito&lt;/groupId&gt;
              &lt;artifactId&gt;mockito-all&lt;/artifactId&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.json&lt;/groupId&gt;
              &lt;artifactId&gt;json&lt;/artifactId&gt;
          &lt;/dependency&gt;
  
      &lt;/dependencies&gt;
  
  
      &lt;dependencyManagement&gt;
          &lt;dependencies&gt;
  
              &lt;dependency&gt;
                  &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
                  &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
                  &lt;version&gt;1.2.5.RELEASE&lt;/version&gt;
              &lt;/dependency&gt;
  
              &lt;dependency&gt;
                  &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
                  &lt;artifactId&gt;spring-boot-starter-test&lt;/artifactId&gt;
                  &lt;version&gt;1.2.5.RELEASE&lt;/version&gt;
              &lt;/dependency&gt;
  
              &lt;dependency&gt;
                  &lt;groupId&gt;com.company.core&lt;/groupId&gt;
                  &lt;artifactId&gt;slf4j-bom&lt;/artifactId&gt;
                  &lt;version&gt;1.7.12&lt;/version&gt;
                  &lt;type&gt;pom&lt;/type&gt;
                  &lt;scope&gt;import&lt;/scope&gt;
              &lt;/dependency&gt;
  
              &lt;dependency&gt;
                  &lt;groupId&gt;com.company.platform.group.client&lt;/groupId&gt;
                  &lt;artifactId&gt;group-client&lt;/artifactId&gt;
                  &lt;version&gt;1.1.0.RELEASE&lt;/version&gt;
              &lt;/dependency&gt;
  
              &lt;dependency&gt;
                  &lt;groupId&gt;com.company.platform.user.client&lt;/groupId&gt;
                  &lt;artifactId&gt;user-client&lt;/artifactId&gt;
                  &lt;version&gt;1.0.0.RELEASE&lt;/version&gt;
              &lt;/dependency&gt;
  
              &lt;dependency&gt;
                  &lt;groupId&gt;junit&lt;/groupId&gt;
                  &lt;artifactId&gt;junit&lt;/artifactId&gt;
                  &lt;version&gt;4.9&lt;/version&gt;
                  &lt;scope&gt;test&lt;/scope&gt;
              &lt;/dependency&gt;
  
              &lt;dependency&gt;
                  &lt;groupId&gt;org.json&lt;/groupId&gt;
                  &lt;artifactId&gt;json&lt;/artifactId&gt;
                  &lt;version&gt;20141113&lt;/version&gt;
              &lt;/dependency&gt;
  
          &lt;/dependencies&gt;
      &lt;/dependencyManagement&gt;
  
  
      &lt;build&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
                  &lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;
                  &lt;executions&gt;
                      &lt;execution&gt;
                          &lt;goals&gt;
                              &lt;goal&gt;repackage&lt;/goal&gt;
                          &lt;/goals&gt;
                      &lt;/execution&gt;
                  &lt;/executions&gt;
              &lt;/plugin&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-deploy-plugin&lt;/artifactId&gt;
                  &lt;version&gt;2.8.2&lt;/version&gt;
              &lt;/plugin&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.jacoco&lt;/groupId&gt;
                  &lt;artifactId&gt;jacoco-maven-plugin&lt;/artifactId&gt;
                  &lt;version&gt;0.7.4.201502262128&lt;/version&gt;
                  &lt;executions&gt;
                      &lt;execution&gt;
                          &lt;id&gt;pre-unit-test&lt;/id&gt;
                          &lt;goals&gt;
                              &lt;goal&gt;prepare-agent&lt;/goal&gt;
                          &lt;/goals&gt;
                      &lt;/execution&gt;
                      &lt;execution&gt;
                          &lt;id&gt;post-unit-test&lt;/id&gt;
                          &lt;phase&gt;test&lt;/phase&gt;
                          &lt;goals&gt;
                              &lt;goal&gt;report&lt;/goal&gt;
                          &lt;/goals&gt;
                      &lt;/execution&gt;
                  &lt;/executions&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  
      &lt;repositories&gt;
          &lt;repository&gt;
              &lt;id&gt;spring-releases&lt;/id&gt;
              &lt;url&gt;https://repo.spring.io/libs-release&lt;/url&gt;
          &lt;/repository&gt;
          &lt;!--&lt;repository&gt;
              &lt;id&gt;core-releases&lt;/id&gt;
              &lt;url&gt;http://Nexus1/content/repositories/core-release&lt;/url&gt;
              &lt;snapshots&gt;
                  &lt;enabled&gt;false&lt;/enabled&gt;
              &lt;/snapshots&gt;
          &lt;/repository&gt;
          &lt;repository&gt;
              &lt;id&gt;core-snapshots&lt;/id&gt;
              &lt;url&gt;http://Nexus1/content/repositories/core-snapshot&lt;/url&gt;
              &lt;releases&gt;
                  &lt;enabled&gt;false&lt;/enabled&gt;
              &lt;/releases&gt;
          &lt;/repository&gt;
          &lt;repository&gt;
              &lt;id&gt;releases&lt;/id&gt;
              &lt;url&gt;http://Nexus1/content/repositories/releases&lt;/url&gt;
              &lt;snapshots&gt;
                  &lt;enabled&gt;false&lt;/enabled&gt;
              &lt;/snapshots&gt;
          &lt;/repository&gt;
          &lt;repository&gt;
              &lt;id&gt;snapshots&lt;/id&gt;
              &lt;url&gt;http://Nexus1/content/repositories/snapshots&lt;/url&gt;
              &lt;releases&gt;
                  &lt;enabled&gt;false&lt;/enabled&gt;
              &lt;/releases&gt;
          &lt;/repository&gt;--&gt;
      &lt;/repositories&gt;
  
      &lt;pluginRepositories&gt;
          &lt;pluginRepository&gt;
              &lt;id&gt;spring-releases&lt;/id&gt;
              &lt;url&gt;https://repo.spring.io/libs-release&lt;/url&gt;
          &lt;/pluginRepository&gt;
      &lt;/pluginRepositories&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>The problem that I'm facing is that every time I build the project it still tries to upload to Nexus1 instead of Nexus2!!</p>
  
  <p>EDIT: Here's a sample error message from Jenkins' output console:</p>
  
  <pre><code>ERROR: Failed to deploy artifacts: Could not transfer artifact com.company:covlogs:jar:0.0.2-20150928.201829-1 from/to snapshots (http://Nexus1/content/repositories/core-snapshot/): Failed to transfer file: http://Nexus1/content/repositories/core-snapshot/com/company/covlogs/0.0.2-SNAPSHOT/covlogs-0.0.2-20150928.201829-1.jar. Return code is: 401, ReasonPhrase: Unauthorized.
  </code></pre>
  
  <p>I'm still new to maven, and I'm not sure what's going wrong. I've been banging my head for a couple of days now on this.</p>
  
  <p>Any help would be greatly appreciated!</p>
  
  <p>EDIT2: Steps I've taken, I've added the <code>&lt;distributionManagement&gt;</code> block hoping it would fix the issue, but that didn't work.</p>
  
  <p>I've also added <code>maven-deploy-plugin</code> to pom.xml, but that didn't do anything either.</p>
  
  <p>EDIT3: For Jenkins I'm using Maven Release plug-in to setup where I want the artifacts to be deployed to:</p>
  
  <p><a href="https://i.stack.imgur.com/yiIpO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yiIpO.png" alt="enter image description here"></a></p>