public String getArtifactId() { return getModel().getArtifactId(); }
@Override protected void mergeModel( Model target, Model source, boolean sourceDominant, Map<Object, Object> context ) { context.put( ARTIFACT_ID, target.getArtifactId() ); super.mergeModel( target, source, sourceDominant, context ); }
public String getArtifactId() { return getModel().getArtifactId(); }
protected void mergeModel_ArtifactId( Model target, Model source, boolean sourceDominant, Map<Object, Object> context ) { String src = source.getArtifactId(); if ( src != null ) { if ( sourceDominant || target.getArtifactId() == null ) { target.setArtifactId( src ); target.setLocation( "artifactId", source.getLocation( "artifactId" ) ); } } }
@Override public void assembleModelInheritance( Model child, Model parent, ModelBuildingRequest request, ModelProblemCollector problems ) { Map<Object, Object> hints = new HashMap<>(); String childPath = child.getProperties().getProperty( CHILD_DIRECTORY_PROPERTY, child.getArtifactId() ); hints.put( CHILD_DIRECTORY, childPath ); hints.put( MavenModelMerger.CHILD_PATH_ADJUSTMENT, getChildPathAdjustment( child, parent, childPath ) ); merger.merge( child, parent, false, hints ); }
/** * @return the model id as <code>groupId:artifactId:packaging:version</code> */ public String getId() { StringBuilder id = new StringBuilder( 64 ); id.append( ( getGroupId() == null ) ? "[inherited]" : getGroupId() ); id.append( ":" ); id.append( getArtifactId() ); id.append( ":" ); id.append( getPackaging() ); id.append( ":" ); id.append( ( getVersion() == null ) ? "[inherited]" : getVersion() ); return id.toString(); }
private static String getKey( Model model ) { return "project>" + model.getGroupId() + ":" + model.getArtifactId() + ":" + model.getVersion(); }
private void validateEffectiveModelAgainstDependency( String prefix, ModelProblemCollector problems, Model m, Dependency d, ModelBuildingRequest request ) { String key = d.getGroupId() + ":" + d.getArtifactId() + ":" + d.getVersion() + ( d.getClassifier() != null ? ":" + d.getClassifier() : "" ); String mKey = m.getGroupId() + ":" + m.getArtifactId() + ":" + m.getVersion(); if ( key.equals( mKey ) ) { // This means a module which is build has a dependency which has the same // groupId, artifactId, version and classifier coordinates. This is in consequence // a self reference or in other words a circular reference which can not being resolved. addViolation( problems, Severity.FATAL, Version.V31, prefix + " " + key, key, "is referencing itself.", d ); } }
String childName = child.getArtifactId();
projVersionStr = model.getParent().getVersion(); String projectName = model.getGroupId() + ":" + model.getArtifactId(); assertNotNull("Unable to resolve project version for " + projectName, projVersionStr ); } catch( FileNotFoundException fnfe ) {
private void validate20RawDependenciesSelfReferencing( ModelProblemCollector problems, Model m, List<Dependency> dependencies, String prefix, ModelBuildingRequest request ) { // We only check for groupId/artifactId/version/classifier cause if there is another // module with the same groupId/artifactId/version/classifier this will fail the build // earlier like "Project '...' is duplicated in the reactor. // So it is sufficient to check only groupId/artifactId/version/classifier and not the // packaging type. for ( Dependency dependency : dependencies ) { String key = dependency.getGroupId() + ":" + dependency.getArtifactId() + ":" + dependency.getVersion() + ( dependency.getClassifier() != null ? ":" + dependency.getClassifier() : "" ); String mKey = m.getGroupId() + ":" + m.getArtifactId() + ":" + m.getVersion(); if ( key.equals( mKey ) ) { // This means a module which is build has a dependency which has the same // groupId, artifactId, version and classifier coordinates. This is in consequence // a self reference or in other words a circular reference which can not being resolved. addViolation( problems, Severity.FATAL, Version.V31, prefix + " " + key, key, "is referencing itself.", dependency ); } } }
private List injectActiveProfiles( ProfileManager profileManager, Model model ) throws ProjectBuildingException { List activeProfiles; if ( profileManager != null ) { try { activeProfiles = profileManager.getActiveProfiles(); } catch ( ProfileActivationException e ) { String projectId = safeVersionlessKey( model.getGroupId(), model.getArtifactId() ); throw new ProjectBuildingException( projectId, e.getMessage(), e ); } for ( Iterator it = activeProfiles.iterator(); it.hasNext(); ) { Profile profile = (Profile) it.next(); profileInjector.inject( profile, model ); } } else { activeProfiles = Collections.EMPTY_LIST; } return activeProfiles; }
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 List buildArtifactRepositories( Model model ) throws ProjectBuildingException { try { return ProjectUtils.buildArtifactRepositories( model.getRepositories(), artifactRepositoryFactory, container ); } catch ( InvalidRepositoryException e ) { String projectId = safeVersionlessKey( model.getGroupId(), model.getArtifactId() ); throw new ProjectBuildingException( projectId, e.getMessage(), e ); } }
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 populateReactorModelPool( ReactorModelPool reactorModelPool, List<InterimResult> interimResults ) { for ( InterimResult interimResult : interimResults ) { Model model = interimResult.result.getEffectiveModel(); reactorModelPool.put( model.getGroupId(), model.getArtifactId(), model.getVersion(), model.getPomFile() ); populateReactorModelPool( reactorModelPool, interimResult.modules ); } }
static String toId( Model model ) { if ( model == null ) { return ""; } String groupId = model.getGroupId(); if ( groupId == null && model.getParent() != null ) { groupId = model.getParent().getGroupId(); } String artifactId = model.getArtifactId(); String version = model.getVersion(); if ( version == null ) { version = "[unknown-version]"; } return toId( groupId, artifactId, version ); }
appendPath( site.getUrl(), child.getArtifactId(), childPathAdjustment, appendPaths ) );
appendPath( site.getUrl(), child.getArtifactId(), childPathAdjustment, appendPaths ) );
result.setArtifactId( src.getArtifactId() ); result.setBuild( cloneBuild( src.getBuild() ) ); result.setCiManagement( cloneCiManagement( src.getCiManagement() ) );