You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by garyhodgson <co...@garyhodgson.com> on 2015/08/30 22:43:23 UTC

Maven deploy direct to Karaf instance?

Hi,

I'm having a little trouble following what should be a relatively
straightforward example.  I am trying to directly deploy an artifact into a
running karaf instance using the mvn deploy:deploy-file command, as given
under the "Apache Maven" section of here
https://karaf.apache.org/manual/latest/users-guide/remote.html, but maven
fails with an error: 

  [ERROR] Failed to execute goal
org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy-file (default-cli)
on project features: Failed to retrieve remote metadata
com.example:features:1.0-SNAPSHOT/maven-metadata.xml: Could not transfer
metadata com.example:features:1.0-SNAPSHOT/maven-metadata.xml from/to
ssh-repository (scp://localhost:8104/system): Error occurred while
downloading 'com.example/features/1.0-SNAPSHOT/maven-metadata.xml' from the
remote repository:Repository[ssh-repository|scp://localhost:8104/system]:
Exit code: 2 - \system\com.example\features\1.0-SNAPSHOT\maven-metadata.xml:
no such file or directory -> [Help 1]

There appears to be no such maven-metadata.xml files in any of the system
sub-directories of the instance.  

Is this functionality still expected to be working? has anyone had any
experience doing something similar?

Cheers
Gary



--
View this message in context: http://karaf.922171.n3.nabble.com/Maven-deploy-direct-to-Karaf-instance-tp4042149.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: Maven deploy direct to Karaf instance?

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
It makes sense. I will make a try asap.

Regards
JB

On 08/31/2015 11:50 AM, garyhodgson wrote:
> Hi JB,
>
> I'm currently working with Karaf 3.0.4.  I create a custom distribution and
> within that work within instances, but I wouldn't think that should make a
> difference.
>
> As it's expected to work, I'll play with a few more scenarios, and with
> 4.0.1, when I next get chance.  Of course it'd be great if anyone else could
> do a quick test to see if it works for them.
>
> Cheers,
> Gary
>
>
>
> --
> View this message in context: http://karaf.922171.n3.nabble.com/Maven-deploy-direct-to-Karaf-instance-tp4042149p4042165.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: Maven deploy direct to Karaf instance?

Posted by garyhodgson <co...@garyhodgson.com>.
Hi JB,

I'm currently working with Karaf 3.0.4.  I create a custom distribution and
within that work within instances, but I wouldn't think that should make a
difference.

As it's expected to work, I'll play with a few more scenarios, and with
4.0.1, when I next get chance.  Of course it'd be great if anyone else could
do a quick test to see if it works for them.

Cheers,
Gary



--
View this message in context: http://karaf.922171.n3.nabble.com/Maven-deploy-direct-to-Karaf-instance-tp4042149p4042165.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: Maven deploy direct to Karaf instance?

Posted by zeiss <ze...@tut.by>.
It does not matter which directory once creation of additional directories is
required, does it? scp directly to system works just fine.


jbonofre wrote
> Weird, I already did it AFAIR (but maybe upload to deploy and not system).





--
View this message in context: http://karaf.922171.n3.nabble.com/Maven-deploy-direct-to-Karaf-instance-tp4042149p4049701.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: Maven deploy direct to Karaf instance?

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Weird, I already did it AFAIR (but maybe upload to deploy and not system).

Let me improve that.

Regards
JB

On 02/28/2017 11:16 PM, zeiss wrote:
> In addition to the above: no, Karaf scp cannot create folder. Because scp by
> design does not handle creation of directories. Karaf, surely, could have a
> special scp implementation, but it does not. A simple test like 'scp -P 8101
> ~/test.txt karaf_host:/system/test/test.txt' demonstrates this. It fails
> with 'Can not write to system/test/test.txt'. This is another confirmation
> that maven-deploy-plugin cannot deploy to Karaf, even if it worked solely
> via scp.
>
> I am wondering what is the purpose of having invalid and obviously not
> working example in the Karaf documentation.
>
>
>
>
> --
> View this message in context: http://karaf.922171.n3.nabble.com/Maven-deploy-direct-to-Karaf-instance-tp4042149p4049696.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>

-- 
Jean-Baptiste Onofr
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: Maven deploy direct to Karaf instance?

Posted by zeiss <ze...@tut.by>.
In addition to the above: no, Karaf scp cannot create folder. Because scp by
design does not handle creation of directories. Karaf, surely, could have a
special scp implementation, but it does not. A simple test like 'scp -P 8101
~/test.txt karaf_host:/system/test/test.txt' demonstrates this. It fails
with 'Can not write to system/test/test.txt'. This is another confirmation
that maven-deploy-plugin cannot deploy to Karaf, even if it worked solely
via scp.

I am wondering what is the purpose of having invalid and obviously not
working example in the Karaf documentation.




--
View this message in context: http://karaf.922171.n3.nabble.com/Maven-deploy-direct-to-Karaf-instance-tp4042149p4049696.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: Maven deploy direct to Karaf instance?

Posted by zeiss <ze...@tut.by>.
While the protocol specified is 'scp', I can see that shell command
interpreter is expected by maven-deploy-plugin (by Wagon, to be more exact).
As I already mentioned, it tries to create directories on remote host by
using org.apache.maven.wagon.providers.ssh.ScpHelper. And 'mkdir' is used
for that as you can see from the implementation of 
createRemoteDirectories() method
<https://maven.apache.org/wagon/wagon-providers/wagon-ssh-common/apidocs/src-html/org/apache/maven/wagon/providers/ssh/ScpHelper.html#line.341>  
(some code omitted):

String mkdirCmd = "mkdir -p \"" + path + "\"";
executor.executeCommand( mkdirCmd );

At least this method is invoked on my system when I do 'mvn
deploy:deploy-file'.


jbonofre wrote
> If you do, mvn deploy:deploy-file with scp, Karaf scp can create folder 
> in the system folder (it's not ssh, it's scp).
> 
> So, it should work with scp, not with sshexe.





--
View this message in context: http://karaf.922171.n3.nabble.com/Maven-deploy-direct-to-Karaf-instance-tp4042149p4049678.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: Maven deploy direct to Karaf instance?

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi,

If you do, mvn deploy:deploy-file with scp, Karaf scp can create folder 
in the system folder (it's not ssh, it's scp).

So, it should work with scp, not with sshexe.

Regards
JB

On 02/27/2017 01:02 PM, zeiss wrote:
> Hi Jean-Baptiste,
>
> Maybe you could clarify one thing for me. Maven Deploy Plugin works with
> files through Wagon providers. During deployment it has to create
> directories as per standard Maven repository layout -
> groupId/artifactId/version. If deployment is performed to remote host via
> SCP, mkdir command is issued for that.
>
> Now the thing that I don't understand. Karaf shell exposed through SSH is
> not a POSIX-like shell. It does not provide commands like mkdir. Due to this
> I cannot get deployment using Maven Deploy Plugin working - it simply fails
> on attempt to create a directory.
>
> I am curious how that deployment example from the documentation could
> possibly work.
>
> Thanks.
>
>
>
> --
> View this message in context: http://karaf.922171.n3.nabble.com/Maven-deploy-direct-to-Karaf-instance-tp4042149p4049676.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>

-- 
Jean-Baptiste Onofr
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: Maven deploy direct to Karaf instance?

Posted by zeiss <ze...@tut.by>.
Hi Jean-Baptiste,

Maybe you could clarify one thing for me. Maven Deploy Plugin works with
files through Wagon providers. During deployment it has to create
directories as per standard Maven repository layout -
groupId/artifactId/version. If deployment is performed to remote host via
SCP, mkdir command is issued for that.

Now the thing that I don't understand. Karaf shell exposed through SSH is
not a POSIX-like shell. It does not provide commands like mkdir. Due to this
I cannot get deployment using Maven Deploy Plugin working - it simply fails
on attempt to create a directory.

I am curious how that deployment example from the documentation could
possibly work.

Thanks. 



--
View this message in context: http://karaf.922171.n3.nabble.com/Maven-deploy-direct-to-Karaf-instance-tp4042149p4049676.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: Maven deploy direct to Karaf instance?

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi Gary,

yes, it should work (at least the scp part). The maven-metadata.xml is 
only required for SNAPSHOT (not release). In your case, as it's your own 
feature, Maven should update the maven-metadata.xml itself.

What Karaf version do you use ?

Regards
JB

On 08/30/2015 10:43 PM, garyhodgson wrote:
> Hi,
>
> I'm having a little trouble following what should be a relatively
> straightforward example.  I am trying to directly deploy an artifact into a
> running karaf instance using the mvn deploy:deploy-file command, as given
> under the "Apache Maven" section of here
> https://karaf.apache.org/manual/latest/users-guide/remote.html, but maven
> fails with an error:
>
>    [ERROR] Failed to execute goal
> org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy-file (default-cli)
> on project features: Failed to retrieve remote metadata
> com.example:features:1.0-SNAPSHOT/maven-metadata.xml: Could not transfer
> metadata com.example:features:1.0-SNAPSHOT/maven-metadata.xml from/to
> ssh-repository (scp://localhost:8104/system): Error occurred while
> downloading 'com.example/features/1.0-SNAPSHOT/maven-metadata.xml' from the
> remote repository:Repository[ssh-repository|scp://localhost:8104/system]:
> Exit code: 2 - \system\com.example\features\1.0-SNAPSHOT\maven-metadata.xml:
> no such file or directory -> [Help 1]
>
> There appears to be no such maven-metadata.xml files in any of the system
> sub-directories of the instance.
>
> Is this functionality still expected to be working? has anyone had any
> experience doing something similar?
>
> Cheers
> Gary
>
>
>
> --
> View this message in context: http://karaf.922171.n3.nabble.com/Maven-deploy-direct-to-Karaf-instance-tp4042149.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com