1 package org.apache.maven.plugins.site.deploy; 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.plugin.MojoExecutionException; 23 import org.apache.maven.plugins.annotations.Parameter; 24 import org.apache.maven.project.MavenProject; 25 import org.apache.maven.shared.utils.StringUtils; 26 27 /** 28 * Abstract base class for staging mojos. 29 * 30 * @author hboutemy 31 * @since 3.3 32 */ 33 public abstract class AbstractStagingMojo 34 extends AbstractDeployMojo 35 { 36 /** 37 * Top distribution management site url, for manual configuration when auto-calculated value 38 * doesn't match expectations. Relative module directory will be calculated from this url. 39 * 40 * @since 3.3 41 */ 42 @Parameter( property = "topSiteURL" ) 43 protected String topSiteURL; 44 45 /** 46 * The String "staging/". 47 */ 48 protected static final String DEFAULT_STAGING_DIRECTORY = "staging/"; 49 50 /** 51 * By default, staging mojos will get their top distribution management site url by getting top parent 52 * with the same site, which is a good heuristics. But in case the default value doesn't match 53 * expectations, <code>topSiteURL</code> can be configured: it will be used instead. 54 */ 55 @Override 56 protected String determineTopDistributionManagementSiteUrl() 57 throws MojoExecutionException 58 { 59 if ( StringUtils.isEmpty( topSiteURL ) ) 60 { 61 MavenProject topProject = getTopLevelProject( project ); 62 String url = getSite( topProject ).getUrl(); 63 64 getLog().debug( "staging top distributionManagement.site.url found in " + topProject.getId() 65 + " with value: " + url ); 66 67 return url; 68 } 69 70 getLog().debug( "staging top distributionManagement.site.url configured with topSiteURL parameter: " 71 + topSiteURL ); 72 return topSiteURL; 73 } 74 }