Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Critical
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 2.0-beta-7
-
Component/s: None
-
Labels:None
-
Number of attachments :8
Description
mvn site:site ignores parts of my settings.xml:
<server>
<id>livetribe-website</id>
<filePermissions>664</filePermissions>
<directoryPermissions>775</directoryPermissions>
<configuration>
<sshExecutable>plink</sshExecutable>
<scpExecutable>pscp</scpExecutable>
</configuration>
<username>livetribe</username>
</server>
It uses the username when ssh but does not invoke plink.
[INFO] [site:deploy]
Using private key: C:\Documents and Settings\adc\.ssh\id_dsa
scpexe://repo.livetribe.org/home/projects/livetribe/public_html/maven/ - Session: Opened
Executing command: ssh -i "C:\Documents and Settings\adc\.ssh\id_dsa" -o "BatchMode yes" livetribe@repo.livetribe.org "mkdir -p /home/projects/livetribe/public_html/maven/."
scpexe://repo.livetribe.org/home/projects/livetribe/public_html/maven/ - Session: Disconnecting
scpexe://repo.livetribe.org/home/projects/livetribe/public_html/maven/ - Session: Disconnected
-
- MSITE-25.sample.pom.xml
- 21/Mar/08 6:02 PM
- 0.5 kB
- Rahul Akolkar
-
- MSITE-25.settings.xml.fragment.txt
- 21/Mar/08 6:02 PM
- 0.2 kB
- Rahul Akolkar
-
- MSITE-25.txt
- 26/May/06 5:45 PM
- 4 kB
- Petter L. H. Eide
-
- MSITE-25-01.patch
- 20/Mar/08 2:40 PM
- 2 kB
- Rahul Akolkar
-
- MSITE-25-02.patch
- 22/Mar/08 1:48 PM
- 0.6 kB
- Rahul Akolkar
-
- MSITE-25-03.patch
- 01/Apr/08 11:37 PM
- 9 kB
- Rahul Akolkar
-
- patch-MSITE-25-artifact-manager.diff
- 10/May/06 3:59 PM
- 2 kB
- Jerome Lacoste
-
- patch-MSITE-25-site-plugin.diff
- 10/May/06 4:03 PM
- 2 kB
- Jerome Lacoste
Issue Links
Activity
Could somebody maybe make a note under
http://maven.apache.org/guides/mini/guide-deploy-ssh-external.html
that this does not currently work for the site goal? Thinking that this feature is quite well documented I spent some substantial time looking for the issue on my end until I finally came accross this bug
Thanks!
part 2/2 of a tentative patch.
I tried to take into account Brett's comment related to MNG-1900 (if I recall well the issue number).
So I couldn't test the patch not having a Windows box to play with. I am unsure of the site dependency changes. They shouldn't be needed but I just tried to make sure the latest artifact version would be working.
There are many voters/watchers so I hope one of you can take the patch and test it, maybe fix it.
This patch fixes the bug, without introducing new dependencies to new artifacts or SNAPSHOT-versions. The Wagon-instance is now manually configured in SiteDeployMojo. This should be replaced with WagonManager.getConfiguredWagon when newer version of maven-artifact-manager is released.
Testcase:
pom.xml:
<project>
...
<distributionManagement>
<site>
<id>id</id>
<url>scpexe://host/path</url>
</site>
</distributionManagement>
<build>
<extensions>
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ssh-external</artifactId>
</extension>
</extensions>
...
</build>
...
</project>
settings.xml:
<settings>
<servers>
<server>
<id>id</id>
<filePermissions>664</filePermissions>
<directoryPermissions>775</directoryPermissions>
<configuration>
<sshExecutable>plink</sshExecutable>
<scpExecutable>pscp</scpExecutable>
<sshArgs>-ssh -l username</sshArgs>
</configuration>
</server>
</servers>
</settings>
This failes without the patch (mvn site:deploy):
[INFO] [site:deploy]
scpexe://remato.eide.biz/var/www/modelware - Session: Opened
Executing command: ssh -o "BatchMode yes" petterei@remato.eide.biz "mkdir -p /var/www/modelware/."
'ssh' is not recognized as an internal or external command, operable program or batch file.
scpexe://remato.eide.biz/var/www/modelware - Session: Disconnecting
scpexe://remato.eide.biz/var/www/modelware - Session: Disconnected
But sucseeds with the patch (mvn site:deploy):
[INFO] [site:deploy]
done
scpexe://remato.eide.biz/var/www/modelware - Session: Opened
Executing command: plink -batch -ssh -l username username@host "mkdir -p /var/www/modelware/."
Executing command: plink -batch -ssh -l username username@host "mkdir -p /var/www/modelware/."
Uploading: ./wagon63800.zip to scpexe://host/var/www/modelware
Executing command: pscp -batch wagon63800.zip username@host:/var/www/modelware/./wagon63800.zip
....
Fixed MNG-2324 and added patch also to site plugin to avoid requiring latest version of maven
Its been well over a year since this issue has been patched but I see it has not made it into a stable release of the site plugin.
When will a fixed version of the site plugin be released?
Is this working for anyone? I see an empty serverConfigurationMap in SiteDeployMojo#configureWagon(Wagon,String)
From SiteDeployMojo.java, here is the snippet for the field in question:
/** Map( String, XmlPlexusConfiguration ) with the repository id and the wagon configuration */
private Map serverConfigurationMap = new HashMap();
The comment above seems to indicate what it should contain. How does it come to contain that?
I manually populated the serverConfigurationMap (is there a better way?). That picks up the configuration as expected, and makes site deploys work. I'll attach a patch here in a minute.
Patch to populate SiteDeployMojo#serverConfigurationMap, rooted at maven-site-plugin trunk.
IMO, this should be reopened, and fix version set to 2.0-beta-7.
I also think it should be reopened since 2.0-beta-6 has been released without the fix included. Or at least 2.0-beta-6 still contains the bug anyway. A fix for 2.0-beta-7 seems reasonable since a patch is already available and presumably it only needs to be applied and tested right?
Can someone please provide a sample project that shows that this issue has not been fixed? I suspect a settings.xml snippet should also be included.
Here's my server declaration from settings.xml:
<servers>
<server>
<id>jws.website</id>
<username>amigus</username>
<privateKey>$
<directoryPermissions>0775</directoryPermissions>
<filePermissions>0664</filePermissions>
<configuration>
<sshExecutable>C:\Program Files\PuTTY\plink.exe</sshExecutable>
<sshArgs>-batch -C</sshArgs>
<scpExecutable>C:\Program Files\PuTTY\pscp.exe</scpExecutable>
<scpArgs>-q -batch -C</scpArgs>
</configuration>
</server>
</servers>
Here's the end of the output (with hostname changed):
...
[INFO] [site:deploy]
scpexe://myhost.mydomain.com/web/code/docs/jws/code - Session: Opened
Executing command: cmd.exe /X /C '"ssh -i C:\Work\workspaces\jws\${user.home}
\id_dsa.ppk -o "BatchMode yes" amigus@myhost.mydomain.com "mkdir -p /web/code/docs/jws/code/.""'
'ssh' is not recognized as an internal or external command,
operable program or batch file.
scpexe://myhost.mydomain.com/web/code/docs/jws/code - Session: Disconnecting
scpexe://myhost.mydomain.com/web/code/docs/jws/code - Session: Disconnected
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error uploading site
Embedded error: Error performing commands for file transfer
Exit code 1 - 'ssh' is not recognized as an internal or external command,
operable program or batch file.
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4 seconds
[INFO] Finished at: Fri Mar 21 16:12:57 EDT 2008
[INFO] Final Memory: 6M/12M
[INFO] ------------------------------------------------------------------------
Also notice that $
{user.home}is not getting dereferenced. Is that another bug?
I will try to provide the simplest sample project (well, its just a pom, but ... ![]()
Recipe:
(0) Add <server> from attached MSITE-25.settings.xml.fragment.txt to your settings.xml
(1) Add attached MSITE-25.sample.pom.xml to a newly created local directory (as pom.xml)
(2) mvn site-deploy (in above directory)
This is designed to fail. Depending on whether you have commandline ssh or not, you will either see things along the lines of "Host does not exist" or "'ssh' is not recognized as an internal or external command, operable program or batch file."
Note that in any case, the sshExecutable used is 'ssh' whereas we're requesting 'plink' in the server configuration. See other comments in this JIRA for complete console readout.
(3) Apply my patch MSITE-25-01.patch to the maven-site-plugin, install 2.0-beta-7-SNAPSHOT locally. See previous comments for rationale about the patch.
(4) mvn site:deploy
This will still fail
but the sshExecutable will be 'plink' as desired.
I'm happy to answer questions if any of this is unclear. Thanks for your time.
I applied Rahul's patch with modifications. Thanks!
I moved the code added by the patch to the configureWagon() method. That way, when we upgrade the Maven dependency to 2.0.5 in the site-plugin, your code will be removed along side other code that is available in Maven 2.0.5.
A new 2.0-beta-7-SNAPSHOT has been deployed. Please try it and confirm that it fixes this issue.
Thanks for taking a look at this. Your changes make sense to me, but you have introduced a bug in the process of making those modifications.
Specifically, the key for all entries added to the <code>serverConfigurationMap</code> is now the required <code>repositoryId</code>, and effectively that means the last non-null <server> configuration from the settings in iteration order is returned as the configuration.
Please reopen this ticket and apply the one liner patch attached as MSITE-25-02.patch Thanks again for your time.
Thanks for catching that Rahul. Your second patch has now been applied and a new SNAPSHOT has been deployed.
Thank you, I can confirm that the latest SNAPSHOT you deployed (specifically, 2.0-beta-7-20080322.205020-4 in the apache m2-snap-repo) fixes the problem for me.
the site:deploy goal works for me with this snapshot but the site:stage-deploy goal still ignores my settings.
Can we reopen again?
It's ridiculous that it is still broken.. after all it's not as if its hard to test.
I'd say keep reopening the issue until somebody actually bothers to fix the problem.
Personally I've simply stopped trying to use it an moved on to other solutions (like DAV) instead... simply because this has been broken for so long.
Well, excuse me for closing it. After all it only had a test project, a patch and a user that confirmed it was working.
So if it doesn't work for you, then at least provide a test project that can be used to prove that it doesn't work.
Given that I never use site:stage-deploy, I didn't test for it or address it in the patch (patch was aimed at fixing site:deploy). Glancing at the code, I can see there will be a similar configuration problem with that goal, since SiteStageDeployMojo.java has similar problems.
I will try to provide a patch for that. Those are the only two goals that deploy sites AFAIK, so that should be it ![]()
I am attaching a patch that fixes this for me for the site:stage-deploy goal as well.
The test case is the same as before, to reproduce please repeat the recipe from a few comments ago with following changes:
(0) Add this to the settings.xml instead:
<!-- site:stage-deploy repository -->
<server>
<id>stagingSite</id>
<username>notavalidusername</username>
<configuration>
<sshExecutable>plink</sshExecutable>
<scpExecutable>pscp</scpExecutable>
</configuration>
</server>
(2) and (4) – use 'mvn site:stage-deploy' instead
(3) Use patch MSITE-25-03.patch instead.
The patch chooses to make the SiteDeployMojo#configureWagon() method a utility method and reuses it in SiteStageDeployMojo to correctly configure the "stagingSite" server. Alternately, the code could have been duplicated (making it a utility method has a minor/negligible? performance penalty since server settings are no longer cached in a map). The patch appears larger than I'd have liked since changes in SiteDeployMojo#configureWagon() have caused an indentation change. TIA.
I've applied Rahul's patch and deployed a new SNAPSHOT. Thanks!
Can you please verify that the new 2.0-beta-7-20080419.180515-7 SNAPSHOT works?
Thanks, I can confirm that the 2.0-beta-7-20080419.180515-7 SNAPSHOT works for me. I also tried building the trunk (and that works as well for site-deploy, site:deploy and site:stage-deploy). If someone else can verify soon-ish, that'd be nice.
In any case, it'd help a lot to get a new release of the plugin that includes this fix. Given that deploying the site is also part of the default goals of the release plugin, this puts a dent in the ability to cut releases.
Are there any updates on this bug? I'm hitting a brick wall no matter how I try to get around it.
This issue has been fixed in 2.0-beta-7 of the site plugin. That version has not yet been released, but you can try out 2.0-beta-7-SNAPSHOT if you really need this functionality right away.
It uses everythin but the elements inside <configuration>
The deploy goal works well though