Bug Publish over SSH

269 views
Skip to first unread message

Erick Macedo

unread,
Apr 28, 2015, 3:25:21 PM4/28/15
to jenkins...@googlegroups.com
Hi,

I'm using the plugin Publish over SSH to run a remote command maven on a linux machine with properly configured maven.

However when running mvn command is generated an error "bash: mvn: command not found".

The plugin is properly connecting the remote machine, as for testing in the "Exec command" I include the command "ifconfig" and the same printed data from the remote machine.

However, when performing the command echo $ M2_HOME or echo $ PATH in the "Exec command" he printed the local machine where the information jenkins is the created, not the remote machine.

Something very strange.

Someone could help me?

Erick Macedo

unread,
Apr 28, 2015, 4:19:08 PM4/28/15
to jenkins...@googlegroups.com
I can not understand this behavior.

In Exec command: cd test / build-38 / project && ls && echo $ M2 && mvn -v

This command does the following:

1 - cd test / build-38 / project (in this directory on the remote server)
2 - ls (list the remote server content)
3 - echo $ M2 (Prints $ M2 LOCAL server, where the jenkins is the created)
4 - mvn -v (bash: mvn: command not found, here is also strange because mvn -v works both on the local server, and the remote)

Slide

unread,
Apr 28, 2015, 4:41:08 PM4/28/15
to jenkins...@googlegroups.com
It works as the user that you are connecting as? Is there anything in the .bashrc that would set the path to mvn? Perhaps the Publish Over SSH doesn't run in such a way that the .bashrc file is loaded? Check into these things.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/24f4e71d-fba0-468d-8047-44d6f4c48225%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Richard Bywater

unread,
Apr 28, 2015, 4:43:05 PM4/28/15
to jenkins...@googlegroups.com
To that effect, check your .bashrc as on Debian, for instance, one of the first things it does it not run anything in .bashrc if not starting as an interactive process.

Richard.

Erick Macedo

unread,
Apr 28, 2015, 5:16:52 PM4/28/15
to jenkins...@googlegroups.com
Hi,

The user I am connecting is the correct user, not root.

Are you referring to .bashrc the right remote machine?

Is remote machine is a Ubuntu and the .bashrc is so.

# JAVA
export JAVA_HOME = / usr / lib / jvm / java-8-oracle

# MAVEN
export MAVEN_HOME = / usr / local / apache-maven-3.2.5
export M2_HOME = / usr / local / apache-maven-3.2.5
export M2 = $ M2_HOME / bin
export PATH = $ M2: $ PATH

A very strange thing is that when I run the echo $ PATH in the "Exec command" it prints the variables of the local machine.


Em terça-feira, 28 de abril de 2015 16:25:21 UTC-3, Erick Macedo escreveu:

Jeff

unread,
Apr 28, 2015, 5:52:58 PM4/28/15
to jenkins...@googlegroups.com
This might be an ignorant question but why are you using the "Publish over SSH" plugin instead of the "SSH plugin"? https://wiki.jenkins-ci.org/display/JENKINS/SSH+plugin

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Jeff Vincent
See my LinkedIn profile at:
http://www.linkedin.com/in/rjeffreyvincent

Erick Macedo

unread,
Apr 29, 2015, 7:27:52 AM4/29/15
to jenkins...@googlegroups.com
The plugin "SSH plugin" only allows you to run an SSH command on the server, since the "Publish over SSH" lets you send data and execute any command.

Out of curiosity I auditioned with "SSH plugin" and it also returns mvn: command not found, which leads me to understand that the problem is not in the plugins


Em terça-feira, 28 de abril de 2015 16:25:21 UTC-3, Erick Macedo escreveu:

Erick Macedo

unread,
Apr 29, 2015, 10:45:46 AM4/29/15
to jenkins...@googlegroups.com
Hi Richard,

What would this interactive process,

could exemplify?

obrigaod

Em terça-feira, 28 de abril de 2015 16:25:21 UTC-3, Erick Macedo escreveu:
Message has been deleted

Richard Bywater

unread,
Apr 29, 2015, 4:36:10 PM4/29/15
to jenkins...@googlegroups.com
An interactive process is when you as a person connect to it rather than an system process (like Jenkins).

For instance one of the .bashrc files on one of my systems has this has its first thing:
# If not running interactively, don't do anything
case $- in
  *i*) ;;
  *) return;;
esac

(There are other variants of doing the similar thing that I've seen in other .bashrcs)

Hope that helps
Richard.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.

Daniel Beck

unread,
May 1, 2015, 6:02:18 PM5/1/15
to jenkins...@googlegroups.com
If you expect your command to have these values set from .bashrc: .bashrc is only loaded for interactive shells, which the Publish over SSH plugin likely is not. Find another way to define these, or explicitly load (source) .bashrc. 'man bash', section 'invocation'
> --
> You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/d92784d9-0141-4ef1-a240-8570c627e302%40googlegroups.com.

Naveen DN

unread,
Nov 6, 2017, 5:31:35 AM11/6/17
to Jenkins Users
I had the same problem...export PATH=$PATH:<maven directory/bin> && mvn clean test solved my problem

Disclaimer: This e-mail and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you are not the intended addressee, or the person responsible for delivering it to them, you may not copy, forward disclose or otherwise use it or any part of it in any way. To do so may be unlawful. If you receive this e-mail by mistake, please advise the sender immediately.
Reply all
Reply to author
Forward
0 new messages