protected boolean isSiteEmpty( Site site ) { return StringUtils.isEmpty( site.getId() ) && StringUtils.isEmpty( site.getName() ) && StringUtils.isEmpty( site.getUrl() ); }
@Override protected void mergeSite_Url( Site target, Site source, boolean sourceDominant, Map<Object, Object> context ) { String src = source.getUrl(); if ( src != null ) { if ( sourceDominant ) { target.setUrl( src ); target.setLocation( "url", source.getLocation( "url" ) ); } else if ( target.getUrl() == null ) { target.setUrl( extrapolateChildUrl( src, source.isChildSiteUrlInheritAppendPath(), context ) ); target.setLocation( "url", source.getLocation( "url" ) ); } } }
public static Site cloneSite( Site src ) { if ( src == null ) { return null; } Site result = new Site(); result.setId( src.getId() ); result.setName( src.getName() ); result.setUrl( src.getUrl() ); return result; }
/** * Method writeSite. * * @param site * @param serializer * @param tagName * @throws java.io.IOException */ private void writeSite( Site site, String tagName, XmlSerializer serializer ) throws java.io.IOException { serializer.startTag( NAMESPACE, tagName ); if ( site.getChildSiteUrlInheritAppendPath() != null ) { serializer.attribute( NAMESPACE, "child.site.url.inherit.append.path", site.getChildSiteUrlInheritAppendPath() ); } if ( site.getId() != null ) { serializer.startTag( NAMESPACE, "id" ).text( site.getId() ).endTag( NAMESPACE, "id" ); } if ( site.getName() != null ) { serializer.startTag( NAMESPACE, "name" ).text( site.getName() ).endTag( NAMESPACE, "name" ); } if ( site.getUrl() != null ) { serializer.startTag( NAMESPACE, "url" ).text( site.getUrl() ).endTag( NAMESPACE, "url" ); } serializer.endTag( NAMESPACE, tagName ); } //-- void writeSite( Site, String, XmlSerializer )
@Override public void normalize( Model model, ModelBuildingRequest request ) { if ( model == null ) { return; } model.setUrl( normalize( model.getUrl() ) ); Scm scm = model.getScm(); if ( scm != null ) { scm.setUrl( normalize( scm.getUrl() ) ); scm.setConnection( normalize( scm.getConnection() ) ); scm.setDeveloperConnection( normalize( scm.getDeveloperConnection() ) ); } DistributionManagement dist = model.getDistributionManagement(); if ( dist != null ) { Site site = dist.getSite(); if ( site != null ) { site.setUrl( normalize( site.getUrl() ) ); } } }
/** * Method writeSite. * * @param site * @param serializer * @param tagName * @throws java.io.IOException */ private void writeSite( Site site, String tagName, XmlSerializer serializer ) throws java.io.IOException { serializer.startTag( NAMESPACE, tagName ); if ( site.getId() != null ) { serializer.attribute( NAMESPACE, "id", site.getId() ); } if ( site.getName() != null ) { serializer.attribute( NAMESPACE, "name", site.getName() ); } if ( site.getUrl() != null ) { serializer.attribute( NAMESPACE, "url", site.getUrl() ); } serializer.endTag( NAMESPACE, tagName ); } //-- void writeSite( Site, String, XmlSerializer )
void distribution( DistributionManagement distribution ){ if ( distribution != null ){ p.printStartBlock( "distribution" ); if ( distribution.getRepository() != null ){ printRepositories("repository", distribution.getRepository() ); } if ( distribution.getSnapshotRepository() != null ){ printRepositories("snapshot_repository", distribution.getSnapshotRepository() ); } if ( distribution.getSite() != null ){ Site site = distribution.getSite(); p.printWithOptions( "site", options( "id", site.getId(), "name", site.getName(), "url", site.getUrl() ) ); } p.printEndBlock(); p.println(); } }
/** * Deploy distribution site url is directly the current project value. */ @Override protected String determineTopDistributionManagementSiteUrl() throws MojoExecutionException { return getDeploySite().getUrl(); }
/** * Find the relative path between the distribution URLs of the top site and the current project. * * @return the relative path or "./" if the two URLs are the same. * @throws MojoExecutionException */ protected String getDeployModuleDirectory() throws MojoExecutionException { String relative = siteTool.getRelativePath( getSite( project ).getUrl(), getTopDistributionManagementSiteUrl() ); // SiteTool.getRelativePath() uses File.separatorChar, // so we need to convert '\' to '/' in order for the URL to be valid for Windows users relative = relative.replace( '\\', '/' ); return ( "".equals( relative ) ) ? "./" : relative; }
/** * Return distributionManagement.site.url if defined, null otherwise. * * @param model not null * @return could be null */ private static String getDistMgmntSiteUrl( Model model ) { if ( model.getDistributionManagement() != null && model.getDistributionManagement().getSite() != null ) { return urlEncode( model.getDistributionManagement().getSite().getUrl() ); } return null; }
/** * Return distributionManagement.site.url if defined, null otherwise. * * @param project not null * @return could be null */ private static String getDistMgmntSiteUrl( MavenProject project ) { if ( project.getDistributionManagement() != null && project.getDistributionManagement().getSite() != null ) { return urlEncode( project.getDistributionManagement().getSite().getUrl() ); } return null; }
@Override public void execute() throws MojoExecutionException, MojoFailureException { String siteURL = getRootProjectProperty(project, "siteURL"); siteURL = replaceProperties(siteURL); if (siteURL != null) { project.getModel().getProperties().put("siteURL", siteURL); } updateSiteUrl(replaceProperties(project.getUrl()), replaceProperties(project.getDistributionManagement().getSite().getUrl())); }
private String getDocumentationUrl() { if (getContext() instanceof MavenEnricherContext) { MavenEnricherContext mavenEnricherContext = (MavenEnricherContext) getContext(); MavenProject currentProject = mavenEnricherContext.getProject(); while (currentProject != null) { DistributionManagement distributionManagement = currentProject.getDistributionManagement(); if (distributionManagement != null) { Site site = distributionManagement.getSite(); if (site != null) { return site.getUrl(); } } currentProject = currentProject.getParent(); } } return null; }
/** * Method updateSite * * @param value * @param element * @param counter * @param xmlTag */ protected void updateSite(Site value, String xmlTag, Counter counter, Element element) { boolean shouldExist = value != null; Element root = updateElement(counter, element, xmlTag, shouldExist); if (shouldExist) { Counter innerCount = new Counter(counter.getDepth() + 1); findAndReplaceSimpleElement(innerCount, root, "id", value.getId(), null); findAndReplaceSimpleElement(innerCount, root, "name", value.getName(), null); findAndReplaceSimpleElement(innerCount, root, "url", value.getUrl(), null); } } //-- void updateSite(Site, String, Counter, Element)