protected void mergeScm_Connection( Scm target, Scm source, boolean sourceDominant, Map<Object, Object> context ) { String src = source.getConnection(); if ( src != null ) { if ( sourceDominant || target.getConnection() == null ) { target.setConnection( src ); target.setLocation( "connection", source.getLocation( "connection" ) ); } } }
@Override protected void mergeScm_Connection( Scm target, Scm source, boolean sourceDominant, Map<Object, Object> context ) { String src = source.getConnection(); if ( src != null ) { if ( sourceDominant ) { target.setConnection( src ); target.setLocation( "connection", source.getLocation( "connection" ) ); } else if ( target.getConnection() == null ) { target.setConnection( extrapolateChildUrl( src, source.isChildScmConnectionInheritAppendPath(), context ) ); target.setLocation( "connection", source.getLocation( "connection" ) ); } } }
public static Scm cloneScm( Scm src ) { if ( src == null ) { return null; } Scm result = new Scm(); result.setConnection( src.getConnection() ); result.setDeveloperConnection( src.getDeveloperConnection() ); result.setTag( src.getTag() ); result.setUrl( src.getUrl() ); return result; }
private void assembleScmInheritance( Model child, Model parent, String childPathAdjustment, boolean appendPaths ) { if ( parent.getScm() != null ) { Scm parentScm = parent.getScm(); Scm childScm = child.getScm(); if ( childScm == null ) { childScm = new Scm(); child.setScm( childScm ); } if ( StringUtils.isEmpty( childScm.getConnection() ) && !StringUtils.isEmpty( parentScm.getConnection() ) ) { childScm.setConnection( appendPath( parentScm.getConnection(), child.getArtifactId(), childPathAdjustment, appendPaths ) ); } if ( StringUtils.isEmpty( childScm.getDeveloperConnection() ) && !StringUtils.isEmpty( parentScm.getDeveloperConnection() ) ) { childScm .setDeveloperConnection( appendPath( parentScm.getDeveloperConnection(), child.getArtifactId(), childPathAdjustment, appendPaths ) ); } if ( StringUtils.isEmpty( childScm.getUrl() ) && !StringUtils.isEmpty( parentScm.getUrl() ) ) { childScm.setUrl( appendPath( parentScm.getUrl(), child.getArtifactId(), childPathAdjustment, appendPaths ) ); } } }
private void assembleScmInheritance( Model child, Model parent, String childPathAdjustment, boolean appendPaths ) { if ( parent.getScm() != null ) { Scm parentScm = parent.getScm(); Scm childScm = child.getScm(); if ( childScm == null ) { childScm = new Scm(); child.setScm( childScm ); } if ( StringUtils.isEmpty( childScm.getConnection() ) && !StringUtils.isEmpty( parentScm.getConnection() ) ) { childScm.setConnection( appendPath( parentScm.getConnection(), child.getArtifactId(), childPathAdjustment, appendPaths ) ); } if ( StringUtils.isEmpty( childScm.getDeveloperConnection() ) && !StringUtils.isEmpty( parentScm.getDeveloperConnection() ) ) { childScm .setDeveloperConnection( appendPath( parentScm.getDeveloperConnection(), child.getArtifactId(), childPathAdjustment, appendPaths ) ); } if ( StringUtils.isEmpty( childScm.getUrl() ) && !StringUtils.isEmpty( parentScm.getUrl() ) ) { childScm.setUrl( appendPath( parentScm.getUrl(), child.getArtifactId(), childPathAdjustment, appendPaths ) ); } } }
scm.setConnection( interpolatedTrimmed( parser.nextText(), "connection" ) );
@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() ) ); } } }
scm.setConnection( interpolatedTrimmed( parser.nextText(), "connection" ) );
scm.setConnection( getTrimmedValue( value ) );
scm.setConnection(this.scm.getConnection()); scm.setDeveloperConnection(this.scm.getDeveloperConnection()); scm.setUrl(this.scm.getUrl());
private void addScm() throws MojoExecutionException { Scm scm = new Scm(); String githubUser = wizard.promptForValueIfMissing(null, "your GitHub username"); String githubRepo = wizard.promptForValueIfMissing(null, "your GitHub repository"); scm.setConnection(String.format(SCM_TMPL_CONNECTION, githubUser, githubRepo)); scm.setDeveloperConnection(String.format(SCM_TMPL_DEV_CONNECTION, githubUser, githubRepo)); scm.setUrl(String.format(SCM_TMPL_URL, githubUser, githubRepo)); scm.setTag(SCM_TAG); mavenProject.setScm(scm); }
protected void mergeScm_Connection( Scm target, Scm source, boolean sourceDominant, Map<Object, Object> context ) { String src = source.getConnection(); if ( src != null ) { if ( sourceDominant || target.getConnection() == null ) { target.setConnection( src ); target.setLocation( "connection", source.getLocation( "connection" ) ); } } }
@Override public void setScm( Scm scm ) { if ( scm == null ) { JDomUtils.rewriteElement( "scm", null, project, project.getNamespace() ); } else { Element scmRoot = new Element( "scm" ); scmRoot.addContent( "\n " ); // Write current values to JDom tree Scm jdomScm = new JDomScm( scmRoot ); jdomScm.setConnection( scm.getConnection() ); jdomScm.setDeveloperConnection( scm.getDeveloperConnection() ); jdomScm.setTag( scm.getTag() ); jdomScm.setUrl( scm.getUrl() ); project.addContent( "\n " ).addContent( scmRoot ).addContent( "\n" ); } }
@Override protected void mergeScm_Connection( Scm target, Scm source, boolean sourceDominant, Map<Object, Object> context ) { String src = source.getConnection(); if ( src != null ) { if ( sourceDominant ) { target.setConnection( src ); target.setLocation( "connection", source.getLocation( "connection" ) ); } else if ( target.getConnection() == null ) { target.setConnection( extrapolateChildUrl( src, source.isChildInheritAppendPath(), context ) ); target.setLocation( "connection", source.getLocation( "connection" ) ); } } }
public Scm getTrimmedScm(Scm scm) { String trimmedDeveloperConnection = getTrimmedScmUrl(scm.getDeveloperConnection()); String trimmedConnection = getTrimmedScmUrl(scm.getConnection()); String trimmedUrl = scm.getUrl().trim(); Scm trimmedScm = new Scm(); trimmedScm.setDeveloperConnection(trimmedDeveloperConnection); trimmedScm.setConnection(trimmedConnection); trimmedScm.setUrl(trimmedUrl); return trimmedScm; }
private Scm translateScm( org.apache.maven.model.v3_0_0.Model v3Model ) { Scm scm = null; org.apache.maven.model.v3_0_0.Repository repo = v3Model.getRepository(); if ( repo != null ) { scm = new Scm(); scm.setConnection( repo.getConnection() ); scm.setDeveloperConnection( repo.getDeveloperConnection() ); scm.setUrl( repo.getUrl() ); } return scm; }
/** * * @param model */ private static void setScmDevUrl(Model model){ model.setScm(new Scm()); model.getScm().setConnection(Constants.OPEN_LIBERTY_SCM_CONNECTION); model.getScm().setDeveloperConnection(Constants.OPEN_LIBERTY_SCM_CONNECTION); model.getScm().setUrl(Constants.OPEN_LIBRETY_SCM_URL); model.getScm().setTag(Constants.OPEN_LIBERTY_SCM_TAG); model.setUrl(Constants.OPEN_LIBERTY_URL); Developer dev = new Developer(); dev.setId(Constants.DEV_ID); dev.setName(Constants.DEV_NAME); dev.setEmail(Constants.DEV_EMAIL); List<Developer> developers = new ArrayList<Developer>(); developers.add(dev); model.setDevelopers(developers); }
protected Scm buildScm( MavenProject project ) { Scm scm; if ( project.getOriginalModel().getScm() == null ) { scm = null; } else { scm = new Scm(); scm.setConnection( project.getOriginalModel().getScm().getConnection() ); scm.setDeveloperConnection( project.getOriginalModel().getScm().getDeveloperConnection() ); scm.setTag( project.getOriginalModel().getScm().getTag() ); scm.setUrl( project.getOriginalModel().getScm().getUrl() ); } return scm; } }
@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() ) ); } } }
private Scm createReleaseScm( Scm scm, ScmTranslator scmTranslator, ReleaseDescriptor releaseDescriptor ) { // TODO: share with RewritePomsForReleasePhase.translateScm String tag = releaseDescriptor.getScmReleaseLabel(); String tagBase = releaseDescriptor.getScmTagBase(); Scm releaseScm = new Scm(); if ( scm.getConnection() != null ) { String value = scmTranslator.translateTagUrl( scm.getConnection(), tag, tagBase ); releaseScm.setConnection( value ); } if ( scm.getDeveloperConnection() != null ) { String value = scmTranslator.translateTagUrl( scm.getDeveloperConnection(), tag, tagBase ); releaseScm.setDeveloperConnection( value ); } if ( scm.getUrl() != null ) { String value = scmTranslator.translateTagUrl( scm.getUrl(), tag, tagBase ); releaseScm.setUrl( value ); } if ( scm.getTag() != null ) { String value = scmTranslator.resolveTag( scm.getTag() ); releaseScm.setTag( value ); } return releaseScm; }