Deploying artifacts to Nexus gives "Error retrieving previous build .."

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Deploying artifacts to Nexus gives "Error retrieving previous build .."

prankris
Hi all,

When I deploy artifacts to nexus snapshots repository, I am getting "Error retrieving previous build number for artifact 'com.mycompany.sec:sampleproj:jar': repository metadata for: 'snapshot com.mycompany.sec:sampleproj:1.0-SNAPSHOT' could not be retrieved from repository: snapshots due to an error: Authorization failed: Access denied to: http://remoteserver:8080/nexus/content/repositories/snapshots/com/mycompany/sec/sampleproj/1.0-SNAPSHOT/maven-metadata.xml".

I'm using maven 2.2.1, nexus v1.9.1.1, glassfish 3.0.1, JDK 1.6.0_23
However, when I make the security settings to OFF under Administration -> Server, then I am not getting the above error.
I am deploying to nexus using deployment user.

Following is the error using -e switch

NetBeans: Executing 'C:\apache-maven-2.2.1\bin\mvn.bat -Dnetbeans.execution=true -Dmaven.repo.local=C:\Documents and Settings\username\.m2\repository -e deploy'
NetBeans:      JAVA_HOME=C:\Program Files\Java\jdk1.6.0_23
+ Error stacktraces are turned on.
Scanning for projects...
------------------------------------------------------------------------
Building Sampleproj
   task-segment: [deploy]
------------------------------------------------------------------------
[resources:resources]
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
Copying 0 resource
[compiler:compile]
Nothing to compile - all classes are up to date
[resources:testResources]
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
skip non existing resourceDirectory C:\WorkspaceNetBeans\Sampleproj\src\test\resources
[compiler:testCompile]
Nothing to compile - all classes are up to date
[surefire:test]
No tests to run.
[jar:jar]
[install:install]
Installing C:\WorkspaceNetBeans\Sampleproj\target\sampleproj-1.0-SNAPSHOT.jar to C:\Documents and Settings\username\.m2\repository\com\mycompany\sec\sampleproj\1.0-SNAPSHOT\sampleproj-1.0-SNAPSHOT.jar
[deploy:deploy]
Retrieving previous build number from snapshots
------------------------------------------------------------------------
[ERROR]BUILD ERROR
------------------------------------------------------------------------
Error retrieving previous build number for artifact 'com.mycompany.sec:sampleproj:jar': repository metadata for: 'snapshot com.mycompany.sec:sampleproj:1.0-SNAPSHOT' could not be retrieved from repository: snapshots due to an error: Authorization failed: Access denied to: http://remoteserver:8080/nexus/content/repositories/snapshots/com/mycompany/sec/sampleproj/1.0-SNAPSHOT/maven-metadata.xml

------------------------------------------------------------------------
Trace
org.apache.maven.lifecycle.LifecycleExecutionException: Error retrieving previous build number for artifact 'com.mycompany.sec:sampleproj:jar': repository metadata for: 'snapshot com.mycompany.sec:sampleproj:1.0-SNAPSHOT' could not be retrieved from repository: snapshots due to an error: Authorization failed: Access denied to: http://remoteserver:8080/nexus/content/repositories/snapshots/com/mycompany/sec/sampleproj/1.0-SNAPSHOT/maven-metadata.xml
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:719)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
        at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
        at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.MojoExecutionException: Error retrieving previous build number for artifact 'com.mycompany.sec:sampleproj:jar': repository metadata for: 'snapshot com.mycompany.sec:sampleproj:1.0-SNAPSHOT' could not be retrieved from repository: snapshots due to an error: Authorization failed: Access denied to: http://remoteserver:8080/nexus/content/repositories/snapshots/com/mycompany/sec/sampleproj/1.0-SNAPSHOT/maven-metadata.xml
        at org.apache.maven.plugin.deploy.DeployMojo.execute(DeployMojo.java:195)
        at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
        ... 17 more
Caused by: org.apache.maven.artifact.deployer.ArtifactDeploymentException: Error retrieving previous build number for artifact 'com.mycompany.sec:sampleproj:jar': repository metadata for: 'snapshot com.mycompany.sec:sampleproj:1.0-SNAPSHOT' could not be retrieved from repository: snapshots due to an error: Authorization failed: Access denied to: http://remoteserver:8080/nexus/content/repositories/snapshots/com/mycompany/sec/sampleproj/1.0-SNAPSHOT/maven-metadata.xml
        at org.apache.maven.artifact.transform.SnapshotTransformation.transformForDeployment(SnapshotTransformation.java:106)
        at org.apache.maven.artifact.transform.DefaultArtifactTransformationManager.transformForDeployment(DefaultArtifactTransformationManager.java:74)
        at org.apache.maven.artifact.deployer.DefaultArtifactDeployer.deploy(DefaultArtifactDeployer.java:86)
        at org.apache.maven.plugin.deploy.DeployMojo.execute(DeployMojo.java:173)
        ... 19 more
Caused by: org.apache.maven.artifact.repository.metadata.RepositoryMetadataResolutionException: repository metadata for: 'snapshot com.mycompany.sec:sampleproj:1.0-SNAPSHOT' could not be retrieved from repository: snapshots due to an error: Authorization failed: Access denied to: http://remoteserver:8080/nexus/content/repositories/snapshots/com/mycompany/sec/sampleproj/1.0-SNAPSHOT/maven-metadata.xml
        at org.apache.maven.artifact.repository.metadata.DefaultRepositoryMetadataManager.resolveAlways(DefaultRepositoryMetadataManager.java:351)
        at org.apache.maven.artifact.transform.SnapshotTransformation.resolveLatestSnapshotBuildNumber(SnapshotTransformation.java:161)
        at org.apache.maven.artifact.transform.SnapshotTransformation.transformForDeployment(SnapshotTransformation.java:100)
        ... 22 more
Caused by: org.apache.maven.wagon.TransferFailedException: Authorization failed: Access denied to: http://remoteserver:8080/nexus/content/repositories/snapshots/com/mycompany/sec/sampleproj/1.0-SNAPSHOT/maven-metadata.xml
        at org.apache.maven.artifact.manager.DefaultWagonManager.getRemoteFile(DefaultWagonManager.java:647)
        at org.apache.maven.artifact.manager.DefaultWagonManager.getArtifactMetadataFromDeploymentRepository(DefaultWagonManager.java:452)
        at org.apache.maven.artifact.repository.metadata.DefaultRepositoryMetadataManager.getArtifactMetadataFromDeploymentRepository(DefaultRepositoryMetadataManager.java:379)
        at org.apache.maven.artifact.repository.metadata.DefaultRepositoryMetadataManager.resolveAlways(DefaultRepositoryMetadataManager.java:347)
        ... 24 more
Caused by: org.apache.maven.wagon.authorization.AuthorizationException: Access denied to: http://remoteserver:8080/nexus/content/repositories/snapshots/com/mycompany/sec/sampleproj/1.0-SNAPSHOT/maven-metadata.xml
        at org.apache.maven.wagon.providers.http.LightweightHttpWagon.fillInputData(LightweightHttpWagon.java:119)
        at org.apache.maven.wagon.StreamWagon.getInputStream(StreamWagon.java:116)
        at org.apache.maven.wagon.StreamWagon.getIfNewer(StreamWagon.java:88)
        at org.apache.maven.wagon.StreamWagon.get(StreamWagon.java:61)
        at org.apache.maven.artifact.manager.DefaultWagonManager.getRemoteFile(DefaultWagonManager.java:546)
        ... 27 more
------------------------------------------------------------------------
Total time: 1 second
Finished at: Mon Jun 20 10:27:45 CDT 2011
Final Memory: 9M/23M
-----------------------------------------------------------------------
Reply | Threaded
Open this post in threaded view
|

Re: Deploying artifacts to Nexus gives "Error retrieving previous build .."

Rich Seddon
Check that there is a "server" entry in your settings.xml with the same ID that is in your pom's distributionManagement.

Rich

On Jun 20, 2011, at 10:41 AM, prankris wrote:

> Hi all,
>
> When I deploy artifacts to nexus snapshots repository, I am getting "Error
> retrieving previous build number for artifact
> 'com.mycompany.sec:sampleproj:jar': repository metadata for: 'snapshot
> com.mycompany.sec:sampleproj:1.0-SNAPSHOT' could not be retrieved from
> repository: snapshots due to an error: Authorization failed: Access denied
> to:
> http://remoteserver:8080/nexus/content/repositories/snapshots/com/mycompany/sec/sampleproj/1.0-SNAPSHOT/maven-metadata.xml".
>
> I'm using maven 2.2.1, nexus v1.9.1.1, glassfish 3.0.1, JDK 1.6.0_23
> However, when I make the security settings to OFF under Administration ->
> Server, then I am not getting the above error.
> I am deploying to nexus using deployment user.
>
> Following is the error using -e switch
>
> NetBeans: Executing 'C:\apache-maven-2.2.1\bin\mvn.bat
> -Dnetbeans.execution=true -Dmaven.repo.local=C:\Documents and
> Settings\username\.m2\repository -e deploy'
> NetBeans:      JAVA_HOME=C:\Program Files\Java\jdk1.6.0_23
> + Error stacktraces are turned on.
> Scanning for projects...
> ------------------------------------------------------------------------
> Building Sampleproj
>   task-segment: [deploy]
> ------------------------------------------------------------------------
> [resources:resources]
> [WARNING] Using platform encoding (Cp1252 actually) to copy filtered
> resources, i.e. build is platform dependent!
> Copying 0 resource
> [compiler:compile]
> Nothing to compile - all classes are up to date
> [resources:testResources]
> [WARNING] Using platform encoding (Cp1252 actually) to copy filtered
> resources, i.e. build is platform dependent!
> skip non existing resourceDirectory
> C:\WorkspaceNetBeans\Sampleproj\src\test\resources
> [compiler:testCompile]
> Nothing to compile - all classes are up to date
> [surefire:test]
> No tests to run.
> [jar:jar]
> [install:install]
> Installing
> C:\WorkspaceNetBeans\Sampleproj\target\sampleproj-1.0-SNAPSHOT.jar to
> C:\Documents and
> Settings\username\.m2\repository\com\mycompany\sec\sampleproj\1.0-SNAPSHOT\sampleproj-1.0-SNAPSHOT.jar
> [deploy:deploy]
> Retrieving previous build number from snapshots
> ------------------------------------------------------------------------
> [ERROR]BUILD ERROR
> ------------------------------------------------------------------------
> Error retrieving previous build number for artifact
> 'com.mycompany.sec:sampleproj:jar': repository metadata for: 'snapshot
> com.mycompany.sec:sampleproj:1.0-SNAPSHOT' could not be retrieved from
> repository: snapshots due to an error: Authorization failed: Access denied
> to:
> http://remoteserver:8080/nexus/content/repositories/snapshots/com/mycompany/sec/sampleproj/1.0-SNAPSHOT/maven-metadata.xml
>
> ------------------------------------------------------------------------
> Trace
> org.apache.maven.lifecycle.LifecycleExecutionException: Error retrieving
> previous build number for artifact 'com.mycompany.sec:sampleproj:jar':
> repository metadata for: 'snapshot
> com.mycompany.sec:sampleproj:1.0-SNAPSHOT' could not be retrieved from
> repository: snapshots due to an error: Authorization failed: Access denied
> to:
> http://remoteserver:8080/nexus/content/repositories/snapshots/com/mycompany/sec/sampleproj/1.0-SNAPSHOT/maven-metadata.xml
>        at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:719)
>        at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
>        at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
>        at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
>        at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
>        at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
>        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
>        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
>        at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
>        at
> org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>        at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>        at java.lang.reflect.Method.invoke(Method.java:597)
>        at
> org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
>        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
>        at
> org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
>        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
> Caused by: org.apache.maven.plugin.MojoExecutionException: Error retrieving
> previous build number for artifact 'com.mycompany.sec:sampleproj:jar':
> repository metadata for: 'snapshot
> com.mycompany.sec:sampleproj:1.0-SNAPSHOT' could not be retrieved from
> repository: snapshots due to an error: Authorization failed: Access denied
> to:
> http://remoteserver:8080/nexus/content/repositories/snapshots/com/mycompany/sec/sampleproj/1.0-SNAPSHOT/maven-metadata.xml
>        at
> org.apache.maven.plugin.deploy.DeployMojo.execute(DeployMojo.java:195)
>        at
> org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
>        at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
>        ... 17 more
> Caused by: org.apache.maven.artifact.deployer.ArtifactDeploymentException:
> Error retrieving previous build number for artifact
> 'com.mycompany.sec:sampleproj:jar': repository metadata for: 'snapshot
> com.mycompany.sec:sampleproj:1.0-SNAPSHOT' could not be retrieved from
> repository: snapshots due to an error: Authorization failed: Access denied
> to:
> http://remoteserver:8080/nexus/content/repositories/snapshots/com/mycompany/sec/sampleproj/1.0-SNAPSHOT/maven-metadata.xml
>        at
> org.apache.maven.artifact.transform.SnapshotTransformation.transformForDeployment(SnapshotTransformation.java:106)
>        at
> org.apache.maven.artifact.transform.DefaultArtifactTransformationManager.transformForDeployment(DefaultArtifactTransformationManager.java:74)
>        at
> org.apache.maven.artifact.deployer.DefaultArtifactDeployer.deploy(DefaultArtifactDeployer.java:86)
>        at
> org.apache.maven.plugin.deploy.DeployMojo.execute(DeployMojo.java:173)
>        ... 19 more
> Caused by:
> org.apache.maven.artifact.repository.metadata.RepositoryMetadataResolutionException:
> repository metadata for: 'snapshot
> com.mycompany.sec:sampleproj:1.0-SNAPSHOT' could not be retrieved from
> repository: snapshots due to an error: Authorization failed: Access denied
> to:
> http://remoteserver:8080/nexus/content/repositories/snapshots/com/mycompany/sec/sampleproj/1.0-SNAPSHOT/maven-metadata.xml
>        at
> org.apache.maven.artifact.repository.metadata.DefaultRepositoryMetadataManager.resolveAlways(DefaultRepositoryMetadataManager.java:351)
>        at
> org.apache.maven.artifact.transform.SnapshotTransformation.resolveLatestSnapshotBuildNumber(SnapshotTransformation.java:161)
>        at
> org.apache.maven.artifact.transform.SnapshotTransformation.transformForDeployment(SnapshotTransformation.java:100)
>        ... 22 more
> Caused by: org.apache.maven.wagon.TransferFailedException: Authorization
> failed: Access denied to:
> http://remoteserver:8080/nexus/content/repositories/snapshots/com/mycompany/sec/sampleproj/1.0-SNAPSHOT/maven-metadata.xml
>        at
> org.apache.maven.artifact.manager.DefaultWagonManager.getRemoteFile(DefaultWagonManager.java:647)
>        at
> org.apache.maven.artifact.manager.DefaultWagonManager.getArtifactMetadataFromDeploymentRepository(DefaultWagonManager.java:452)
>        at
> org.apache.maven.artifact.repository.metadata.DefaultRepositoryMetadataManager.getArtifactMetadataFromDeploymentRepository(DefaultRepositoryMetadataManager.java:379)
>        at
> org.apache.maven.artifact.repository.metadata.DefaultRepositoryMetadataManager.resolveAlways(DefaultRepositoryMetadataManager.java:347)
>        ... 24 more
> Caused by: org.apache.maven.wagon.authorization.AuthorizationException:
> Access denied to:
> http://remoteserver:8080/nexus/content/repositories/snapshots/com/mycompany/sec/sampleproj/1.0-SNAPSHOT/maven-metadata.xml
>        at
> org.apache.maven.wagon.providers.http.LightweightHttpWagon.fillInputData(LightweightHttpWagon.java:119)
>        at
> org.apache.maven.wagon.StreamWagon.getInputStream(StreamWagon.java:116)
>        at
> org.apache.maven.wagon.StreamWagon.getIfNewer(StreamWagon.java:88)
>        at org.apache.maven.wagon.StreamWagon.get(StreamWagon.java:61)
>        at
> org.apache.maven.artifact.manager.DefaultWagonManager.getRemoteFile(DefaultWagonManager.java:546)
>        ... 27 more
> ------------------------------------------------------------------------
> Total time: 1 second
> Finished at: Mon Jun 20 10:27:45 CDT 2011
> Final Memory: 9M/23M
> -----------------------------------------------------------------------
>
>
> --
> View this message in context: http://maven.40175.n5.nabble.com/Deploying-artifacts-to-Nexus-gives-Error-retrieving-previous-build-tp4506835p4506835.html
> Sent from the Nexus Maven Repository Manager Users List mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Deploying artifacts to Nexus gives "Error retrieving previous build .."

prankris
This post was updated on .
Yes, you are right.  I am missing the server entry for "snapshots" in my settings.xml
However, I have a server entry for "public" in my settings.xml.  Since my public repo has snapshots repo in it, I thought that it is not necessary to give server entry for "snapshots" again.