First publish to Nexus OSS failed, access denied, ReasonPhrase:Forbidden

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

First publish to Nexus OSS failed, access denied, ReasonPhrase:Forbidden

Hu, Jirong

This is a brand new setup with both Maven and Nexus OSS in my local PC, everything new and there is nothing in Nexus yet. All settings are default and I haven't changed anything in Nexus. The user "deployment" should have full access to all repositories. 

I was running "mvn deploy" and expect the result show in Nexus OSS. Is it trying to downloading as the message show or uploading? 


[INFO] 
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ my-app --- 
[INFO] Building jar: C:\my-app\target\my-app-1.0-SNAPSHOT.jar 
[INFO] 
[INFO] --- maven-install-plugin:2.4:install (default-install) @ my-app --- 
[INFO] Installing C:\my-app\target\my-app-1.0-SNAPSHOT.jar to C:\Documents and Settings\jhu06\.m2\repository\com\mycompany\app\my-app\1.0-SNAPSHOT\my-app-1.0-SNAPSHOT.jar 
[INFO] Installing C:\my-app\pom.xml to C:\Documents and Settings\jhu06\.m2\repository\com\mycompany\app\my-app\1.0-SNAPSHOT\my-app-1.0-SNAPSHOT.pom 
[INFO] 
[INFO] --- maven-deploy-plugin:2.7:deploy (default-deploy) @ my-app --- 
Downloading: http://localhost:8081/nexus/content/repositories/snapshots/com/mycompany/app/my-app/1.0-SNAPSHOT/maven-metadata.xml
[WARNING] Could not transfer metadata com.mycompany.app:my-app:1.0-SNAPSHOT/maven-metadata.xml from/to snapshots (http:/
/localhost:8081/nexus/content/repositories/snapshots): Access denied to: 
http://localhost:8081/nexus/content/repositorie
s/snapshots/com/mycompany/app/my-app/1.0-SNAPSHOT/maven-metadata.xml , ReasonPhrase:Forbidden. 
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD FAILURE 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 2.312s 
[INFO] Finished at: Mon Jan 20 15:54:15 EST 2014 
[INFO] Final Memory: 11M/29M 
[INFO] ------------------------------------------------------------------------ 
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project my-ap 
p: Failed to retrieve remote metadata com.mycompany.app:my-app:1.0-SNAPSHOT/maven-metadata.xml: Could not transfer metad 
ata com.mycompany.app:my-app:1.0-SNAPSHOT/maven-metadata.xml from/to snapshots (
http://localhost:8081/nexus/content/repo
sitories/snapshots): Access denied to: 
http://localhost:8081/nexus/content/repositories/snapshots/com/mycompany/app/my-a
pp/1.0-SNAPSHOT/maven-metadata.xml , ReasonPhrase:Forbidden. -> [Help 1] 
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. 
[ERROR] Re-run Maven using the -X switch to enable full debug logging. 
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles: 
[ERROR] [Help 1] 
http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
C:\my-app> 


I have this in the default settings.xml:

    </server>
    --> 
        
        <server>
            <id>snapshots</id>
            <username>deployment</username>
            <password>deployment123</password>
        </server>
        <server>
            <id>releases</id>
            <username>deployment</username>
            <password>deployment123</password>
        </server>
        <server>
            <id>thirdparty</id>
            <username>deployment</username>
            <password>deployment123</password>
        </server>
    </servers>
</settings>

and this in the project pom.xml:

  <distributionManagement>
    <repository>
        <id>releases</id>
                <name>Internal Releases</name>
        <url>
http://localhost:8081/nexus/content/repositories/releases</url>
    </repository>
  
    <snapshotRepository>
        <id>snapshots</id>
        <name>Internal Snapshots</name>
        <url>
http://localhost:8081/nexus/content/repositories/snapshots</url>
    </snapshotRepository>
</distributionManagement>

Reply | Threaded
Open this post in threaded view
|

RE: First publish to Nexus OSS failed, access denied, ReasonPhrase:Forbidden

Nikola Milutinovic

Hi.

 

What does your Nexus setup looks like? Have you setup authorization on that repository in Nexus, allowing “deployer” to deploy to it? Is the password for that user the one you are using?

 

Since version 2.7.0 security is turned on by default, so maybe some additional steps are needed. We have a full blown configuration with Nexus+LDAP, so I do not recall what the default setup is.

 

Nix.

 

From: Hu, Jirong [mailto:[hidden email]]
Sent: Monday, January 20, 2014 10:28 PM
To: [hidden email]
Subject: [nexus-user] First publish to Nexus OSS failed, access denied, ReasonPhrase:Forbidden

 

This is a brand new setup with both Maven and Nexus OSS in my local PC, everything new and there is nothing in Nexus yet. All settings are default and I haven't changed anything in Nexus. The user "deployment" should have full access to all repositories. 

I was running "mvn deploy" and expect the result show in Nexus OSS. Is it trying to downloading as the message show or uploading? 


[INFO] 
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ my-app --- 
[INFO] Building jar: C:\my-app\target\my-app-1.0-SNAPSHOT.jar 
[INFO] 
[INFO] --- maven-install-plugin:2.4:install (default-install) @ my-app --- 
[INFO] Installing C:\my-app\target\my-app-1.0-SNAPSHOT.jar to C:\Documents and Settings\jhu06\.m2\repository\com\mycompany\app\my-app\1.0-SNAPSHOT\my-app-1.0-SNAPSHOT.jar 
[INFO] Installing C:\my-app\pom.xml to C:\Documents and Settings\jhu06\.m2\repository\com\mycompany\app\my-app\1.0-SNAPSHOT\my-app-1.0-SNAPSHOT.pom 
[INFO] 
[INFO] --- maven-deploy-plugin:2.7:deploy (default-deploy) @ my-app --- 
Downloading: http://localhost:8081/nexus/content/repositories/snapshots/com/mycompany/app/my-app/1.0-SNAPSHOT/maven-metadata.xml
[WARNING] Could not transfer metadata com.mycompany.app:my-app:1.0-SNAPSHOT/maven-metadata.xml from/to snapshots (http:/
/localhost:8081/nexus/content/repositories/snapshots): Access denied to: 
http://localhost:8081/nexus/content/repositorie
s/snapshots/com/mycompany/app/my-app/1.0-SNAPSHOT/maven-metadata.xml , ReasonPhrase:Forbidden. 
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD FAILURE 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 2.312s 
[INFO] Finished at: Mon Jan 20 15:54:15 EST 2014 
[INFO] Final Memory: 11M/29M 
[INFO] ------------------------------------------------------------------------ 
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project my-ap 
p: Failed to retrieve remote metadata com.mycompany.app:my-app:1.0-SNAPSHOT/maven-metadata.xml: Could not transfer metad 
ata com.mycompany.app:my-app:1.0-SNAPSHOT/maven-metadata.xml from/to snapshots (
http://localhost:8081/nexus/content/repo
sitories/snapshots): Access denied to: 
http://localhost:8081/nexus/content/repositories/snapshots/com/mycompany/app/my-a
pp/1.0-SNAPSHOT/maven-metadata.xml , ReasonPhrase:Forbidden. -> [Help 1] 
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. 
[ERROR] Re-run Maven using the -X switch to enable full debug logging. 
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles: 
[ERROR] [Help 1] 
http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
C:\my-app> 


I have this in the default settings.xml:

    </server>
    --> 
        
        <server>
            <id>snapshots</id>
            <username>deployment</username>
            <password>deployment123</password>
        </server>
        <server>
            <id>releases</id>
            <username>deployment</username>
            <password>deployment123</password>
        </server>
        <server>
            <id>thirdparty</id>
            <username>deployment</username>
            <password>deployment123</password>
        </server>
    </servers>
</settings>

and this in the project pom.xml:

  <distributionManagement>
    <repository>
        <id>releases</id>
                <name>Internal Releases</name>
        <url>
http://localhost:8081/nexus/content/repositories/releases</url>
    </repository>
  
    <snapshotRepository>
        <id>snapshots</id>
        <name>Internal Snapshots</name>
        <url>
http://localhost:8081/nexus/content/repositories/snapshots</url>
    </snapshotRepository>
</distributionManagement>

Reply | Threaded
Open this post in threaded view
|

Re: First publish to Nexus OSS failed, access denied, ReasonPhrase:Forbidden

Rich Seddon
The error indicates the user was authenticated, but doesn't have the necessary privileges. Make sure the ID in the distributionManagement section of your pom corresponds to a "server" section in your settings.xml which contains a user who has the necessary credentials to deploy to the snapshots repository.

You may want to run "mvn help:effective-pom" and "mvn help:effective-settings" to be sure what is being used.

Rich

Make sure the ID in you pom's distributionManagement section matches an ID in your settings.xml's servers section that 
On Jan 21, 2014, at 3:42 AM, Nikola Milutinovic <[hidden email]> wrote:

Hi.

 

What does your Nexus setup looks like? Have you setup authorization on that repository in Nexus, allowing “deployer” to deploy to it? Is the password for that user the one you are using?

 

Since version 2.7.0 security is turned on by default, so maybe some additional steps are needed. We have a full blown configuration with Nexus+LDAP, so I do not recall what the default setup is.

 

Nix.

 

From: Hu, Jirong [[hidden email]]
Sent: Monday, January 20, 2014 10:28 PM
To: [hidden email]
Subject: [nexus-user] First publish to Nexus OSS failed, access denied, ReasonPhrase:Forbidden

 

This is a brand new setup with both Maven and Nexus OSS in my local PC, everything new and there is nothing in Nexus yet. All settings are default and I haven't changed anything in Nexus. The user "deployment" should have full access to all repositories. 

I was running "mvn deploy" and expect the result show in Nexus OSS. Is it trying to downloading as the message show or uploading? 


[INFO] 
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ my-app --- 
[INFO] Building jar: C:\my-app\target\my-app-1.0-SNAPSHOT.jar 
[INFO] 
[INFO] --- maven-install-plugin:2.4:install (default-install) @ my-app --- 
[INFO] Installing C:\my-app\target\my-app-1.0-SNAPSHOT.jar to C:\Documents and Settings\jhu06\.m2\repository\com\mycompany\app\my-app\1.0-SNAPSHOT\my-app-1.0-SNAPSHOT.jar 
[INFO] Installing C:\my-app\pom.xml to C:\Documents and Settings\jhu06\.m2\repository\com\mycompany\app\my-app\1.0-SNAPSHOT\my-app-1.0-SNAPSHOT.pom 
[INFO] 
[INFO] --- maven-deploy-plugin:2.7:deploy (default-deploy) @ my-app --- 
Downloading: http://localhost:8081/nexus/content/repositories/snapshots/com/mycompany/app/my-app/1.0-SNAPSHOT/maven-metadata.xml
[WARNING] Could not transfer metadata com.mycompany.app:my-app:1.0-SNAPSHOT/maven-metadata.xml from/to snapshots (http:/
/localhost:8081/nexus/content/repositories/snapshots): Access denied to: 
http://localhost:8081/nexus/content/repositorie
s/snapshots/com/mycompany/app/my-app/1.0-SNAPSHOT/maven-metadata.xml , ReasonPhrase:Forbidden. 
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD FAILURE 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 2.312s 
[INFO] Finished at: Mon Jan 20 15:54:15 EST 2014 
[INFO] Final Memory: 11M/29M 
[INFO] ------------------------------------------------------------------------ 
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project my-ap 
p: Failed to retrieve remote metadata com.mycompany.app:my-app:1.0-SNAPSHOT/maven-metadata.xml: Could not transfer metad 
ata com.mycompany.app:my-app:1.0-SNAPSHOT/maven-metadata.xml from/to snapshots (
http://localhost:8081/nexus/content/repo
sitories/snapshots): Access denied to: 
http://localhost:8081/nexus/content/repositories/snapshots/com/mycompany/app/my-a
pp/1.0-SNAPSHOT/maven-metadata.xml , ReasonPhrase:Forbidden. -> [Help 1] 
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. 
[ERROR] Re-run Maven using the -X switch to enable full debug logging. 
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles: 
[ERROR] [Help 1] 
http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
C:\my-app> 


I have this in the default settings.xml:

    </server>
    --> 
        
        <server>
            <id>snapshots</id>
            <username>deployment</username>
            <password>deployment123</password>
        </server>
        <server>
            <id>releases</id>
            <username>deployment</username>
            <password>deployment123</password>
        </server>
        <server>
            <id>thirdparty</id>
            <username>deployment</username>
            <password>deployment123</password>
        </server>
    </servers>
</settings>

and this in the project pom.xml:

  <distributionManagement>
    <repository>
        <id>releases</id>
                <name>Internal Releases</name>
        <url>
http://localhost:8081/nexus/content/repositories/releases</url>
    </repository>
  
    <snapshotRepository>
        <id>snapshots</id>
        <name>Internal Snapshots</name>
        <url>
http://localhost:8081/nexus/content/repositories/snapshots</url>
    </snapshotRepository>
</distributionManagement>


Reply | Threaded
Open this post in threaded view
|

Re: First publish to Nexus OSS failed, access denied, ReasonPhrase:Forbidden

Rich Seddon
That looks OK.

Check your "deployment" user under "security/users" to see what roles & privileges they have.

Rich

On Jan 21, 2014, at 10:07 AM, Hu, Jirong <[hidden email]> wrote:

FYI: the mail got bounced back all the time when I reply to the [hidden email].

 

I’ve posted the pom.xml and settings.xml in my first post. I’ve tried even Nexus OSS 2.0, all the same result. I’ve used Nexus before. Must be something else.

 

<!-- ====================================================================== -->

<!--                                                                        -->

<!-- Effective POM for project 'com.mycompany.app:my-app:jar:1.0-SNAPSHOT'  -->

<!--                                                                        -->

<!-- ====================================================================== -->

 

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocat

ion="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

  <modelVersion>4.0.0</modelVersion>

  <groupId>com.mycompany.app</groupId>

  <artifactId>my-app</artifactId>

  <version>1.0-SNAPSHOT</version>

  <name>my-app</name>

  <url>http://maven.apache.org</url>

  <distributionManagement>

    <repository>

      <id>releases</id>

      <name>Internal Releases</name>

      <url>http://localhost:8081/nexus/content/repositories/releases</url>

    </repository>

    <snapshotRepository>

      <id>snapshots</id>

      <name>Internal Snapshots</name>

      <url>http://localhost:8081/nexus/content/repositories/snapshots</url>

    </snapshotRepository>

  </distributionManagement>

 

<!-- ====================================================================== -->

<!--                                                                        -->

<!-- Effective Settings for 'jhu06' on 'OCDT70302123'                       -->

<!--                                                                        -->

<!-- ====================================================================== -->

 

<settings xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLoca

tion="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd">

  <localRepository xmlns="http://maven.apache.org/SETTINGS/1.1.0">C:\Documents and Settings\jhu06\.m2\repository</localR

epository>

 <proxies xmlns="http://maven.apache.org/SETTINGS/1.1.0">

    <proxy>

      <username>office\jhu06</username>

      <password>***</password>

      <host>ebcswg.bmogc.net</host>

      <nonProxyHosts>local.net|some.host.com</nonProxyHosts>

      <id>optional</id>

    </proxy>

  </proxies>

  <servers xmlns="http://maven.apache.org/SETTINGS/1.1.0">

    <server>

      <username>deployment</username>

      <password>***</password>

      <id>snapshots</id>

    </server>

    <server>

      <username>deployment</username>

      <password>***</password>

      <id>releases</id>

    </server>

    <server>

      <username>deployment</username>

      <password>***</password>

      <id>thirdparty</id>

    </server>

  </servers>

  <pluginGroups xmlns="http://maven.apache.org/SETTINGS/1.1.0">

    <pluginGroup>org.apache.maven.plugins</pluginGroup>

    <pluginGroup>org.codehaus.mojo</pluginGroup>

  </pluginGroups>

</settings>

 

 

 

From: Richard Seddon [[hidden email]]
Sent: January 21, 2014 10:04 AM
To: [hidden email]
Subject: Re: [nexus-user] First publish to Nexus OSS failed, access denied, ReasonPhrase:Forbidden

 

The error indicates the user was authenticated, but doesn't have the necessary privileges. Make sure the ID in the distributionManagement section of your pom corresponds to a "server" section in your settings.xml which contains a user who has the necessary credentials to deploy to the snapshots repository.

 

You may want to run "mvn help:effective-pom" and "mvn help:effective-settings" to be sure what is being used.

 

Rich

 

Make sure the ID in you pom's distributionManagement section matches an ID in your settings.xml's servers section that 

On Jan 21, 2014, at 3:42 AM, Nikola Milutinovic <[hidden email]> wrote:



Hi.

 

What does your Nexus setup looks like? Have you setup authorization on that repository in Nexus, allowing “deployer” to deploy to it? Is the password for that user the one you are using?

 

Since version 2.7.0 security is turned on by default, so maybe some additional steps are needed. We have a full blown configuration with Nexus+LDAP, so I do not recall what the default setup is.

 

Nix.

 

From: Hu, Jirong [[hidden email]]
Sent: Monday, January 20, 2014 10:28 PM
To: [hidden email]
Subject: [nexus-user] First publish to Nexus OSS failed, access denied, ReasonPhrase:Forbidden

 

This is a brand new setup with both Maven and Nexus OSS in my local PC, everything new and there is nothing in Nexus yet. All settings are default and I haven't changed anything in Nexus. The user "deployment" should have full access to all repositories. 

I was running "mvn deploy" and expect the result show in Nexus OSS. Is it trying to downloading as the message show or uploading? 


[INFO] 
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ my-app --- 
[INFO] Building jar: C:\my-app\target\my-app-1.0-SNAPSHOT.jar 
[INFO] 
[INFO] --- maven-install-plugin:2.4:install (default-install) @ my-app --- 
[INFO] Installing C:\my-app\target\my-app-1.0-SNAPSHOT.jar to C:\Documents and Settings\jhu06\.m2\repository\com\mycompany\app\my-app\1.0-SNAPSHOT\my-app-1.0-SNAPSHOT.jar 
[INFO] Installing C:\my-app\pom.xml to C:\Documents and Settings\jhu06\.m2\repository\com\mycompany\app\my-app\1.0-SNAPSHOT\my-app-1.0-SNAPSHOT.pom 
[INFO] 
[INFO] --- maven-deploy-plugin:2.7:deploy (default-deploy) @ my-app --- 
Downloading: http://localhost:8081/nexus/content/repositories/snapshots/com/mycompany/app/my-app/1.0-SNAPSHOT/maven-metadata.xml
[WARNING] Could not transfer metadata com.mycompany.app:my-app:1.0-SNAPSHOT/maven-metadata.xml from/to snapshots (http:/
/localhost:8081/nexus/content/repositories/snapshots): Access denied to: 
http://localhost:8081/nexus/content/repositorie
s/snapshots/com/mycompany/app/my-app/1.0-SNAPSHOT/maven-metadata.xml , ReasonPhrase:Forbidden. 
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD FAILURE 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 2.312s 
[INFO] Finished at: Mon Jan 20 15:54:15 EST 2014 
[INFO] Final Memory: 11M/29M 
[INFO] ------------------------------------------------------------------------ 
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project my-ap 
p: Failed to retrieve remote metadata com.mycompany.app:my-app:1.0-SNAPSHOT/maven-metadata.xml: Could not transfer metad 
ata com.mycompany.app:my-app:1.0-SNAPSHOT/maven-metadata.xml from/to snapshots (
http://localhost:8081/nexus/content/repo
sitories/snapshots): Access denied to: 
http://localhost:8081/nexus/content/repositories/snapshots/com/mycompany/app/my-a
pp/1.0-SNAPSHOT/maven-metadata.xml , ReasonPhrase:Forbidden. -> [Help 1] 
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. 
[ERROR] Re-run Maven using the -X switch to enable full debug logging. 
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles: 
[ERROR] [Help 1] 
http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
C:\my-app> 


I have this in the default settings.xml:

    </server>
    --> 
        
        <server>
            <id>snapshots</id>
            <username>deployment</username>
            <password>deployment123</password>
        </server>
        <server>
            <id>releases</id>
            <username>deployment</username>
            <password>deployment123</password>
        </server>
        <server>
            <id>thirdparty</id>
            <username>deployment</username>
            <password>deployment123</password>
        </server>
    </servers>
</settings>

and this in the project pom.xml:

  <distributionManagement>
    <repository>
        <id>releases</id>
                <name>Internal Releases</name>
        <url>
http://localhost:8081/nexus/content/repositories/releases</url>
    </repository>
  
    <snapshotRepository>
        <id>snapshots</id>
        <name>Internal Snapshots</name>
        <url>
http://localhost:8081/nexus/content/repositories/snapshots</url>
    </snapshotRepository>
</distributionManagement>

 


Reply | Threaded
Open this post in threaded view
|

Re: First publish to Nexus OSS failed, access denied, ReasonPhrase:Forbidden

Rich Seddon
It could be your http proxy server that is rejecting this.

Try adding localhost to the nonProxyHosts config.

Rich

On Jan 21, 2014, at 12:41 PM, Hu, Jirong <[hidden email]> wrote:

Thanks for your help.

 

I didn’t do anything after the default install in my PC. I tried using admin/admin123, using Nexus 2.0, all the same result. I didn’t use Tomcat but install as this:

 

C:\Tools\nexus-2.7.0-bundle\nexus-2.7.0-06\bin>nexus install

wrapper  | nexus installed.

C:\Tools\nexus-2.7.0-bundle\nexus-2.7.0-06\bin>nexus start

wrapper  | Starting the nexus service...

wrapper  | Waiting to start...

wrapper  | nexus started.

C:\Tools\nexus-2.7.0-bundle\nexus-2.7.0-06\bin>

 

This is what it shows:

 

<image001.png>

 

From: Richard Seddon [[hidden email]]
Sent: January 21, 2014 1:36 PM
To: Hu, Jirong
Cc: [hidden email]
Subject: Re: [nexus-user] First publish to Nexus OSS failed, access denied, ReasonPhrase:Forbidden

 

That looks OK.

 

Check your "deployment" user under "security/users" to see what roles & privileges they have.

 

Rich

 

On Jan 21, 2014, at 10:07 AM, Hu, Jirong <[hidden email]> wrote:



FYI: the mail got bounced back all the time when I reply to the [hidden email].

 

I’ve posted the pom.xml and settings.xml in my first post. I’ve tried even Nexus OSS 2.0, all the same result. I’ve used Nexus before. Must be something else.

 

<!-- ====================================================================== -->

<!--                                                                        -->

<!-- Effective POM for project 'com.mycompany.app:my-app:jar:1.0-SNAPSHOT'  -->

<!--                                                                        -->

<!-- ====================================================================== -->

 

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocat

ion="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

  <modelVersion>4.0.0</modelVersion>

  <groupId>com.mycompany.app</groupId>

  <artifactId>my-app</artifactId>

  <version>1.0-SNAPSHOT</version>

  <name>my-app</name>

  <url>http://maven.apache.org</url>

  <distributionManagement>

    <repository>

      <id>releases</id>

      <name>Internal Releases</name>

      <url>http://localhost:8081/nexus/content/repositories/releases</url>

    </repository>

    <snapshotRepository>

      <id>snapshots</id>

      <name>Internal Snapshots</name>

      <url>http://localhost:8081/nexus/content/repositories/snapshots</url>

    </snapshotRepository>

  </distributionManagement>

 

<!-- ====================================================================== -->

<!--                                                                        -->

<!-- Effective Settings for 'jhu06' on 'OCDT70302123'                       -->

<!--                                                                        -->

<!-- ====================================================================== -->

 

<settings xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLoca

tion="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd">

  <localRepository xmlns="http://maven.apache.org/SETTINGS/1.1.0">C:\Documents and Settings\jhu06\.m2\repository</localR

epository>

 <proxies xmlns="http://maven.apache.org/SETTINGS/1.1.0">

    <proxy>

      <username>office\jhu06</username>

      <password>***</password>

      <host>ebcswg.bmogc.net</host>

      <nonProxyHosts>local.net|some.host.com</nonProxyHosts>

      <id>optional</id>

    </proxy>

  </proxies>

  <servers xmlns="http://maven.apache.org/SETTINGS/1.1.0">

    <server>

      <username>deployment</username>

      <password>***</password>

      <id>snapshots</id>

    </server>

    <server>

      <username>deployment</username>

      <password>***</password>

      <id>releases</id>

    </server>

    <server>

      <username>deployment</username>

      <password>***</password>

      <id>thirdparty</id>

    </server>

  </servers>

  <pluginGroups xmlns="http://maven.apache.org/SETTINGS/1.1.0">

    <pluginGroup>org.apache.maven.plugins</pluginGroup>

    <pluginGroup>org.codehaus.mojo</pluginGroup>

  </pluginGroups>

</settings>

 

 

 

From: Richard Seddon [[hidden email]]
Sent: January 21, 2014 10:04 AM
To: [hidden email]
Subject: Re: [nexus-user] First publish to Nexus OSS failed, access denied, ReasonPhrase:Forbidden

 

The error indicates the user was authenticated, but doesn't have the necessary privileges. Make sure the ID in the distributionManagement section of your pom corresponds to a "server" section in your settings.xml which contains a user who has the necessary credentials to deploy to the snapshots repository.

 

You may want to run "mvn help:effective-pom" and "mvn help:effective-settings" to be sure what is being used.

 

Rich

 

Make sure the ID in you pom's distributionManagement section matches an ID in your settings.xml's servers section that 

On Jan 21, 2014, at 3:42 AM, Nikola Milutinovic <[hidden email]> wrote:




Hi.

 

What does your Nexus setup looks like? Have you setup authorization on that repository in Nexus, allowing “deployer” to deploy to it? Is the password for that user the one you are using?

 

Since version 2.7.0 security is turned on by default, so maybe some additional steps are needed. We have a full blown configuration with Nexus+LDAP, so I do not recall what the default setup is.

 

Nix.

 

From: Hu, Jirong [[hidden email]]
Sent: Monday, January 20, 2014 10:28 PM
To: [hidden email]
Subject: [nexus-user] First publish to Nexus OSS failed, access denied, ReasonPhrase:Forbidden

 

This is a brand new setup with both Maven and Nexus OSS in my local PC, everything new and there is nothing in Nexus yet. All settings are default and I haven't changed anything in Nexus. The user "deployment" should have full access to all repositories. 

I was running "mvn deploy" and expect the result show in Nexus OSS. Is it trying to downloading as the message show or uploading? 


[INFO] 
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ my-app --- 
[INFO] Building jar: C:\my-app\target\my-app-1.0-SNAPSHOT.jar 
[INFO] 
[INFO] --- maven-install-plugin:2.4:install (default-install) @ my-app --- 
[INFO] Installing C:\my-app\target\my-app-1.0-SNAPSHOT.jar to C:\Documents and Settings\jhu06\.m2\repository\com\mycompany\app\my-app\1.0-SNAPSHOT\my-app-1.0-SNAPSHOT.jar 
[INFO] Installing C:\my-app\pom.xml to C:\Documents and Settings\jhu06\.m2\repository\com\mycompany\app\my-app\1.0-SNAPSHOT\my-app-1.0-SNAPSHOT.pom 
[INFO] 
[INFO] --- maven-deploy-plugin:2.7:deploy (default-deploy) @ my-app --- 
Downloading: http://localhost:8081/nexus/content/repositories/snapshots/com/mycompany/app/my-app/1.0-SNAPSHOT/maven-metadata.xml
[WARNING] Could not transfer metadata com.mycompany.app:my-app:1.0-SNAPSHOT/maven-metadata.xml from/to snapshots (http:/
/localhost:8081/nexus/content/repositories/snapshots): Access denied to: 
http://localhost:8081/nexus/content/repositorie
s/snapshots/com/mycompany/app/my-app/1.0-SNAPSHOT/maven-metadata.xml , ReasonPhrase:Forbidden. 
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD FAILURE 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 2.312s 
[INFO] Finished at: Mon Jan 20 15:54:15 EST 2014 
[INFO] Final Memory: 11M/29M 
[INFO] ------------------------------------------------------------------------ 
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project my-ap 
p: Failed to retrieve remote metadata com.mycompany.app:my-app:1.0-SNAPSHOT/maven-metadata.xml: Could not transfer metad 
ata com.mycompany.app:my-app:1.0-SNAPSHOT/maven-metadata.xml from/to snapshots (
http://localhost:8081/nexus/content/repo
sitories/snapshots): Access denied to: 
http://localhost:8081/nexus/content/repositories/snapshots/com/mycompany/app/my-a
pp/1.0-SNAPSHOT/maven-metadata.xml , ReasonPhrase:Forbidden. -> [Help 1] 
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. 
[ERROR] Re-run Maven using the -X switch to enable full debug logging. 
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles: 
[ERROR] [Help 1] 
http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
C:\my-app> 


I have this in the default settings.xml:

    </server>
    --> 
        
        <server>
            <id>snapshots</id>
            <username>deployment</username>
            <password>deployment123</password>
        </server>
        <server>
            <id>releases</id>
            <username>deployment</username>
            <password>deployment123</password>
        </server>
        <server>
            <id>thirdparty</id>
            <username>deployment</username>
            <password>deployment123</password>
        </server>
    </servers>
</settings>

and this in the project pom.xml:

  <distributionManagement>
    <repository>
        <id>releases</id>
                <name>Internal Releases</name>
        <url>
http://localhost:8081/nexus/content/repositories/releases</url>
    </repository>
  
    <snapshotRepository>
        <id>snapshots</id>
        <name>Internal Snapshots</name>
        <url>
http://localhost:8081/nexus/content/repositories/snapshots</url>
    </snapshotRepository>
</distributionManagement>