public String getRemoteFilename() { return metadata.getType(); }
public boolean storedInArtifactVersionDirectory() { return metadata.getVersion().length() > 0; }
public boolean storedInGroupDirectory() { return metadata.getArtifactId().length() <= 0; }
private Metadata newInstance( Map<String, String> properties, File file ) { return new DefaultMetadata( getGroupId(), getArtifactId(), getVersion(), getType(), getNature(), file, properties ); }
private void mergeMetadata( RepositorySystemSession session, RequestTrace trace, Versions versions, org.eclipse.aether.metadata.Metadata metadata, ArtifactRepository repository ) { if ( metadata != null && metadata.getFile() != null && metadata.getFile().isFile() ) { try { Map<String, ?> options = Collections.singletonMap( MetadataReader.IS_STRICT, Boolean.FALSE ); Metadata repoMetadata = metadataReader.read( metadata.getFile(), options ); mergeMetadata( versions, repoMetadata, repository ); } catch ( IOException e ) { invalidMetadata( session, trace, metadata, repository, e ); } } }
new DefaultMetadata( pluginGroup, "maven-metadata.xml", DefaultMetadata.Nature.RELEASE_OR_SNAPSHOT );
public String getGroupId() { return nullify( metadata.getGroupId() ); }
DefaultMetadata( String groupId, String artifactId, String version, String type, Nature nature, File file, Map<String, String> properties ) { // NOTE: This constructor assumes immutability of the provided properties, for internal use only this.groupId = emptify( groupId ); this.artifactId = emptify( artifactId ); this.version = emptify( version ); this.type = emptify( type ); this.nature = nature; this.file = file; this.properties = properties; }
private Metadata newInstance( Map<String, String> properties, File file ) { return new DefaultMetadata( getGroupId(), getArtifactId(), getVersion(), getType(), getNature(), file, properties ); }
private PluginVersionResult resolveFromRepository( PluginVersionRequest request ) throws PluginVersionResolutionException { RequestTrace trace = RequestTrace.newChild( null, request ); DefaultPluginVersionResult result = new DefaultPluginVersionResult(); org.eclipse.aether.metadata.Metadata metadata = new DefaultMetadata( request.getGroupId(), request.getArtifactId(), "maven-metadata.xml", DefaultMetadata.Nature.RELEASE_OR_SNAPSHOT ); List<MetadataRequest> requests = new ArrayList<>(); requests.add( new MetadataRequest( metadata, null, REPOSITORY_CONTEXT ).setTrace( trace ) ); for ( RemoteRepository repository : request.getRepositories() ) { requests.add( new MetadataRequest( metadata, repository, REPOSITORY_CONTEXT ).setTrace( trace ) ); } List<MetadataResult> results = repositorySystem.resolveMetadata( request.getRepositorySession(), requests ); Versions versions = new Versions(); for ( MetadataResult res : results ) { ArtifactRepository repository = res.getRequest().getRepository(); if ( repository == null ) { repository = request.getRepositorySession().getLocalRepository(); } mergeMetadata( request.getRepositorySession(), trace, versions, res.getMetadata(), repository ); } selectVersion( result, request, versions ); return result; }
public String getArtifactId() { return nullify( metadata.getArtifactId() ); }
private PluginPrefixResult processResults( PluginPrefixRequest request, RequestTrace trace, List<MetadataResult> results, List<MetadataRequest> requests ) { for ( MetadataResult res : results ) { org.eclipse.aether.metadata.Metadata metadata = res.getMetadata(); if ( metadata != null ) { ArtifactRepository repository = res.getRequest().getRepository(); if ( repository == null ) { repository = request.getRepositorySession().getLocalRepository(); } PluginPrefixResult result = resolveFromRepository( request, trace, metadata.getGroupId(), metadata, repository ); if ( result != null ) { return result; } } if ( requests != null && !res.isUpdated() ) { requests.add( res.getRequest() ); } } return null; }
public String getBaseVersion() { return nullify( metadata.getVersion() ); }
DefaultMetadata( String groupId, String artifactId, String version, String type, Nature nature, File file, Map<String, String> properties ) { // NOTE: This constructor assumes immutability of the provided properties, for internal use only this.groupId = emptify( groupId ); this.artifactId = emptify( artifactId ); this.version = emptify( version ); this.type = emptify( type ); this.nature = nature; this.file = file; this.properties = properties; }
private PluginPrefixResult resolveFromRepository( PluginPrefixRequest request, RequestTrace trace, String pluginGroup, org.eclipse.aether.metadata.Metadata metadata, ArtifactRepository repository ) { if ( metadata != null && metadata.getFile() != null && metadata.getFile().isFile() ) { try { Map<String, ?> options = Collections.singletonMap( MetadataReader.IS_STRICT, Boolean.FALSE ); Metadata pluginGroupMetadata = metadataReader.read( metadata.getFile(), options ); List<org.apache.maven.artifact.repository.metadata.Plugin> plugins = pluginGroupMetadata.getPlugins(); if ( plugins != null ) { for ( org.apache.maven.artifact.repository.metadata.Plugin plugin : plugins ) { if ( request.getPrefix().equals( plugin.getPrefix() ) ) { return new DefaultPluginPrefixResult( pluginGroup, plugin.getArtifactId(), repository ); } } } } catch ( IOException e ) { invalidMetadata( request.getRepositorySession(), trace, metadata, repository, e ); } } return null; }
new DefaultMetadata( request.getArtifact().getGroupId(), request.getArtifact().getArtifactId(), MAVEN_METADATA_XML, Metadata.Nature.RELEASE_OR_SNAPSHOT );
private Versioning readVersions( RepositorySystemSession session, RequestTrace trace, Metadata metadata, ArtifactRepository repository, VersionRangeResult result ) { Versioning versioning = null; try { if ( metadata != null ) { try ( SyncContext syncContext = syncContextFactory.newInstance( session, true ) ) { syncContext.acquire( null, Collections.singleton( metadata ) ); if ( metadata.getFile() != null && metadata.getFile().exists() ) { try ( final InputStream in = new FileInputStream( metadata.getFile() ) ) { versioning = new MetadataXpp3Reader().read( in, false ).getVersioning(); } } } } } catch ( Exception e ) { invalidMetadata( session, trace, metadata, repository, e ); result.addException( e ); } return ( versioning != null ) ? versioning : new Versioning(); }
metadata = new DefaultMetadata( artifact.getGroupId(), artifact.getArtifactId(), MAVEN_METADATA_XML, Metadata.Nature.RELEASE ); metadata = new DefaultMetadata( artifact.getGroupId(), artifact.getArtifactId(), MAVEN_METADATA_XML, Metadata.Nature.RELEASE_OR_SNAPSHOT ); new DefaultMetadata( artifact.getGroupId(), artifact.getArtifactId(), version, MAVEN_METADATA_XML, Metadata.Nature.SNAPSHOT );