org.apache.maven.model.Contributor Java Examples
The following examples show how to use
org.apache.maven.model.Contributor.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ScribeMojo.java From Chimera with MIT License | 6 votes |
Project project() { var authors = Stream.of(pom.getContributors(), pom.getDevelopers()) .flatMap(Collection::stream) .map(Contributor::getName) .collect(toList()); var api = ""; for (var dependency : pom.getDependencies()) { var group = Project.DEPENDENCIES.get(dependency.getArtifactId()); if (Objects.equals(group, dependency.getGroupId())) { api = dependency.getVersion(); break; } } return new Project(pom.getName(), pom.getVersion(), api, authors, pom.getDescription(), pom.getUrl()); }
Example #2
Source File: RequireRolesTest.java From extra-enforcer-rules with Apache License 2.0 | 6 votes |
/** * Test of getRolesFromMaven method, of class AbstractRequireRoles. */ @Test public void testGetRolesFromMaven() { HashSet<String> expResult = new HashSet<String>( Arrays.asList( "quality manager", "product owner", "business engineer" ) ); final Contributor singleHero = new Contributor(); singleHero.addRole( "quality manager" ); singleHero.addRole( "business engineer" ); singleHero.addRole( "product owner" ); List<Contributor> listFromMaven = Arrays.asList( singleHero ); final HashSet<String> result = new HashSet<String>(); for ( final Contributor contributor : listFromMaven ) { @SuppressWarnings( "unchecked" ) List<String> roles = contributor.getRoles(); for ( String role : roles ) { result.add( role ); } } assertEquals( expResult, result ); }
Example #3
Source File: RequireRolesTest.java From extra-enforcer-rules with Apache License 2.0 | 5 votes |
private void addProjectHavingAnArchitectAsDeveloperAndABusinessEngineerAsContributorToHelper() throws Exception { final MavenProject mavenProject = new MavenProject(); final Developer developer = new Developer(); developer.addRole( "architect" ); mavenProject.addDeveloper( developer ); final Contributor contributor = new Contributor(); contributor.addRole( "business engineer" ); mavenProject.addContributor( contributor ); Mockito.when( helper.evaluate( "${project}" ) ).thenReturn( mavenProject ); }
Example #4
Source File: ProjectTeamRenderer.java From maven-confluence-plugin with Apache License 2.0 | 4 votes |
private void renderTeamMember( Contributor member, int rowId, Map<String, Boolean> headersMap, StringBuilder javascript ) { sink.tableRow(); if ( headersMap.get( IMAGE ) == Boolean.TRUE && showAvatarImages ) { Properties properties = member.getProperties(); String picUrl = properties.getProperty( "picUrl" ); if ( StringUtils.isEmpty( picUrl ) ) { picUrl = getGravatarUrl( member.getEmail() ); } if ( StringUtils.isEmpty( picUrl ) ) { picUrl = getSpacerGravatarUrl(); } sink.tableCell(); sink.figure(); sink.figureGraphics( picUrl ); sink.figure_(); sink.tableCell_(); } //String type = "contributor"; if ( member instanceof Developer ) { //type = "developer"; if ( headersMap.get( ID ) == Boolean.TRUE ) { String id = ( (Developer) member ).getId(); if ( id == null ) { tableCell( null ); } else { //tableCell( "<a name=\"" + id + "\"></a>" + id, true ); tableCell( id, true ); } } } if ( headersMap.get( NAME ) == Boolean.TRUE ) { tableCell( member.getName() ); } if ( headersMap.get( EMAIL ) == Boolean.TRUE ) { tableCell( createLinkPatternedText( member.getEmail(), member.getEmail() ) ); } if ( headersMap.get( URL ) == Boolean.TRUE ) { tableCellForUrl( member.getUrl() ); } if ( headersMap.get( ORGANIZATION ) == Boolean.TRUE ) { tableCell( member.getOrganization() ); } if ( headersMap.get( ORGANIZATION_URL ) == Boolean.TRUE ) { tableCellForUrl( member.getOrganizationUrl() ); } if ( headersMap.get( ROLES ) == Boolean.TRUE ) { if ( member.getRoles() != null ) { // Comma separated roles List<String> var = member.getRoles(); tableCell( StringUtils.join( var.toArray( new String[var.size()] ), ", " ) ); } else { tableCell( null ); } } if ( headersMap.get( TIME_ZONE ) == Boolean.TRUE ) { tableCell( member.getTimezone() ); } if ( headersMap.get( PROPERTIES ) == Boolean.TRUE ) { Properties props = member.getProperties(); if ( props != null ) { tableCell( propertiesToString( props ) ); } else { tableCell( null ); } } sink.tableRow_(); }
Example #5
Source File: ProjectTeamRenderer.java From maven-confluence-plugin with Apache License 2.0 | 4 votes |
/** * @param units contributors and developers to check * @return required headers */ private Map<String, Boolean> checkRequiredHeaders( List<? extends Contributor> units ) { Map<String, Boolean> requiredHeaders = new HashMap<String, Boolean>(); requiredHeaders.put( IMAGE, Boolean.FALSE ); requiredHeaders.put( ID, Boolean.FALSE ); requiredHeaders.put( NAME, Boolean.FALSE ); requiredHeaders.put( EMAIL, Boolean.FALSE ); requiredHeaders.put( URL, Boolean.FALSE ); requiredHeaders.put( ORGANIZATION, Boolean.FALSE ); requiredHeaders.put( ORGANIZATION_URL, Boolean.FALSE ); requiredHeaders.put( ROLES, Boolean.FALSE ); requiredHeaders.put( TIME_ZONE, Boolean.FALSE ); requiredHeaders.put( PROPERTIES, Boolean.FALSE ); for ( Contributor unit : units ) { if ( unit instanceof Developer ) { Developer developer = (Developer) unit; if ( StringUtils.isNotEmpty( developer.getId() ) ) { requiredHeaders.put( ID, Boolean.TRUE ); } } if ( StringUtils.isNotEmpty( unit.getName() ) ) { requiredHeaders.put( NAME, Boolean.TRUE ); } if ( StringUtils.isNotEmpty( unit.getEmail() ) ) { requiredHeaders.put( EMAIL, Boolean.TRUE ); requiredHeaders.put( IMAGE, Boolean.TRUE ); } if ( StringUtils.isNotEmpty( unit.getUrl() ) ) { requiredHeaders.put( URL, Boolean.TRUE ); } if ( StringUtils.isNotEmpty( unit.getOrganization() ) ) { requiredHeaders.put( ORGANIZATION, Boolean.TRUE ); } if ( StringUtils.isNotEmpty( unit.getOrganizationUrl() ) ) { requiredHeaders.put( ORGANIZATION_URL, Boolean.TRUE ); } if ( !isEmpty( unit.getRoles() ) ) { requiredHeaders.put( ROLES, Boolean.TRUE ); } if ( StringUtils.isNotEmpty( unit.getTimezone() ) ) { requiredHeaders.put( TIME_ZONE, Boolean.TRUE ); } Properties properties = unit.getProperties(); boolean hasPicUrl = properties.containsKey( "picUrl" ); if ( hasPicUrl ) { requiredHeaders.put( IMAGE, Boolean.TRUE ); } boolean isJustAnImageProperty = properties.size() == 1 && hasPicUrl; if ( !isJustAnImageProperty && !properties.isEmpty() ) { requiredHeaders.put( PROPERTIES, Boolean.TRUE ); } } return requiredHeaders; }
Example #6
Source File: RequireContributorRoles.java From extra-enforcer-rules with Apache License 2.0 | 4 votes |
@Override protected List<Contributor> getRoles( MavenProject mavenProject ) { return mavenProject.getContributors(); }
Example #7
Source File: PomProperty.java From flatten-maven-plugin with Apache License 2.0 | 4 votes |
@Override public List<Contributor> get( Model model ) { return model.getContributors(); }
Example #8
Source File: PomProperty.java From flatten-maven-plugin with Apache License 2.0 | 4 votes |
@Override public void set( Model model, List<Contributor> value ) { model.setContributors( value ); }