/** * @return the id as <code>groupId:artifactId:version</code> */ public String getId() { StringBuilder id = new StringBuilder( 64 ); id.append( getGroupId() ); id.append( ":" ); id.append( getArtifactId() ); id.append( ":" ); id.append( "pom" ); id.append( ":" ); id.append( getVersion() ); return id.toString(); }
protected void mergeParent_GroupId( Parent target, Parent source, boolean sourceDominant, Map<Object, Object> context ) { String src = source.getGroupId(); if ( src != null ) { if ( sourceDominant || target.getGroupId() == null ) { target.setGroupId( src ); target.setLocation( "groupId", source.getLocation( "groupId" ) ); } } }
public String getGroupId() { String groupId = getModel().getGroupId(); if ( ( groupId == null ) && ( getModel().getParent() != null ) ) { groupId = getModel().getParent().getGroupId(); } return groupId; }
public String getGroupId() { String groupId = getModel().getGroupId(); if ( ( groupId == null ) && ( getModel().getParent() != null ) ) { groupId = getModel().getParent().getGroupId(); } return groupId; }
addEdge( projectMap, vertexMap, null, projectVertex, parent.getGroupId(), parent.getArtifactId(), parent.getVersion(), true, false );
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 ); }
public static Parent cloneParent( Parent src ) { if ( src == null ) { return null; } Parent result = new Parent(); result.setArtifactId( src.getArtifactId() ); result.setGroupId( src.getGroupId() ); result.setRelativePath( src.getRelativePath() ); result.setVersion( src.getVersion() ); return result; }
final Artifact artifact = new DefaultArtifact( parent.getGroupId(), parent.getArtifactId(), "", "pom", parent.getVersion() ); String.format( "No versions matched the requested parent version range '%s'", parent.getVersion() ), parent.getGroupId(), parent.getArtifactId(), parent.getVersion() ); String.format( "The requested parent version range '%s' does not specify an upper bound", parent.getVersion() ), parent.getGroupId(), parent.getArtifactId(), parent.getVersion() ); return resolveModel( parent.getGroupId(), parent.getArtifactId(), parent.getVersion() ); throw new UnresolvableModelException( e.getMessage(), parent.getGroupId(), parent.getArtifactId(), parent.getVersion(), e );
final Artifact artifact = new DefaultArtifact( parent.getGroupId(), parent.getArtifactId(), "", "pom", parent.getVersion() ); String.format( "No versions matched the requested parent version range '%s'", parent.getVersion() ), parent.getGroupId(), parent.getArtifactId(), parent.getVersion() ); String.format( "The requested parent version range '%s' does not specify an upper bound", parent.getVersion() ), parent.getGroupId(), parent.getArtifactId(), parent.getVersion() ); return resolveModel( parent.getGroupId(), parent.getArtifactId(), parent.getVersion() ); throw new UnresolvableModelException( e.getMessage(), parent.getGroupId(), parent.getArtifactId(), parent.getVersion(), e );
if ( parent != null ) if ( parent.getGroupId().equals( model.getGroupId() ) && parent.getArtifactId().equals( model.getArtifactId() ) )
String groupId = parent.getGroupId(); String artifactId = parent.getArtifactId(); String version = parent.getVersion(); ModelData parentData = new ModelData( modelSource, parentModel, parent.getGroupId(), parent.getArtifactId(), parent.getVersion() );
resolver.resolveRawModel( parent.getGroupId(), parent.getArtifactId(), parent.getVersion() ); if ( groupId == null && candidateModel.getParent() != null ) groupId = candidateModel.getParent().getGroupId(); if ( groupId == null || !groupId.equals( parent.getGroupId() ) || artifactId == null || !artifactId.equals( parent.getArtifactId() ) ) buffer.append( " instead of " ).append( parent.getGroupId() ).append( ':' ); buffer.append( parent.getArtifactId() ).append( ", please verify your project structure" );
/** * Method writeParent. * * @param parent * @param serializer * @param tagName * @throws java.io.IOException */ private void writeParent( Parent parent, String tagName, XmlSerializer serializer ) throws java.io.IOException { serializer.startTag( NAMESPACE, tagName ); if ( parent.getGroupId() != null ) { serializer.startTag( NAMESPACE, "groupId" ).text( parent.getGroupId() ).endTag( NAMESPACE, "groupId" ); } if ( parent.getArtifactId() != null ) { serializer.startTag( NAMESPACE, "artifactId" ).text( parent.getArtifactId() ).endTag( NAMESPACE, "artifactId" ); } if ( parent.getVersion() != null ) { serializer.startTag( NAMESPACE, "version" ).text( parent.getVersion() ).endTag( NAMESPACE, "version" ); } if ( ( parent.getRelativePath() != null ) && !parent.getRelativePath().equals( "../pom.xml" ) ) { serializer.startTag( NAMESPACE, "relativePath" ).text( parent.getRelativePath() ).endTag( NAMESPACE, "relativePath" ); } serializer.endTag( NAMESPACE, tagName ); } //-- void writeParent( Parent, String, XmlSerializer )
if ( StringUtils.isEmpty( parentModel.getGroupId() ) ) else if ( parentModel.getGroupId().equals( model.getGroupId() ) && parentModel.getArtifactId().equals( model.getArtifactId() ) ) createCacheKey( parentModel.getGroupId(), parentModel.getArtifactId(), parentModel.getVersion() ); MavenProject parentProject = (MavenProject) rawProjectCache.get( parentKey ); if ( ( candidateParentGroupId == null ) && ( candidateParent.getParent() != null ) ) candidateParentGroupId = candidateParent.getParent().getGroupId(); if ( parentModel.getGroupId().equals( candidateParentGroupId ) && parentModel.getArtifactId().equals( candidateParent.getArtifactId() ) && parentModel.getVersion().equals( candidateParentVersion ) ) parentArtifact = artifactFactory.createParentArtifact( parentModel.getGroupId(), parentModel.getArtifactId(), parentModel.getVersion() );
String groupId = parent.getGroupId(); String artifactId = parent.getArtifactId(); String version = parent.getVersion();
if ( parent != null ) validateStringNotEmpty( "parent.groupId", problems, Severity.FATAL, Version.BASE, parent.getGroupId(), parent ); parent ); if ( equals( parent.getGroupId(), m.getGroupId() ) && equals( parent.getArtifactId(), m.getArtifactId() ) )
private void parent(PrintWriter pw, Model model) { if (model.getParent() != null) { pw.print(indent + "inherits: " + model.getParent().getGroupId() + ":" + model.getParent().getArtifactId() + ":" + model.getParent().getVersion()); if (model.getParent().getRelativePath() != null) { //pw.println(":" + model.getParent().getRelativePath()); // pw.println(":" + "../pom.atom"); } pw.println(); } }
/** * Gets the Maven artifact located at the given by reading the {@value #POM_XML} file two levels up from target/classes. * * @param rootArtifactClassesFolder {@link File} the rootArtifactClassesFolder * @return {@link Artifact} that represents the rootArtifact */ private Artifact getRootArtifact(File rootArtifactClassesFolder) { File pomFile = new File(rootArtifactClassesFolder.getParentFile().getParentFile(), POM_XML); logger.debug("Reading rootArtifact from pom file: {}", pomFile); Model model = MavenModelFactory.createMavenProject(pomFile); return new DefaultArtifact(model.getGroupId() != null ? model.getGroupId() : model.getParent().getGroupId(), model.getArtifactId(), model.getPackaging(), model.getVersion() != null ? model.getVersion() : model.getParent().getVersion()); }
private void id(PrintWriter pw, Model model) { String groupId = model.getGroupId(); if (groupId == null & model.getParent() != null) { groupId = model.getParent().getGroupId(); } String version = model.getVersion(); if (version == null && model.getParent() != null) { version = model.getParent().getVersion(); } pw.println(indent + "id: " + groupId + ":" + model.getArtifactId() + ":" + version); }
void id(Model model) { String groupId = model.getGroupId(); if (groupId == null & model.getParent() != null) { groupId = model.getParent().getGroupId(); } String version = model.getVersion(); if (version == null && model.getParent() != null) { version = model.getParent().getVersion(); } p.println("id", groupId + ":" + model.getArtifactId() + ":" + version); }