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; }
protected void mergeScm_Url( Scm target, Scm source, boolean sourceDominant, Map<Object, Object> context ) { String src = source.getUrl(); if ( src != null ) { if ( sourceDominant || target.getUrl() == null ) { target.setUrl( src ); target.setLocation( "url", source.getLocation( "url" ) ); } } }
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" ) ); } } }
void sourceControl( Scm scm ){ if ( scm != null ){ p.printWithOptions( "source_control", options( "url", scm.getUrl(), "connection", scm.getConnection(), "developer_connection", scm.getDeveloperConnection(), "tag", scm.getTag().equals( "HEAD" ) ? null : scm.getTag() ) ); p.println(); } }
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 scm = new Scm(); for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- ) scm.setConnection( getTrimmedValue( value ) ); scm.setDeveloperConnection( getTrimmedValue( value ) ); scm.setTag( getTrimmedValue( value ) ); scm.setUrl( getTrimmedValue( value ) );
private String getSCMConnection() throws MojoExecutionException { if (this.project.getScm() == null) { throw new MojoExecutionException("No SCM Connection configured."); } final String scmConnection = this.project.getScm().getConnection(); if ("connection".equalsIgnoreCase(this.connectionType) && StringUtils.isNotEmpty(scmConnection)) { return scmConnection; } final String scmDeveloper = this.project.getScm().getDeveloperConnection(); if ("developerconnection".equalsIgnoreCase(this.connectionType) && StringUtils.isNotEmpty(scmDeveloper)) { return scmDeveloper; } throw new MojoExecutionException("SCM Connection is not set."); }
if ( scm.getChildScmConnectionInheritAppendPath() != null ) serializer.attribute( NAMESPACE, "child.scm.connection.inherit.append.path", scm.getChildScmConnectionInheritAppendPath() ); if ( scm.getChildScmDeveloperConnectionInheritAppendPath() != null ) serializer.attribute( NAMESPACE, "child.scm.developerConnection.inherit.append.path", scm.getChildScmDeveloperConnectionInheritAppendPath() ); if ( scm.getChildScmUrlInheritAppendPath() != null ) serializer.attribute( NAMESPACE, "child.scm.url.inherit.append.path", scm.getChildScmUrlInheritAppendPath() ); if ( scm.getConnection() != null ) serializer.startTag( NAMESPACE, "connection" ).text( scm.getConnection() ).endTag( NAMESPACE, "connection" ); if ( scm.getDeveloperConnection() != null ) serializer.startTag( NAMESPACE, "developerConnection" ).text( scm.getDeveloperConnection() ).endTag( NAMESPACE, "developerConnection" ); if ( ( scm.getTag() != null ) && !scm.getTag().equals( "HEAD" ) ) serializer.startTag( NAMESPACE, "tag" ).text( scm.getTag() ).endTag( NAMESPACE, "tag" ); if ( scm.getUrl() != null ) serializer.startTag( NAMESPACE, "url" ).text( scm.getUrl() ).endTag( NAMESPACE, "url" );
public void validateTrimmedScm(Scm scm, String actualUrl) { validateUrls(scm.getDeveloperConnection(), actualUrl); validateUrls(scm.getConnection(), actualUrl); validateUrls(scm.getUrl(), actualUrl); }
/** * For SONAR-3676 */ private static void convertMavenLinksToProperties(Map<String, String> props, MavenProject pom) { setPropertyIfNotAlreadyExists(props, LINKS_HOME_PAGE, pom.getUrl()); Scm scm = pom.getScm(); if (scm == null) { scm = new Scm(); } setPropertyIfNotAlreadyExists(props, LINKS_SOURCES, scm.getUrl()); setPropertyIfNotAlreadyExists(props, LINKS_SOURCES_DEV, scm.getDeveloperConnection()); CiManagement ci = pom.getCiManagement(); if (ci == null) { ci = new CiManagement(); } setPropertyIfNotAlreadyExists(props, LINKS_CI, ci.getUrl()); IssueManagement issues = pom.getIssueManagement(); if (issues == null) { issues = new IssueManagement(); } setPropertyIfNotAlreadyExists(props, LINKS_ISSUE_TRACKER, issues.getUrl()); }
if ( scm == null ) scm = new Scm(); model.setScm( scm ); if ( scm.getUrl() == null ) scm.setUrl( scmUrl ); scm.setUrl( inputHandler.readLine() ); rewrite = true; if ( scm.getConnection() == null ) scm.setConnection( scmConnection ); scm.setConnection( inputHandler.readLine() ); rewrite = true;
protected void mergeScm_DeveloperConnection( Scm target, Scm source, boolean sourceDominant, Map<Object, Object> context ) { String src = source.getDeveloperConnection(); if ( src != null ) { if ( sourceDominant || target.getDeveloperConnection() == null ) { target.setDeveloperConnection( src ); target.setLocation( "developerConnection", source.getLocation( "developerConnection" ) ); } } }
Scm scm = new Scm(); for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- ) scm.setChildScmConnectionInheritAppendPath( interpolatedTrimmed( value, "child.scm.connection.inherit.append.path" ) ); scm.setChildScmDeveloperConnectionInheritAppendPath( interpolatedTrimmed( value, "child.scm.developerConnection.inherit.append.path" ) ); scm.setChildScmUrlInheritAppendPath( interpolatedTrimmed( value, "child.scm.url.inherit.append.path" ) ); scm.setConnection( interpolatedTrimmed( parser.nextText(), "connection" ) ); scm.setDeveloperConnection( interpolatedTrimmed( parser.nextText(), "developerConnection" ) ); scm.setTag( interpolatedTrimmed( parser.nextText(), "tag" ) ); scm.setUrl( interpolatedTrimmed( parser.nextText(), "url" ) );
private String createScmUrl() { Scm scm = mavenProject.getScm(); String connection = scm.getConnection(); if(connection.contains("git@github.com:")){ connection = connection.replace("git@github.com:", "https://github.com/"); } return connection; }
public String svnurl() throws IOException { try { return maven.loadPom(artifact).getScm().getUrl(); } catch (ProjectBuildingException | RepositoryException e) { throw new IOException(e.getMessage(), e); } }
private Optional<MinSourcesConfiguration> sources() { final Log log = this.getLog(); final Scm scm = this.project.getScm(); if (scm != null) { final String connection = scm.getConnection(); if (connection.startsWith("scm:git")) { return Optional.of( MinSourcesConfiguration.of( "Git", URI.create(scm.getUrl()))); } log.error("Unrecognized SCM type: " + connection); return Optional.empty(); } return Optional.empty(); } }
@Override protected void update(ModifiedPomXMLEventReader pom) throws MojoExecutionException, MojoFailureException, XMLStreamException, ArtifactMetadataRetrievalException { try { Model model = PomHelper.getRawModel( pom ); Scm scm = model.getScm(); if (scm == null) { throw new MojoFailureException( "No <scm> was present" ); } getLog().info( "Updating from tag " + scm.getTag() + " > " + newTag ); boolean success = PomHelper.setProjectValue(pom, "/project/scm/tag", newTag ); if ( !success ) { throw new MojoFailureException( "Could not update the SCM tag" ); } } catch ( IOException e ) { throw new MojoExecutionException( e.getMessage(), e ); } } }
private void developerConnectionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_developerConnectionActionPerformed if (developerConnection.isEnabled()) { txtUrl.setText(scm.getDeveloperConnection()); } }//GEN-LAST:event_developerConnectionActionPerformed
@Override public Map<String, String> getAnnotations(Kind kind) { Map<String, String> annotations = new HashMap<>(); if (kind.isController() || kind == Kind.SERVICE) { if (getContext() instanceof MavenEnricherContext) { MavenEnricherContext mavenEnricherContext = (MavenEnricherContext) getContext(); MavenProject rootProject = mavenEnricherContext.getProject(); if (hasScm(rootProject)) { Scm scm = rootProject.getScm(); String url = scm.getUrl(); String tag = scm.getTag(); if (StringUtils.isNotEmpty(tag)) { annotations.put(Fabric8Annotations.SCM_TAG.value(), tag); } if (StringUtils.isNotEmpty(url)) { annotations.put(Fabric8Annotations.SCM_URL.value(), url); } } } } return annotations; }
protected void mergeScm_Tag( Scm target, Scm source, boolean sourceDominant, Map<Object, Object> context ) { String src = source.getTag(); if ( src != null ) { if ( sourceDominant || target.getTag() == null ) { target.setTag( src ); target.setLocation( "tag", source.getLocation( "tag" ) ); } } }