梅文 +水星 +站点部署问题
我正在尝试使用 Mercurial 将 Maven 生成的站点部署到 googlecode 项目。 当我执行 a 时,
mvn site:deploy
出现传输错误:org.apache.maven.scm.NoSuchCommandScmException:没有这样的命令“列表”。
它就像尝试做一个“svn list”,即使我使用的是 Mercurial。
在我的 pom 中,我有 Maven Wagon 和 Mercurial 设置(我认为正确):
org.apache.maven.wagon 货车-SCM 1.0-β-6 org.apache.maven.scm maven-scm-provider-hg 1.4
然后,对于我的站点部署,我有一个单独的 Mercurial 存储库:
<distributionManagement>
<site>
<id>googlecode</id>
<name>googlecode site</name>
<url>scm:hg:${project.site.scm}/</url>
</site>
</distributionManagement>
在我的 settings.xml 中,我有:
<servers>
<server>
<id>googlecode</id>
<username>...</username>
<password>...</password>
</server>
</servers>
I'm trying to deploy my Maven generated site to a googlecode project using mercurial.
When I do a
mvn site:deploy
I get Transfer error: org.apache.maven.scm.NoSuchCommandScmException: No such command 'list'.
Its like its trying to do a "svn list" even though I am using mercurial.
In my pom I have maven wagon and mercurial setup (I think correctly):
org.apache.maven.wagon
wagon-scm
1.0-beta-6
org.apache.maven.scm
maven-scm-provider-hg
1.4
Then for my site deploy I have a separate mercurial repository:
<distributionManagement>
<site>
<id>googlecode</id>
<name>googlecode site</name>
<url>scm:hg:${project.site.scm}/</url>
</site>
</distributionManagement>
In my settings.xml I have:
<servers>
<server>
<id>googlecode</id>
<username>...</username>
<password>...</password>
</server>
</servers>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
偶然发现这个问题,我想我会为其他人提供答案,因为有关如何执行此操作的文档很少:
在相当长的一段时间里,我已经成功地将我的网站托管在使用 Mercurial 的 Google 代码存储库中。它运行良好,我遇到了很少的问题。
首先,您必须转到您的项目,选项卡“管理”,子选项卡“源”并创建一个名为“站点”的新存储库。然后,您必须提交并推送至少一个文件(通常称为“index.html”)到该存储库,因为 SCM 插件调用的“hglocate”在完全空的存储库上失败。
我的 POM 中有这个要部署到 http://site.MYREPO.googlecode.com/hg
然后你必须告诉 Maven 你的用户名和密码,所以将其添加到你的 Maven
settings.xml
文件中(注意 @ 字符是 HTML 编码的,因为 Mercurial 通常会卡住它)现在你可以
mvn clean site site:deploy
并访问 http://site.MYREPO。 googlecode.com/hg/index.html 获取完整的 Maven 站点。Stumbled upon this question and thought I would provide an answer for anyone else as the documentation for how to do this is sparse:
For quite some time now I've been successfully hosting my website in a Google Code repository that uses Mercurial. It works well and I've had very little issues
First, you have to go to your project, tab "Administer", subtab "Source" and create a new repository called "site". Then, you have to commit and push at least one file, conveniently called "index.html" to that repository because "hg locate", which is called by the SCM plugin, fails on completely empty repositories.
I have this in my POM to deploy to http://site.MYREPO.googlecode.com/hg
You then have to tell Maven your username and password, so add this to your Maven
settings.xml
file (note the @ character is HTML encoded as Mercurial will choke on it normally)Now you can
mvn clean site site:deploy
and visit http://site.MYREPO.googlecode.com/hg/index.html to get your complete maven site.site:deploy 使用 scp 或文件协议将站点部署到服务器 (
它获取 target/site 目录中的所有内容并将其复制到定义的目标。然而,缺点是,由我来确保我部署的内容实际上已签入我的版本控制系统。 IE:
site:deploy uses the scp or file protocol for deploying a site to the server (see here). I configure this along normal ssh lines (authorized_keys, etc). And in the pom have something along the lines:
It takes everything from the target/site directory and copies it across to the defined destination. However, the downside is, that it is up to me to ensure that what I have deployed is actually checked into my version control system. i.e:
首先,我尝试了 TheLQ 的答案,甚至投票给了那个答案(上面),因为它适用于简单的项目,特别是如果您还将 wagon-scm 和 wagon-ssh 依赖项添加到 maven-site-plugin 并将所有版本更新为最新的;)对于多模块项目,虽然我遇到了一个问题:每个子模块的站点都会覆盖以前推送的内容而不是嵌套它们(mvn部署也有同样的问题,即直接部署到Hg管理的远程maven仓库不会创建正确的文件夹层次结构)。
因此,这里有一个替代解决方案,它也可以减少对远程存储库的提交(尽管它需要一些手动工作)。
首先,转到您的 Google 代码项目,https://code.google.com/p/MYPROJECT,选项卡“管理”,“源”并创建一个新的存储库,例如,名为“站点”(或您想要的名称)。然后,您必须提交并推送至少一个文件(方便地称为“index.html”)到该存储库。
其次,在父项目的 pom.xml 中(仅)包含以下内容:
以及 -
注意:是的,它是“http:”而不是“https:”;在我的示例中,Maven 不会使用该 URL 来实际部署站点内容(我不会执行 site-deploy);相反,将使用 mvn site site:stage (见下文)。另外,您不必接触 settings.xml(*nix 系统上 ~/.m2/ 中的那个)。
第三,只需将远程(“站点”)存储库克隆到本地计算机(目标目录可以位于父项目的目录下,也可以位于其他任何地方 - 只需 cd 到您想要的 THAT_DIR 位置):
注意:如果它存在,您不必再次克隆,只需执行 hg pull、hg update (可以选择使用 hg rm * 删除旧内容并提交)。您还可以使用免费的 SourceTree 软件来代替控制台。
接下来,从项目根目录,正常执行(如果您之前已经这样做过,请跳过“干净,安装”目标;我使用 Maven 3.0.5):
最后,切换到克隆/阶段目录 THAT_DIR/MYPROJECT.site,测试网站本地(在浏览器中打开 index.html),如果愿意的话:
请访问 http 查看://site.MYREPO.googlecode.com/hg/index.html 以及 https://code.google.com/p/MYPROJECT.site/
完成。
First of all, I tried TheLQ's answer and even voted for that one (above), because it works for simple projects, especially if you also add wagon-scm and wagon-ssh dependencies to the maven-site-plugin and update all versions to the latest ;) With a multi-module project though I had an issue: each sub-module's site overwrites previously pushed content instead of nesting them (same problem with mvn deploy, i.e., deploying directly to a Hg managed remote maven repo does not create right folder hierarchy).
Therefore, here is an alternative solution, which also makes less commits to the remote repository (though, it requires a bit of manual work).
First, go to your Google Code project, https://code.google.com/p/MYPROJECT, tab "Administer", "Source" and create a new repository called, e.g., "site" (or how you'd like to call it). Then, you have to commit and push at least one file, conveniently called "index.html" to that repository.
Second, have the following in the parent project's pom.xml (only):
and also -
Note: Aye, it's "http:" and not "https:"; in my example, the URL is NOT going to be used by Maven to actually deploy the site content there (I am not going to execute site-deploy); instead, will use mvn site site:stage (see below). Also, you do not have to touch the settings.xml (the one in ~/.m2/ on *nix systems).
Third, simply clone the remote ('site') repository to your local machine (target directory can be under the parent project's dir as well as under anywhere else's - just cd to THAT_DIR where you want it):
Note: if it existed, you do not have to clone again, just do hg pull, hg update (optionally remove old content using hg rm * and commit). You can also use e.g. free SourceTree software instead of console.
Next, from the projects root, do normally (skip 'clean, install' goals if you did already before; I used Maven 3.0.5):
Finally, switch to the clone/stage directory, THAT_DIR/MYPROJECT.site, test the website locally (open index.html in a browser), and if happy do:
Check it out at http://site.MYREPO.googlecode.com/hg/index.html and the sources and changes at https://code.google.com/p/MYPROJECT.site/
Done.