Maven 2.x and 3.x Deploy Plugin

Failed to deploy to a remote repository

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Won't Fix
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None
  • Environment:
    Linux Fedora, 32bit, Maven2
  • Number of attachments :
    0

Description

It seems that 'mvn deploy' doesn't work when deploying to a remoty repository using scp/scpexe protocol

pom.xml:
...
<distributionManagement>
<repository>
<id>corp-repository</id>
<url>scpexe://user@192.168.45.10/var/maven2/repos</url>
</repository>
<site>
<id>website</id>
<url>scpexe://user@192.168.45.10/usr/local/apache2/htdocs/projects/proj1/</url>
</site>
</distributionManagement>
...

settings.xml:
<servers>
<server>
<id>webserver</id>
<username>user</username>
<privateKey>~/.ssh/id_rsa</privateKey>
</server>
<server>
<id>corp-repository</id>
<username>user</username>
<privateKey>~/.ssh/id_rsa</privateKey>
</server>
</servers>

When I issue the command 'mvn site:deploy' - it works
When I issue the command 'mvn deploy' - it doesn't work. The reason is: Exit code 255 - Permission denied (publickey,password).
When I issue the command 'scp a.file user@192.168.45.10:/var/maven2/repos' - it works

I have no idea how to make 'mvn deploy' work.

Activity

Hide
John Casey added a comment -

it may be failing to create the directories needed to support the artifact inside that repository's layout...for example, if you have:

org.apache.maven.test:test-project:1.0

you'd need permission to issue:

mkdir -p org/apache/maven/test/test-project/1.0

inside your chosen repository location, rather than simply uploading the file to the repository's root dir. Can you verify that you're able to do this manually?

Also, could you add another comment with the relevant output from the build? This should include the command lines that are running...(cleaned up to remove user/passwords, and protect the innocent, of course

Show
John Casey added a comment - it may be failing to create the directories needed to support the artifact inside that repository's layout...for example, if you have: org.apache.maven.test:test-project:1.0 you'd need permission to issue: mkdir -p org/apache/maven/test/test-project/1.0 inside your chosen repository location, rather than simply uploading the file to the repository's root dir. Can you verify that you're able to do this manually? Also, could you add another comment with the relevant output from the build? This should include the command lines that are running...(cleaned up to remove user/passwords, and protect the innocent, of course
Hide
Nic added a comment -

command line:
[root@server ntf]# mvn -X -N deploy

output:
+ Error stacktraces are turned on.
[DEBUG] Building Maven user-level plugin registry from: '/root/.m2/plugin-registry.xml'
[DEBUG] Building Maven global-level plugin registry from: '/usr/local/maven-2.0/conf/plugin-registry.xml'
[INFO] Scanning for projects...
[INFO] Reactor build order:
...
[DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-deploy-plugin:2.0:deploy' -->
[DEBUG] (f) artifact = uk.co.netdev.ntf:ntf:pom:1.0
[DEBUG] (f) attachedArtifacts = []
[DEBUG] (f) buildDirectory = /root/svn/ntf/target
[DEBUG] (f) deploymentRepository = [netdev-repository] -> scpexe://192.168.45.10/var/maven2/netdev
[DEBUG] (f) finalName = ntf-1.0
[DEBUG] (f) localRepository = [local] -> file:///var/maven2/local
[DEBUG] (f) packaging = pom
[DEBUG] (f) pomFile = /root/svn/ntf/pom.xml
[DEBUG] (f) updateReleaseInfo = false
[DEBUG] – end configuration –
[INFO] [deploy:deploy]
[DEBUG] not adding permissions to wagon connection
Uploading: scpexe://192.168.45.10/var/maven2/netdev/uk/co/netdev/ntf/ntf/1.0/ntf-1.0.pom
[INFO] ----------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ----------------------------------------------------------------------------
[INFO] Error deploying artifact: Error executing command for transfer

Exit code 255 - Permission denied (publickey,password).

[INFO] ----------------------------------------------------------------------------
[DEBUG] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: Error deploying artifact: Error executing command for transfer
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:544)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:469)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:448)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:301)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:268)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:137)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:316)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:113)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:249)
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:585)
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 deploying artifact: Error executing command for transfer
at org.apache.maven.plugin.deploy.DeployMojo.execute(DeployMojo.java:159)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:399)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:519)
... 16 more
Caused by: org.apache.maven.artifact.deployer.ArtifactDeploymentException: Error deploying artifact: Error executing command for transfer
at org.apache.maven.artifact.deployer.DefaultArtifactDeployer.deploy(DefaultArtifactDeployer.java:91)
at org.apache.maven.plugin.deploy.DeployMojo.execute(DeployMojo.java:138)
... 18 more
Caused by: org.apache.maven.wagon.TransferFailedException: Error executing command for transfer
at org.apache.maven.wagon.providers.sshext.ScpExternalWagon.put(ScpExternalWagon.java:327)
at org.apache.maven.artifact.manager.DefaultWagonManager.putRemoteFile(DefaultWagonManager.java:180)
at org.apache.maven.artifact.manager.DefaultWagonManager.putArtifact(DefaultWagonManager.java:109)
at org.apache.maven.artifact.deployer.DefaultArtifactDeployer.deploy(DefaultArtifactDeployer.java:77)
... 19 more
Caused by: org.apache.maven.wagon.CommandExecutionException: Exit code 255 - Permission denied (publickey,password).

at org.apache.maven.wagon.providers.sshext.ScpExternalWagon.executeCommand(ScpExternalWagon.java:220)
at org.apache.maven.wagon.providers.sshext.ScpExternalWagon.put(ScpExternalWagon.java:323)
... 22 more

That's all.

Now, what I did on the user@192.168.45.10 server:
user@netdev1:/var/maven2/repo$ mkdir -p /uk/co/netdev/ntf/ntf/1.0/ntf-1.0.pom
and I've got any error.

When I did the same things using mvn site:deploy, I noticed the followind debug string
[INFO] [site:deploy]
Using private key: /root/.ssh/id_rsa

And it seems to me that maven-deploy-plugin doesn't read my settings.xml file. In the same file where pom.xml file is.

Show
Nic added a comment - command line: [root@server ntf]# mvn -X -N deploy output: + Error stacktraces are turned on. [DEBUG] Building Maven user-level plugin registry from: '/root/.m2/plugin-registry.xml' [DEBUG] Building Maven global-level plugin registry from: '/usr/local/maven-2.0/conf/plugin-registry.xml' [INFO] Scanning for projects... [INFO] Reactor build order: ... [DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-deploy-plugin:2.0:deploy' --> [DEBUG] (f) artifact = uk.co.netdev.ntf:ntf:pom:1.0 [DEBUG] (f) attachedArtifacts = [] [DEBUG] (f) buildDirectory = /root/svn/ntf/target [DEBUG] (f) deploymentRepository = [netdev-repository] -> scpexe://192.168.45.10/var/maven2/netdev [DEBUG] (f) finalName = ntf-1.0 [DEBUG] (f) localRepository = [local] -> file:///var/maven2/local [DEBUG] (f) packaging = pom [DEBUG] (f) pomFile = /root/svn/ntf/pom.xml [DEBUG] (f) updateReleaseInfo = false [DEBUG] – end configuration – [INFO] [deploy:deploy] [DEBUG] not adding permissions to wagon connection Uploading: scpexe://192.168.45.10/var/maven2/netdev/uk/co/netdev/ntf/ntf/1.0/ntf-1.0.pom [INFO] ---------------------------------------------------------------------------- [ERROR] BUILD ERROR [INFO] ---------------------------------------------------------------------------- [INFO] Error deploying artifact: Error executing command for transfer Exit code 255 - Permission denied (publickey,password). [INFO] ---------------------------------------------------------------------------- [DEBUG] Trace org.apache.maven.lifecycle.LifecycleExecutionException: Error deploying artifact: Error executing command for transfer at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:544) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:469) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:448) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:301) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:268) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:137) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:316) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:113) at org.apache.maven.cli.MavenCli.main(MavenCli.java:249) 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:585) 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 deploying artifact: Error executing command for transfer at org.apache.maven.plugin.deploy.DeployMojo.execute(DeployMojo.java:159) at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:399) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:519) ... 16 more Caused by: org.apache.maven.artifact.deployer.ArtifactDeploymentException: Error deploying artifact: Error executing command for transfer at org.apache.maven.artifact.deployer.DefaultArtifactDeployer.deploy(DefaultArtifactDeployer.java:91) at org.apache.maven.plugin.deploy.DeployMojo.execute(DeployMojo.java:138) ... 18 more Caused by: org.apache.maven.wagon.TransferFailedException: Error executing command for transfer at org.apache.maven.wagon.providers.sshext.ScpExternalWagon.put(ScpExternalWagon.java:327) at org.apache.maven.artifact.manager.DefaultWagonManager.putRemoteFile(DefaultWagonManager.java:180) at org.apache.maven.artifact.manager.DefaultWagonManager.putArtifact(DefaultWagonManager.java:109) at org.apache.maven.artifact.deployer.DefaultArtifactDeployer.deploy(DefaultArtifactDeployer.java:77) ... 19 more Caused by: org.apache.maven.wagon.CommandExecutionException: Exit code 255 - Permission denied (publickey,password). at org.apache.maven.wagon.providers.sshext.ScpExternalWagon.executeCommand(ScpExternalWagon.java:220) at org.apache.maven.wagon.providers.sshext.ScpExternalWagon.put(ScpExternalWagon.java:323) ... 22 more That's all. Now, what I did on the user@192.168.45.10 server: user@netdev1:/var/maven2/repo$ mkdir -p /uk/co/netdev/ntf/ntf/1.0/ntf-1.0.pom and I've got any error. When I did the same things using mvn site:deploy, I noticed the followind debug string [INFO] [site:deploy] Using private key: /root/.ssh/id_rsa And it seems to me that maven-deploy-plugin doesn't read my settings.xml file. In the same file where pom.xml file is.
Hide
Nic added a comment -

Sorry, i was mistaken.

It's correct:
user@netdev1:/var/maven2/repo$ mkdir -p uk/co/netdev/ntf/ntf/1.0/ntf-1.0.pom

Show
Nic added a comment - Sorry, i was mistaken. It's correct: user@netdev1:/var/maven2/repo$ mkdir -p uk/co/netdev/ntf/ntf/1.0/ntf-1.0.pom
Hide
Nic added a comment -

And I did the same thing on my local machine from user root to user root.

I've got the same result. (Exit code 255 - Permission denied (publickey,gssapi-with-mic,password).)

As I understand, the root user can do everyting on the system, but the problem doesn't disappeared.

Show
Nic added a comment - And I did the same thing on my local machine from user root to user root. I've got the same result. (Exit code 255 - Permission denied (publickey,gssapi-with-mic,password).) As I understand, the root user can do everyting on the system, but the problem doesn't disappeared.
Hide
Nic added a comment -

I found the problem.

The maven_deploy_plugin doesn't read the setting.xml file, so when I issue the command 'mvn deploy' from the root user, it tries to deploy artifacts using the same user on a remote server.

In my situation, I issued the deploying process from the root user but I can't connect to the remote server via SSH using the root account. (security).

Show
Nic added a comment - I found the problem. The maven_deploy_plugin doesn't read the setting.xml file, so when I issue the command 'mvn deploy' from the root user, it tries to deploy artifacts using the same user on a remote server. In my situation, I issued the deploying process from the root user but I can't connect to the remote server via SSH using the root account. (security).
Hide
Brett Porter added a comment -

it does read settings.xml, but if you are root you probably didn't have it, or you had the id's misconfigured. Not a bug.

Show
Brett Porter added a comment - it does read settings.xml, but if you are root you probably didn't have it, or you had the id's misconfigured. Not a bug.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: