部署到 sourceforge.net

sf.net 公告表明项目 Web 文件管理的新主机名已更改。文件管理的新主机名是:web.sourceforge.net,新接受的方法是:SFTP、SCP、rsync over SSH。不幸的是,web.sourceforge.net也有一个受限的 shell 环境,不允许执行远程命令。

此外,对shell.sourceforge.net的 shell 访问现在需要创建一个 shell 才能访问它。

这两种情况都意味着,如果您尝试在不执行这些步骤的情况下部署站点,您将收到错误消息。

快速开始

  • 使用您的用户名和项目组 在shell.sourceforge.net上创建一个 shell
    ssh -t <username>,<project name>@shell.sf.net create
    
  • 在您的站点 URL 中 使用shell.sourceforge.net(而不是web.sourceforge.net )
      ...
      <distributionManagement>
        ...
        <site>
          <id>your_project.sf.net</id>
          <url>scp://shell.sourceforge.net/home/project-web/your_project/htdocs</url>
        </site>
      </distributionManagement>
    
  • 运行mvn 站点:部署
  • 通过打开浏览器访问http://your_project.sf.net来验证您的网站是否正常工作

带有示例的详细说明

以下示例将使用qifcon项目和用户barrie。将这些替换为您自己的项目名称和用户名。

使用您的用户名和项目组在shell.sourceforge.net上创建一个 shell

$ ssh -t barrie,qifcon@shell.sf.net create
barrie,qifcon@shell.sf.net's password:

Requesting a new shell for "barrie" and waiting for it to start.
queued... creating... starting...

This is an interactive shell created for user barrie,qifcon.
Use the "timeleft" command to see how much time remains before shutdown.
Use the "shutdown" command to destroy the shell before the time limit.
For path information and login help, type "sf-help".

-bash-3.2$

在您的站点 URL 中使用shell.sourceforge.net(而不是web.sourceforge.net )

在项目的pom.xml中:

  ...
  <distributionManagement>
    ...
    <site>
      <id>qifcon.sf.net</id>
      <url>scp://shell.sourceforge.net/home/project-web/qifcon/htdocs</url>
    </site>
  </distributionManagement>
  ...

运行mvn 站点:部署

C:\ide\Finance\qifcon\site>mvn site:deploy
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'site'.
[INFO] ------------------------------------------------------------------------
[INFO] Building QifCon
[INFO]    task-segment: [site:deploy]
[INFO] ------------------------------------------------------------------------
[INFO] [site:deploy]
Using private key: C:\Projects\putty\barrie@sourceforge-net.openssh
scp://shell.sourceforge.net/home/groups/q/qi/qifcon/htdocs - Session: Opened
Executing command: mkdir -p /home/groups/q/qi/qifcon/htdocs/.
Executing command: mkdir -p /home/groups/q/qi/qifcon/htdocs/.
Executing command: scp -t /home/groups/q/qi/qifcon/htdocs/./wagon51463.zip
Uploading: ./wagon51463.zip to scp://shell.sourceforge.net/home/groups/q/qi/qifcon/htdocs

########################
Transfer finished. 95979 bytes copied in 1.812 seconds
Executing command: cd /home/groups/q/qi/qifcon/htdocs/.; unzip -q -o wagon51463.zip; rm -f wagon51463.zip
Executing command: chmod -Rf g+w,a+rX /home/groups/q/qi/qifcon/htdocs
scp://shell.sourceforge.net/home/groups/q/qi/qifcon/htdocs - Session: Disconnecting
scp://shell.sourceforge.net/home/groups/q/qi/qifcon/htdocs - Session: Disconnected
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 30 seconds
[INFO] Finished at: Sat Nov 08 08:09:40 CST 2008
[INFO] Final Memory: 6M/11M
[INFO] ------------------------------------------------------------------------

验证您有一个有效的网站

打开浏览器访问http://qifcon.sf.net

故障排除

尝试部署到web.sourceforge.net

部署到web.sourceforge.net的可接受方法是:SFTP、SCP、rsync over SSH。

这意味着可以上传 Wagon 创建的压缩存档,但 Wagon 用于创建目录、解压缩和 chmod 文件的命令将静默失败。

有两种类型的故障:

  1. 无此文件或目录

    如果您要部署到尚不存在的子目录中,则会发生这种情况。原因是mkdir命令静默失败。

    此错误的示例:

    C:\ide\Finance\qifcon\site>mvn site:deploy
    [INFO] Scanning for projects...
    [INFO] Searching repository for plugin with prefix: 'site'.
    [INFO] ------------------------------------------------------------------------
    [INFO] Building QifCon
    [INFO]    task-segment: [site:deploy]
    [INFO] ------------------------------------------------------------------------
    [INFO] [site:deploy]
    Using private key: C:\Projects\putty\barrie@sourceforge-net.openssh
    scp://web.sourceforge.net/home/groups/q/qi/qifcon/htdocs/site - Session: Opened
    Executing command: mkdir -p /home/groups/q/qi/qifcon/htdocs/site/.
    Executing command: mkdir -p /home/groups/q/qi/qifcon/htdocs/site/.
    Executing command: scp -t /home/groups/q/qi/qifcon/htdocs/site/./wagon12736.zip
    scp://web.sourceforge.net/home/groups/q/qi/qifcon/htdocs/site - Session: Disconnecting
    scp://web.sourceforge.net/home/groups/q/qi/qifcon/htdocs/site - Session: Disconnected
    [INFO] ------------------------------------------------------------------------
    [ERROR] BUILD ERROR
    [INFO] ------------------------------------------------------------------------
    [INFO] Error uploading site
    
    Embedded error: SCP terminated with error: 'scp: /home/groups/q/qi/qifcon/htdocs/site/./wagon12736.zip: No such file or directory'
    [INFO] ------------------------------------------------------------------------
    [INFO] For more information, run Maven with the -e switch
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 15 seconds
    [INFO] Finished at: Sat Nov 08 07:27:34 CST 2008
    [INFO] Final Memory: 6M/11M
    [INFO] ------------------------------------------------------------------------
    
  2. 无法解压缩 Wagon 创建的 zip 文件

    如果该目录存在,则可以上传 Wagon zip 文件,并且site:deploy将显示成功,但该网站将无法工作,因为无法解压缩 Wagon zip 文件。

    C:\ide\Finance\qifcon\site>mvn site:deploy
    [INFO] Scanning for projects...
    [INFO] Searching repository for plugin with prefix: 'site'.
    [INFO] ------------------------------------------------------------------------
    [INFO] Building QifCon
    [INFO]    task-segment: [site:deploy]
    [INFO] ------------------------------------------------------------------------
    [INFO] [site:deploy]
    Using private key: C:\Projects\putty\barrie@sourceforge-net.openssh
    scp://web.sourceforge.net/home/groups/q/qi/qifcon/htdocs/site - Session: Opened
    Executing command: mkdir -p /home/groups/q/qi/qifcon/htdocs/site/.
    Executing command: mkdir -p /home/groups/q/qi/qifcon/htdocs/site/.
    Executing command: scp -t /home/groups/q/qi/qifcon/htdocs/site/./wagon21889.zip
    Uploading: ./wagon21889.zip to scp://web.sourceforge.net/home/groups/q/qi/qifcon/htdocs/site
    
    ########################
    Transfer finished. 95979 bytes copied in 1.872 seconds
    Executing command: cd /home/groups/q/qi/qifcon/htdocs/site/.; unzip -q -o wagon21889.zip; rm -f wagon21889.zip
    Executing command: chmod -Rf g+w,a+rX /home/groups/q/qi/qifcon/htdocs/site
    scp://web.sourceforge.net/home/groups/q/qi/qifcon/htdocs/site - Session: Disconnecting
    scp://web.sourceforge.net/home/groups/q/qi/qifcon/htdocs/site - Session: Disconnected
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESSFUL
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 18 seconds
    [INFO] Finished at: Sat Nov 08 07:51:04 CST 2008
    [INFO] Final Memory: 6M/11M
    [INFO] ------------------------------------------------------------------------
    

没有创建外壳错误

如果您尝试在不先创建 shell 的情况下运行ssh ,您将收到以下错误:

$ ssh barrie,qifcon@shell.sf.net
barrie,qifcon@shell.sf.net's password:
Logging in to your interactive shell...

You don't have an active shell at this time.  For basic file transfers and
management, use web.sourceforge.net -- it allows rsync, sftp, and scp access.

If you would like to create a shell, use ssh to login using a USER,PROJECT
username with the "create" command.  If you tell ssh to allocate a tty
(e.g. using -t), an interactive shell will be opened when the create is
done.  Otherwise, the create command will exit when the shell becomes
ready for use.  An example create that enters the shell when ready:

    ssh -t USER,PROJECT@shell.sourceforge.net create

Connection to shell.sf.net closed.