梅文 +水星 +站点部署问题

发布于 2024-09-25 15:09:56 字数 971 浏览 8 评论 0原文

我正在尝试使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

青柠芒果 2024-10-02 15:09:56

偶然发现这个问题,我想我会为其他人提供答案,因为有关如何执行此操作的文档很少:

在相当长的一段时间里,我已经成功地将我的网站托管在使用 Mercurial 的 Google 代码存储库中。它运行良好,我遇到了很少的问题。

首先,您必须转到您的项目,选项卡“管理”,子选项卡“源”并创建一个名为“站点”的新存储库。然后,您必须提交并推送至少一个文件(通常称为“index.html”)到该存储库,因为 SCM 插件调用的“hglocate”在完全空的存储库上失败。

我的 POM 中有这个要部署到 http://site.MYREPO.googlecode.com/hg

<build>
    <plugins>
        ...
        <!--Deploy site with Mercurial (Hg)-->
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-site-plugin</artifactId>
            <version>3.0-beta-3</version>
            <dependencies>
                <dependency>
                    <groupId>org.apache.maven.scm</groupId>
                    <artifactId>maven-scm-api</artifactId>
                    <version>1.5</version>
                </dependency>
                <dependency>
                    <groupId>org.apache.maven.scm</groupId>
                    <artifactId>maven-scm-provider-hg</artifactId>
                    <version>1.5</version>
                </dependency>
            </dependencies>
        </plugin>
        ...
    </plugins>
</build>

<!--
    Distribution
-->
<distributionManagement>
    <!--Site deploy repository-->
    <site>
        <id>MYREPO.googlecode.com</id>
        <url>scm:hg:https://site.MYREPO.googlecode.com/hg</url>
    </site>
</distributionManagement>

然后你必须告诉 Maven 你的用户名和密码,所以将其添加到你的 Maven settings.xml 文件中(注意 @ 字符是 HTML 编码的,因为 Mercurial 通常会卡住它)

<settings>
    <servers>
        <server>
            <id>MYREPO.googlecode.com</id>
            <username>MYEMAIL%40gmail.com</username>
            <password>MYPASSWORD</password>
        </server>
    </servers>
</settings>

现在你可以 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

<build>
    <plugins>
        ...
        <!--Deploy site with Mercurial (Hg)-->
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-site-plugin</artifactId>
            <version>3.0-beta-3</version>
            <dependencies>
                <dependency>
                    <groupId>org.apache.maven.scm</groupId>
                    <artifactId>maven-scm-api</artifactId>
                    <version>1.5</version>
                </dependency>
                <dependency>
                    <groupId>org.apache.maven.scm</groupId>
                    <artifactId>maven-scm-provider-hg</artifactId>
                    <version>1.5</version>
                </dependency>
            </dependencies>
        </plugin>
        ...
    </plugins>
</build>

<!--
    Distribution
-->
<distributionManagement>
    <!--Site deploy repository-->
    <site>
        <id>MYREPO.googlecode.com</id>
        <url>scm:hg:https://site.MYREPO.googlecode.com/hg</url>
    </site>
</distributionManagement>

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)

<settings>
    <servers>
        <server>
            <id>MYREPO.googlecode.com</id>
            <username>MYEMAIL%40gmail.com</username>
            <password>MYPASSWORD</password>
        </server>
    </servers>
</settings>

Now you can mvn clean site site:deploy and visit http://site.MYREPO.googlecode.com/hg/index.html to get your complete maven site.

对不⑦ 2024-10-02 15:09:56

site:deploy 使用 scp 或文件协议将站点部署到服务器 (

  <!-- The location for generating the website. -->
  <distributionManagement>
    <site>
      <id>website</id>
      <url>scp://[email protected]/path/to/deploy/directory/</url>
    </site>
  </distributionManagement>

它获取 target/site 目录中的所有内容并将其复制到定义的目标。然而,缺点是,由我来确保我部署的内容实际上已签入我的版本控制系统。 IE:

hg push (use mercurial directly to push my changes to other developers).
mvn site:deploy (deploys from my local machine using scp).

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:

  <!-- The location for generating the website. -->
  <distributionManagement>
    <site>
      <id>website</id>
      <url>scp://[email protected]/path/to/deploy/directory/</url>
    </site>
  </distributionManagement>

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:

hg push (use mercurial directly to push my changes to other developers).
mvn site:deploy (deploys from my local machine using scp).
一百个冬季 2024-10-02 15:09:56

首先,我尝试了 TheLQ 的答案,甚至投票给了那个答案(上面),因为它适用于简单的项目,特别是如果您还将 wagon-scm 和 wagon-ssh 依赖项添加到 maven-site-plugin 并将所有版本更新为最新的;)对于多模块项目,虽然我遇到了一个问题:每个子模块的站点都会覆盖以前推送的内容而不是嵌套它们(mvn部署也有同样的问题,即直接部署到Hg管理的远程maven仓库不会创建正确的文件夹层次结构)。

因此,这里有一个替代解决方案,它也可以减少对远程存储库的提交(尽管它需要一些手动工作)。

首先,转到您的 Google 代码项目,https://code.google.com/p/MYPROJECT,选项卡“管理”,“源”并创建一个新的存储库,例如,名为“站点”(或您想要的名称)。然后,您必须提交并推送至少一个文件(方便地称为“index.html”)到该存储库。

其次,在父项目的 pom.xml 中(仅)包含以下内容:

<distributionManagement>
<!-- ... other content ...-->
    <site>
        <id>MYPROJECT.googlecode.com</id>
        <name>MYPROJECT auto-generated site</name>
        <url>http://site.MYPROJECT.googlecode.com/hg</url>
    </site>
</distributionManagement>

以及 -

<url>http://site.MYPROJECT.googlecode.com/hg</url>

注意:是的,它是“http:”而不是“https:”;在我的示例中,Maven 不会使用该 URL 来实际部署站点内容(我不会执行 site-deploy);相反,将使用 mvn site site:stage (见下文)。另外,您不必接触 settings.xml(*nix 系统上 ~/.m2/ 中的那个)。

第三,只需将远程(“站点”)存储库克隆到本地计算机(目标目录可以位于父项目的目录下,也可以位于其他任何地方 - 只需 cd 到您想要的 THAT_DIR 位置):

cd THAT_DIR
hg clone https://[email protected]/p/MYPROJECT.site/

注意:如果它存在,您不必再次克隆,只需执行 hg pull、hg update (可以选择使用 hg rm * 删除旧内容并提交)。您还可以使用免费的 SourceTree 软件来代替控制台。

接下来,从项目根目录,正常执行(如果您之前已经这样做过,请跳过“干净,安装”目标;我使用 Maven 3.0.5):

mvn clean install site site:stage -DstagingDirectory=FullPathTo/MYPROJECT.site

最后,切换到克隆/阶段目录 THAT_DIR/MYPROJECT.site,测试网站本地(在浏览器中打开 index.html),如果愿意的话:

hg add *
hg commit -m "re-generated MYPROJECT"
hg push

请访问 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):

<distributionManagement>
<!-- ... other content ...-->
    <site>
        <id>MYPROJECT.googlecode.com</id>
        <name>MYPROJECT auto-generated site</name>
        <url>http://site.MYPROJECT.googlecode.com/hg</url>
    </site>
</distributionManagement>

and also -

<url>http://site.MYPROJECT.googlecode.com/hg</url>

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):

cd THAT_DIR
hg clone https://[email protected]/p/MYPROJECT.site/

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):

mvn clean install site site:stage -DstagingDirectory=FullPathTo/MYPROJECT.site

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:

hg add *
hg commit -m "re-generated MYPROJECT"
hg push

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文