Maven 1.x Site Plugin

Rsync fail

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.6
  • Fix Version/s: None
  • Component/s: plugin
  • Labels:
    None
  • Environment:
    OS: linux redhat 8.0
    Java: 1.5
  • Number of attachments :
    1

Description

On site:rsyncdeploy, get the following:
[exec] building file list ... done
[exec] link_stat target/docs/* : No such file or directory
[exec] wrote 25 bytes read 20 bytes 90.00 bytes/sec
[exec] rsync error: some files could not be transferred (code 23) at main.c(620)
[exec] total size is 0 speedup is 0.00
[exec] [ERROR] Result: 23
BUILD SUCCESSFUL

In plugin.jelly I have added some <echo/> to see what could happen:
<echo>${maven.rsync.executable}</echo>
<echo>"-avz ${rsyncArgs} ${relativeDocsDest}/* ${siteUsername}@${siteAddress}:${siteDirectory}"</echo>

I used the output to launch the command from the shell command line and it works fine.

I also added <exec dir="." executable="pwd"/> to check it the directory was correct and it was.

So it seems that all the parameters to execute the rsync are good but the command failed when used from the plugin.

Activity

Hide
Brett Porter added a comment -

It looks like target/docs is empty. Did you run site first?

Show
Brett Porter added a comment - It looks like target/docs is empty. Did you run site first?
Hide
Oscar Picasso added a comment -

I did run site and targets/docs was not empty.

I've with both java 1.5.0 and java 1.4.2 and got the same error.

It's weird because the plugin seem to use the right command.

I added the following to the site:rsync goal.
...
<!-- added -->
<echo>"${maven.rsync.executable}"</echo>
<echo>"-avz ${rsyncArgs} ${relativeDocsDest}/* ${siteUsername}@${siteAddress}:${siteDirectory}"</echo>
<exec dir="." executable="pwd"/>
<!-- end added -->
<exec dir="." executable="${maven.rsync.executable}">
<arg line="-avz ${rsyncArgs} ${relativeDocsDest}/* ${siteUsername}@${siteAddress}:${siteDirectory}"/>
</exec>
...

The output gave:
site:rsyncdeploy:
[echo] "rsync"
[echo] "-avz target/docs/* oscar@freedom:/tmp/site-test"
[exec] /home/oscar/workspace/db-je
...

From the output above I copied and paste to make the following command from the /home/oscar/workspace/db-je directory:

rsync -avz target/docs/* oscar@freedom:/tmp/site-test

It worked perfectly.

By the way, what does exec do? Just calling one of the Runtime.exec() method?

Show
Oscar Picasso added a comment - I did run site and targets/docs was not empty. I've with both java 1.5.0 and java 1.4.2 and got the same error. It's weird because the plugin seem to use the right command. I added the following to the site:rsync goal. ... <!-- added --> <echo>"${maven.rsync.executable}"</echo> <echo>"-avz ${rsyncArgs} ${relativeDocsDest}/* ${siteUsername}@${siteAddress}:${siteDirectory}"</echo> <exec dir="." executable="pwd"/> <!-- end added --> <exec dir="." executable="${maven.rsync.executable}"> <arg line="-avz ${rsyncArgs} ${relativeDocsDest}/* ${siteUsername}@${siteAddress}:${siteDirectory}"/> </exec> ... The output gave: site:rsyncdeploy: [echo] "rsync" [echo] "-avz target/docs/* oscar@freedom:/tmp/site-test" [exec] /home/oscar/workspace/db-je ... From the output above I copied and paste to make the following command from the /home/oscar/workspace/db-je directory: rsync -avz target/docs/* oscar@freedom:/tmp/site-test It worked perfectly. By the way, what does exec do? Just calling one of the Runtime.exec() method?
Hide
Brett Porter added a comment -

most strange...

exec is the Ant <exec task, which in essence does just Runtime.exec.

Can you run maven with the -X option? Around the exec command, it should give more details about what is run.

Thanks.

Show
Brett Porter added a comment - most strange... exec is the Ant <exec task, which in essence does just Runtime.exec. Can you run maven with the -X option? Around the exec command, it should give more details about what is run. Thanks.
Hide
Oscar Picasso added a comment -

I found a solution. I works at least on my configuration.

It seems that passing arguments with a wildcard doesn't work fine so I just removed the '*' from '${relativeDocsDest}/' in the arg line.

You have to retain the trailing slash though because if you remove it it will copy not only the content of the source directory but also the directory itself.

The new site:rsyncdeploy would be:

<goal name="site:rsyncdeploy"
description="Deploy the generated site using rsync"
prereqs="site:init,site:remote-deploy-init">
<exec dir="." executable="${maven.ssh.executable}">
<arg line="${siteUsername}@${siteAddress} 'mkdir -p ${siteDirectory}'" />
</exec>

<maven:makeRelativePath var="relativeDocsDest" path="${docsDest}" separator="/" basedir="${basedir}" />
<j:if test="${siteClean}">
<echo>Cleaning destination</echo>
<j:set var="rsyncArgs" value="${rsyncArgs} --delete" />
</j:if>
<exec dir="." executable="${maven.rsync.executable}">
<arg line="-avz ${rsyncArgs} ${relativeDocsDest}/ ${siteUsername}@${siteAddress}:${siteDirectory}"/>
</exec>
</goal>

As you can see the only difference with the current distribution is the removal of the wildcard.

Oscar

Show
Oscar Picasso added a comment - I found a solution. I works at least on my configuration. It seems that passing arguments with a wildcard doesn't work fine so I just removed the '*' from '${relativeDocsDest}/' in the arg line. You have to retain the trailing slash though because if you remove it it will copy not only the content of the source directory but also the directory itself. The new site:rsyncdeploy would be: <goal name="site:rsyncdeploy" description="Deploy the generated site using rsync" prereqs="site:init,site:remote-deploy-init"> <exec dir="." executable="${maven.ssh.executable}"> <arg line="${siteUsername}@${siteAddress} 'mkdir -p ${siteDirectory}'" /> </exec> <maven:makeRelativePath var="relativeDocsDest" path="${docsDest}" separator="/" basedir="${basedir}" /> <j:if test="${siteClean}"> <echo>Cleaning destination</echo> <j:set var="rsyncArgs" value="${rsyncArgs} --delete" /> </j:if> <exec dir="." executable="${maven.rsync.executable}"> <arg line="-avz ${rsyncArgs} ${relativeDocsDest}/ ${siteUsername}@${siteAddress}:${siteDirectory}"/> </exec> </goal> As you can see the only difference with the current distribution is the removal of the wildcard. Oscar
Hide
Oscar Picasso added a comment -

I wanted to submit a patch the proper way but the cvs layout is quite confusing.

Found several maven site plugin folders but either empty or only with version 1.5.2 which has not rsync:deploy.

Where is version the plugin site version 1.6 on cvs?

Show
Oscar Picasso added a comment - I wanted to submit a patch the proper way but the cvs layout is quite confusing. Found several maven site plugin folders but either empty or only with version 1.5.2 which has not rsync:deploy. Where is version the plugin site version 1.6 on cvs?
Hide
Brett Porter added a comment -

Oscar, it is in Subversion.

Show
Brett Porter added a comment - Oscar, it is in Subversion.
Hide
Oscar Picasso added a comment -

Resolve the issue on my environment.
Results are consistent with what site:sshdeploy does.

Show
Oscar Picasso added a comment - Resolve the issue on my environment. Results are consistent with what site:sshdeploy does.
Hide
Brett Porter added a comment -

jira is stuck again, need to reopen to close

Show
Brett Porter added a comment - jira is stuck again, need to reopen to close

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: