Как вы упомянули выше, я обновил pom как
<distributionManagement>
<repository>
<id>deployment</id>
<name>deployment</name>
<url>http://localhost:8080/nexus-webapp-1.9.2/content/repositories/releases</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<name>Internal Snapshots</name>
<url>http://localhost:8080/nexus-webapp-1.9.2/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>
, а также изменил settings.xml
на что-то вроде
<server>
<id>deployment</id>
<username>deployment</username>
<password>deployment123</password>
</server>
<server>
<id>snapshots</id>
<username>deployment</username>
<password>deployment123</password>
</server>
Но когда я развертываю с помощью команды mvn deploy
maven, я получаю исключение, подобное этому:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.5:deploy (default-deploy) on project Test: Failed to deploy artifacts: Could not transfer ar
tifact Test:Test:jar:0.0.1 from deployment (http://localhost:8080/nexus-webapp-1.9.2/content/repositories/releases): Failed to transfer file: http://localhost:8080/nexus-
webapp-1.9.2/content/repositories/releases/Test/Test/0.0.1/Test-0.0.1.jar. Return code is: 401 -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.5:deploy (default-deploy) on project Test: F
ailed to deploy artifacts: Could not transfer artifact Test:Test:jar:0.0.1 from deployment (http://localhost:8080/nexus-webapp-1.9.2/content/repositories/releases): Faile
d to transfer file: http://localhost:8080/nexus-webapp-1.9.2/content/repositories/releases/Test/Test/0.0.1/Test-0.0.1.jar. Return code is: 401
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:203)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:140)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:314)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:151)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:445)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:168)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:132)
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.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.MojoExecutionException: Failed to deploy artifacts: Could not transfer artifact Test:Test:jar:0.0.1 from deployment (http://localhost:8
080/nexus-webapp-1.9.2/content/repositories/releases): Failed to transfer file: http://localhost:8080/nexus-webapp-1.9.2/content/repositories/releases/Test/Test/0.0.1/Tes
t-0.0.1.jar. Return code is: 401
at org.apache.maven.plugin.deploy.DeployMojo.execute(DeployMojo.java:189)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:107)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:195)
... 19 more
Caused by: org.apache.maven.artifact.deployer.ArtifactDeploymentException: Failed to deploy artifacts: Could not transfer artifact Test:Test:jar:0.0.1 from deployment (ht
tp://localhost:8080/nexus-webapp-1.9.2/content/repositories/releases): Failed to transfer file: http://localhost:8080/nexus-webapp-1.9.2/content/repositories/releases/Tes
t/Test/0.0.1/Test-0.0.1.jar. Return code is: 401
at org.apache.maven.artifact.deployer.DefaultArtifactDeployer.deploy(DefaultArtifactDeployer.java:140)
at org.apache.maven.plugin.deploy.DeployMojo.execute(DeployMojo.java:156)
... 21 more
Caused by: org.sonatype.aether.deployment.DeploymentException: Failed to deploy artifacts: Could not transfer artifact Test:Test:jar:0.0.1 from deployment (http://localho
st:8080/nexus-webapp-1.9.2/content/repositories/releases): Failed to transfer file: http://localhost:8080/nexus-webapp-1.9.2/content/repositories/releases/Test/Test/0.0.1
/Test-0.0.1.jar. **Return code is: 401**
at org.sonatype.aether.impl.internal.DefaultDeployer.deploy(DefaultDeployer.java:267)
at org.sonatype.aether.impl.internal.DefaultRepositorySystem.deploy(DefaultRepositorySystem.java:334)
at org.apache.maven.artifact.deployer.DefaultArtifactDeployer.deploy(DefaultArtifactDeployer.java:136)
... 22 more
Caused by: org.sonatype.aether.transfer.ArtifactTransferException: Could not transfer artifact Test:Test:jar:0.0.1 from deployment (http://localhost:8080/nexus-webapp-1.9
.2/content/repositories/releases): Failed to transfer file: http://localhost:8080/nexus-webapp-1.9.2/content/repositories/releases/Test/Test/0.0.1/Test-0.0.1.jar. Return
code is: 401
at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$4.wrap(WagonRepositoryConnector.java:858)
at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$4.wrap(WagonRepositoryConnector.java:849)
at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$PutTask.flush(WagonRepositoryConnector.java:773)
at org.sonatype.aether.connector.wagon.WagonRepositoryConnector.put(WagonRepositoryConnector.java:385)
at org.sonatype.aether.impl.internal.DefaultDeployer.deploy(DefaultDeployer.java:241)
... 24 more
**Caused by: org.apache.maven.wagon.TransferFailedException: Failed to transfer file: http://localhost:8080/nexus-webapp-1.9.2/content/repositories/releases/Test/Test/0.0.1
/Test-0.0.1.jar. Return code is: 401**
at org.apache.maven.wagon.providers.http.LightweightHttpWagon.finishPutTransfer(LightweightHttpWagon.java:205)
at org.apache.maven.wagon.AbstractWagon.putTransfer(AbstractWagon.java:413)
at org.apache.maven.wagon.AbstractWagon.transfer(AbstractWagon.java:392)
at org.apache.maven.wagon.AbstractWagon.putTransfer(AbstractWagon.java:365)
at org.apache.maven.wagon.StreamWagon.put(StreamWagon.java:163)
at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$PutTask.run(WagonRepositoryConnector.java:734)
at org.sonatype.aether.connector.wagon.WagonRepositoryConnector.put(WagonRepositoryConnector.java:384)
... 25 more
[ERROR]
[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
Разве у ID пользователя и пароля при развертывании нет привилегий для загрузки артефакта в нексусе с использованием maven deploy
? Я использую Nexus 1.9.2 Имеет ли Nexus Professional только права на загрузку ?. Пожалуйста, ведите меня.