private Artifact toArtifact( Plugin plugin, RepositorySystemSession session ) { return new DefaultArtifact( plugin.getGroupId(), plugin.getArtifactId(), null, "jar", plugin.getVersion(), session.getArtifactTypeRegistry().get( "maven-plugin" ) ); }
private Dependency convert( org.apache.maven.model.Dependency dependency, ArtifactTypeRegistry stereotypes ) { ArtifactType stereotype = stereotypes.get( dependency.getType() ); if ( stereotype == null ) { stereotype = new DefaultArtifactType( dependency.getType() ); } boolean system = dependency.getSystemPath() != null && dependency.getSystemPath().length() > 0; Map<String, String> props = null; if ( system ) { props = Collections.singletonMap( ArtifactProperties.LOCAL_PATH, dependency.getSystemPath() ); } Artifact artifact = new DefaultArtifact( dependency.getGroupId(), dependency.getArtifactId(), dependency.getClassifier(), null, dependency.getVersion(), props, stereotype ); List<Exclusion> exclusions = new ArrayList<>( dependency.getExclusions().size() ); for ( org.apache.maven.model.Exclusion exclusion : dependency.getExclusions() ) { exclusions.add( convert( exclusion ) ); } Dependency result = new Dependency( artifact, dependency.getScope(), dependency.getOptional() != null ? dependency.isOptional() : null, exclusions ); return result; }
public static Dependency toDependency( org.apache.maven.model.Dependency dependency, ArtifactTypeRegistry stereotypes ) { ArtifactType stereotype = stereotypes.get( dependency.getType() ); if ( stereotype == null ) { stereotype = new DefaultArtifactType( dependency.getType() ); } boolean system = dependency.getSystemPath() != null && dependency.getSystemPath().length() > 0; Map<String, String> props = null; if ( system ) { props = Collections.singletonMap( ArtifactProperties.LOCAL_PATH, dependency.getSystemPath() ); } Artifact artifact = new DefaultArtifact( dependency.getGroupId(), dependency.getArtifactId(), dependency.getClassifier(), null, dependency.getVersion(), props, stereotype ); List<Exclusion> exclusions = new ArrayList<>( dependency.getExclusions().size() ); for ( org.apache.maven.model.Exclusion exclusion : dependency.getExclusions() ) { exclusions.add( toExclusion( exclusion ) ); } Dependency result = new Dependency( artifact, dependency.getScope(), dependency.getOptional() != null ? dependency.isOptional() : null, exclusions ); return result; }
if ( classifier == null ) ArtifactType type = stereotypes.get( dependency.getType() ); if ( type != null )
public ArtifactType get( String typeId ) { ArtifactType type = types.get( typeId ); if ( type == null ) { type = delegate.get( typeId ); types.put( typeId, type ); } return type; }
public ArtifactType get( String typeId ) { ArtifactType type = types.get( typeId ); if ( type == null ) { type = delegate.get( typeId ); types.put( typeId, type ); } return type; }
public ArtifactType get( String typeId ) { ArtifactType type = super.get( typeId ); if ( type == null && delegate != null ) { type = delegate.get( typeId ); } return type; }
public ArtifactType get( String typeId ) { ArtifactType type = super.get( typeId ); if ( type == null && delegate != null ) { type = delegate.get( typeId ); } return type; }
private ArtifactType getArtifactType(String typeId) { return repositorySystemSession.getArtifactTypeRegistry().get(typeId); }
public ArtifactType getArtifactType(String typeId) { return session.getArtifactTypeRegistry().get(typeId); }
@Override public String getCoordinates(Artifact artifact) { log.debug(" Encoding Coordinates For: " + artifact); // Get the extension according to the artifact type. String extension = session.getArtifactTypeRegistry().get(artifact.getType()).getExtension(); // assert that the file extension matches the artifact packaging extension type, if there is an artifact file. if (artifact.getFile() != null && !artifact.getFile().getName().toLowerCase().endsWith(extension.toLowerCase())) { String filename = artifact.getFile().getName(); String fileExtension = filename.substring(filename.lastIndexOf('.') + 1); log.warn( " Artifact file name: " + artifact.getFile().getName() + " of type " + artifact.getType() + " does not match the extension for the ArtifactType: " + extension + ". " + "This is likely an issue with the packaging definition for '" + artifact.getType() + "' artifacts, which may be missing an extension definition. " + "The gitflow helper catalog will use the actual file extension: " + fileExtension ); extension = fileExtension; } return getCoordinates( artifact.getGroupId(), artifact.getArtifactId(), project.getVersion(), extension, artifact.hasClassifier() ? artifact.getClassifier() : null ); }
private Artifact resolveSourceArtifact( Artifact dep ) throws ArtifactResolutionException { if( !matchArtifact(dep) ) { return null; } final ArtifactTypeRegistry typeReg = repoSession.getArtifactTypeRegistry(); final String extension = null; final DefaultArtifact artifact = new DefaultArtifact( dep.getGroupId(), dep.getArtifactId(), SOURCE_CLASSIFIER, extension, dep.getVersion(), typeReg.get(dep.getType())); final ArtifactRequest request = new ArtifactRequest(); request.setArtifact( artifact ); request.setRepositories(remoteRepos); getLog().debug( String.format("Resolving artifact %s from %s", artifact, remoteRepos )); final ArtifactResult result = repoSystem.resolveArtifact( repoSession, request ); return RepositoryUtils.toArtifact(result.getArtifact()); }
public static Dependency toDependency(org.apache.maven.model.Dependency dependency, ArtifactTypeRegistry stereotypes) { ArtifactType stereotype = stereotypes.get(dependency.getType()); if (stereotype == null) { stereotype = new DefaultArtifactType(dependency.getType()); } boolean system = dependency.getSystemPath() != null && dependency.getSystemPath().length() > 0; Map<String, String> props = null; if (system) { props = Collections.singletonMap(ArtifactProperties.LOCAL_PATH, dependency.getSystemPath()); } Artifact artifact = new DefaultArtifact(dependency.getGroupId(), dependency.getArtifactId(), dependency.getClassifier(), null, dependency.getVersion(), props, stereotype); List<Exclusion> exclusions = new ArrayList<Exclusion>(dependency.getExclusions().size()); for (org.apache.maven.model.Exclusion exclusion : dependency.getExclusions()) { exclusions.add(toExclusion(exclusion)); } Dependency result = new Dependency(artifact, dependency.getScope(), dependency.isOptional(), exclusions); return result; }
public static Dependency toDependency(org.apache.maven.model.Dependency dependency, ArtifactTypeRegistry stereotypes) { ArtifactType stereotype = stereotypes.get(dependency.getType()); if (stereotype == null) { stereotype = new DefaultArtifactType(dependency.getType()); } boolean system = dependency.getSystemPath() != null && dependency.getSystemPath().length() > 0; Map<String, String> props = null; if (system) { props = Collections.singletonMap(ArtifactProperties.LOCAL_PATH, dependency.getSystemPath()); } Artifact artifact = new DefaultArtifact(dependency.getGroupId(), dependency.getArtifactId(), dependency.getClassifier(), null, dependency.getVersion(), props, stereotype); List<Exclusion> exclusions = new ArrayList<Exclusion>(dependency.getExclusions().size()); for (org.apache.maven.model.Exclusion exclusion : dependency.getExclusions()) { exclusions.add(toExclusion(exclusion)); } Dependency result = new Dependency(artifact, dependency.getScope(), dependency.isOptional(), exclusions); return result; }
private Dependency convertToAether(org.apache.maven.model.Dependency dependency, ArtifactTypeRegistry stereotypes) { ArtifactType stereotype = stereotypes.get(dependency.getType()); if (stereotype == null) { stereotype = new DefaultArtifactType(dependency.getType()); } boolean system = dependency.getSystemPath() != null && dependency.getSystemPath().length() > 0; Map<String, String> props = null; if (system) { props = Collections.singletonMap(ArtifactProperties.LOCAL_PATH, dependency.getSystemPath()); } Artifact artifact = new DefaultArtifact(dependency.getGroupId(), dependency.getArtifactId(), dependency.getClassifier(), null, dependency.getVersion(), props, stereotype); List<Exclusion> exclusions = new ArrayList<Exclusion>(dependency.getExclusions().size()); for (org.apache.maven.model.Exclusion exclusion : dependency.getExclusions()) { exclusions.add(convert(exclusion)); } Dependency result = new Dependency(artifact, dependency.getScope(), dependency.isOptional(), exclusions); return result; }
private Dependency convert( org.apache.maven.model.Dependency dependency, ArtifactTypeRegistry stereotypes ) { ArtifactType stereotype = stereotypes.get( dependency.getType() ); if ( stereotype == null ) { stereotype = new DefaultArtifactType( dependency.getType() ); } boolean system = dependency.getSystemPath() != null && dependency.getSystemPath().length() > 0; Map<String, String> props = null; if ( system ) { props = Collections.singletonMap( ArtifactProperties.LOCAL_PATH, dependency.getSystemPath() ); } Artifact artifact = new DefaultArtifact( dependency.getGroupId(), dependency.getArtifactId(), dependency.getClassifier(), null, dependency.getVersion(), props, stereotype ); List<Exclusion> exclusions = new ArrayList<>( dependency.getExclusions().size() ); for ( org.apache.maven.model.Exclusion exclusion : dependency.getExclusions() ) { exclusions.add( convert( exclusion ) ); } Dependency result = new Dependency( artifact, dependency.getScope(), dependency.isOptional(), exclusions ); return result; }
private org.eclipse.aether.graph.Dependency convert( org.apache.maven.model.Dependency dependency, ArtifactTypeRegistry stereotypes ) { ArtifactType stereotype = stereotypes.get( dependency.getType() ); if ( stereotype == null ) { stereotype = new DefaultArtifactType( dependency.getType() ); } boolean system = dependency.getSystemPath() != null && dependency.getSystemPath().length() > 0; Map<String, String> props = null; if ( system ) { props = Collections.singletonMap( ArtifactProperties.LOCAL_PATH, dependency.getSystemPath() ); } Artifact artifact = new DefaultArtifact( dependency.getGroupId(), dependency.getArtifactId(), dependency.getClassifier(), null, dependency.getVersion(), props, stereotype ); List<org.eclipse.aether.graph.Exclusion> exclusions = new ArrayList<org.eclipse.aether.graph.Exclusion>( dependency.getExclusions().size() ); for ( org.apache.maven.model.Exclusion exclusion : dependency.getExclusions() ) { exclusions.add( convert( exclusion ) ); } org.eclipse.aether.graph.Dependency result = new org.eclipse.aether.graph.Dependency( artifact, dependency.getScope(), dependency.isOptional(), exclusions ); return result; }
private Dependency convert( org.apache.maven.model.Dependency dependency, ArtifactTypeRegistry stereotypes ) { ArtifactType stereotype = stereotypes.get( dependency.getType() ); if ( stereotype == null ) { stereotype = new DefaultArtifactType( dependency.getType() ); } boolean system = dependency.getSystemPath() != null && dependency.getSystemPath().length() > 0; Map<String, String> props = null; if ( system ) { props = Collections.singletonMap( ArtifactProperties.LOCAL_PATH, dependency.getSystemPath() ); } Artifact artifact = new DefaultArtifact( dependency.getGroupId(), dependency.getArtifactId(), dependency.getClassifier(), null, dependency.getVersion(), props, stereotype ); List<Exclusion> exclusions = new ArrayList<Exclusion>( dependency.getExclusions().size() ); for ( org.apache.maven.model.Exclusion exclusion : dependency.getExclusions() ) { exclusions.add( convert( exclusion ) ); } Dependency result = new Dependency( artifact, dependency.getScope(), dependency.isOptional(), exclusions ); return result; }
private Dependency convert( org.apache.maven.model.Dependency dependency, ArtifactTypeRegistry stereotypes ) { ArtifactType stereotype = stereotypes.get( dependency.getType() ); if ( stereotype == null ) { stereotype = new DefaultArtifactType( dependency.getType() ); } boolean system = dependency.getSystemPath() != null && dependency.getSystemPath().length() > 0; Map<String, String> props = null; if ( system ) { props = Collections.singletonMap( ArtifactProperties.LOCAL_PATH, dependency.getSystemPath() ); } Artifact artifact = new DefaultArtifact( dependency.getGroupId(), dependency.getArtifactId(), dependency.getClassifier(), null, dependency.getVersion(), props, stereotype ); List<Exclusion> exclusions = new ArrayList<>( dependency.getExclusions().size() ); for ( org.apache.maven.model.Exclusion exclusion : dependency.getExclusions() ) { exclusions.add( convert( exclusion ) ); } Dependency result = new Dependency( artifact, dependency.getScope(), dependency.getOptional() != null ? dependency.isOptional() : null, exclusions ); return result; }
ArtifactType stereotype = registry.get(dependency.getType()); if (stereotype == null) { stereotype = new DefaultArtifactType(dependency.getType());