添加协议以部署站点

开箱即用,Maven 仅支持file:http:https:scp:作为传输协议。

如果您尝试使用不受支持的协议部署站点,则会收到错误消息:

[ERROR] 
Unsupported protocol: '...' for site deployment to distributionManagement.site.url=...
Currently supported protocols are: ...
    Protocols may be added through wagon providers.
    For more information, see http://maven.apache.org/plugins/maven-site-plugin/examples/adding-deploy-protocol.html

如错误消息中所述,要使用非内置协议部署站点,您需要添加相应的wagon provider

您可以将其添加为全局扩展,或将其声明为站点插件的依赖项:

<project>
  ...
  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-site-plugin</artifactId>
          <version>3.11.0</version>
          <dependencies>
            <dependency><!-- add support for ssh/scp -->
              <groupId>org.apache.maven.wagon</groupId>
              <artifactId>wagon-ssh</artifactId>
              <version>1.0</version>
            </dependency>
          </dependencies>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>
  ...
</project>