Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (101)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (309)
Collections:
Other Resources:
maven-core-3.8.6.jar - Maven Core Module
maven-core-3.8.6.jar is the JAR file for Apache Maven 3.8.6 Core module. Apache Maven is a software project management and comprehension tool.
JAR File Size and Download Location:
File: 646022 06-06-2022 16:16 lib/maven-core-3.8.6.jar Download: Apache Maven Website
✍: FYIcenter.com
⏎ org/apache/maven/artifact/repository/metadata/AbstractRepositoryMetadata.java
package org.apache.maven.artifact.repository.metadata; /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.metadata.ArtifactMetadata; import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy; import org.apache.maven.artifact.repository.metadata.io.xpp3.MetadataXpp3Reader; import org.apache.maven.artifact.repository.metadata.io.xpp3.MetadataXpp3Writer; import org.codehaus.plexus.util.ReaderFactory; import org.codehaus.plexus.util.WriterFactory; import org.codehaus.plexus.util.xml.pull.XmlPullParserException; import java.io.File; import java.io.IOException; import java.io.Reader; import java.io.Writer; /** * Shared methods of the repository metadata handling. * * @author <a href="mailto:brett@apache.org">Brett Porter</a> */ public abstract class AbstractRepositoryMetadata implements RepositoryMetadata { private Metadata metadata; protected AbstractRepositoryMetadata( Metadata metadata ) { this.metadata = metadata; } public String getRemoteFilename() { return "maven-metadata.xml"; } public String getLocalFilename( ArtifactRepository repository ) { return "maven-metadata-" + repository.getKey() + ".xml"; } public void storeInLocalRepository( ArtifactRepository localRepository, ArtifactRepository remoteRepository ) throws RepositoryMetadataStoreException { try { updateRepositoryMetadata( localRepository, remoteRepository ); } catch ( IOException | XmlPullParserException e ) { throw new RepositoryMetadataStoreException( "Error updating group repository metadata", e ); } } protected void updateRepositoryMetadata( ArtifactRepository localRepository, ArtifactRepository remoteRepository ) throws IOException, XmlPullParserException { MetadataXpp3Reader mappingReader = new MetadataXpp3Reader(); Metadata metadata = null; File metadataFile = new File( localRepository.getBasedir(), localRepository.pathOfLocalRepositoryMetadata( this, remoteRepository ) ); if ( metadataFile.length() == 0 ) { if ( !metadataFile.delete() ) { // sleep for 10ms just in case this is windows holding a file lock try { Thread.sleep( 10 ); } catch ( InterruptedException e ) { // ignore } metadataFile.delete(); // if this fails, forget about it, we'll try to overwrite it anyway so no need // to delete on exit } } else if ( metadataFile.exists() ) { try ( Reader reader = ReaderFactory.newXmlReader( metadataFile ) ) { metadata = mappingReader.read( reader, false ); } } boolean changed; // If file could not be found or was not valid, start from scratch if ( metadata == null ) { metadata = this.metadata; changed = true; } else { changed = metadata.merge( this.metadata ); } // beware meta-versions! String version = metadata.getVersion(); if ( version != null && ( Artifact.LATEST_VERSION.equals( version ) || Artifact.RELEASE_VERSION.equals( version ) ) ) { // meta-versions are not valid <version/> values...don't write them. metadata.setVersion( null ); } if ( changed || !metadataFile.exists() ) { metadataFile.getParentFile().mkdirs(); try ( Writer writer = WriterFactory.newXmlWriter( metadataFile ) ) { MetadataXpp3Writer mappingWriter = new MetadataXpp3Writer(); mappingWriter.write( writer, metadata ); } } else { metadataFile.setLastModified( System.currentTimeMillis() ); } } public String toString() { return "repository metadata for: \'" + getKey() + "\'"; } protected static Metadata createMetadata( Artifact artifact, Versioning versioning ) { Metadata metadata = new Metadata(); metadata.setGroupId( artifact.getGroupId() ); metadata.setArtifactId( artifact.getArtifactId() ); metadata.setVersion( artifact.getVersion() ); metadata.setVersioning( versioning ); return metadata; } protected static Versioning createVersioning( Snapshot snapshot ) { Versioning versioning = new Versioning(); versioning.setSnapshot( snapshot ); return versioning; } public void setMetadata( Metadata metadata ) { this.metadata = metadata; } public Metadata getMetadata() { return metadata; } public void merge( org.apache.maven.repository.legacy.metadata.ArtifactMetadata metadata ) { // TODO not sure that it should assume this, maybe the calls to addMetadata should pre-merge, then artifact // replaces? AbstractRepositoryMetadata repoMetadata = (AbstractRepositoryMetadata) metadata; this.metadata.merge( repoMetadata.getMetadata() ); } public void merge( ArtifactMetadata metadata ) { // TODO not sure that it should assume this, maybe the calls to addMetadata should pre-merge, then artifact // replaces? AbstractRepositoryMetadata repoMetadata = (AbstractRepositoryMetadata) metadata; this.metadata.merge( repoMetadata.getMetadata() ); } public String extendedToString() { StringBuilder buffer = new StringBuilder( 256 ); buffer.append( "\nRepository Metadata\n--------------------------" ); buffer.append( "\nGroupId: " ).append( getGroupId() ); buffer.append( "\nArtifactId: " ).append( getArtifactId() ); buffer.append( "\nMetadata Type: " ).append( getClass().getName() ); return buffer.toString(); } public int getNature() { return RELEASE; } public ArtifactRepositoryPolicy getPolicy( ArtifactRepository repository ) { int nature = getNature(); if ( ( nature & RepositoryMetadata.RELEASE_OR_SNAPSHOT ) == RepositoryMetadata.RELEASE_OR_SNAPSHOT ) { ArtifactRepositoryPolicy policy = new ArtifactRepositoryPolicy( repository.getReleases() ); policy.merge( repository.getSnapshots() ); return policy; } else if ( ( nature & RepositoryMetadata.SNAPSHOT ) != 0 ) { return repository.getSnapshots(); } else { return repository.getReleases(); } } }
⏎ org/apache/maven/artifact/repository/metadata/AbstractRepositoryMetadata.java
Or download all of them as a single archive file:
File name: maven-core-3.8.6-src.zip File size: 550169 bytes Release date: 2022-06-06 Download
⇒ maven-artifact-3.8.6.jar - Maven Artifact Module
⇐ apache-maven-3.8.6-bin.zip - Apache Maven Binary Package
2020-10-26, 110497👍, 0💬
Popular Posts:
Provides a simple high-level Http server API, which can be used to build embedded HTTP servers. Both...
How to download and install JDK (Java Development Kit) 8? If you want to write Java applications, yo...
What Is jms.jar? I heard it's related to JMS (Java Message Service) 1.1? The if you have an jms.jar ...
What Is commons-io-2.11.jar? commons-io-2.11.jar is the JAR file for Commons IO 2.5, which is a libr...
What Is HttpComponents httpcore-4.2.2.jar? HttpComponents httpcore-4.2.2.jar is the JAR file for Apa...