View Javadoc

1   package org.apache.maven.plugins.site;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *   http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import org.apache.maven.model.Site;
23  import org.apache.maven.plugin.MojoExecutionException;
24  import org.apache.maven.plugins.annotations.Mojo;
25  
26  /**
27   * Deploys the generated site using <a href="/wagon/">wagon supported
28   * protocols</a> to the site URL specified in the
29   * <code>&lt;distributionManagement&gt;</code> section of the POM.
30   * <p>
31   * For <code>scp</code> protocol, the website files are packaged by wagon into zip archive,
32   * then the archive is transfered to the remote host, next it is un-archived which is much faster
33   * than making a file by file copy.
34   * </p>
35   *
36   * @author <a href="mailto:michal@org.codehaus.org">Michal Maczka</a>
37   * @version $Id: SiteDeployMojo.java 1356796 2012-07-03 15:50:08Z olamy $
38   */
39  @Mojo( name = "deploy" )
40  public class SiteDeployMojo
41      extends AbstractDeployMojo
42  {
43      private Site site;
44  
45      @Override
46      public String getDeployRepositoryID()
47          throws MojoExecutionException
48      {
49          if ( site == null )
50          {
51              site = getRootSite( project );
52          }
53  
54          return site.getId();
55      }
56  
57      @Override
58      public String getDeployRepositoryURL()
59          throws MojoExecutionException
60      {
61          if ( site == null )
62          {
63              site = getRootSite( project );
64          }
65  
66          return site.getUrl();
67      }
68  }