protected boolean pathIsValidGav( MavenRepository repository, String path ) { final Gav gav = repository.getGavCalculator().pathToGav( path ); return gav != null && !gav.isHash() && gav.isSignature(); } }
@VisibleForTesting boolean doesImpactMavenMetadata( final Gav requestGav ) { // hashes and signatures are "meta" // released artifacts with classifiers do not change metadata return !( requestGav.isHash() || requestGav.isSignature() || ( StringUtils.isNotBlank( requestGav.getClassifier() ) && !requestGav.isSnapshot() ) ); }
protected boolean pathIsValidGav( MavenRepository repository, String path ) { final Gav gav = repository.getGavCalculator().pathToGav( path ); return gav != null && !gav.isHash() && !gav.isSignature(); } }
protected boolean pathIsValidSnapshotGav( MavenRepository repository, String path ) { final Gav gav = repository.getGavCalculator().pathToGav( path ); return gav != null && gav.isSnapshot() && !gav.isHash() && !gav.isSignature(); } }
if ( gav.isHash() )
@Override public boolean shouldBuildEntry(final NexusArtifactEvent event) { if (!super.shouldBuildEntry(event)) { return false; } final Gav gav = buildGAV(event); if (gav != null) { if (gav.isHash() || gav.isSignature()) { return false; } } final String path = event.getNexusItemInfo().getPath(); if (path.contains("maven-metadata.xml")) { return false; } return true; }
/** * Only when it's a pom file or the file has a classifier will we build the maven artifact entry */ @Override public boolean shouldBuildEntry(NexusArtifactEvent event) { if (!super.shouldBuildEntry(event)) { return false; } Gav gav = buildGAV(event); if (gav == null) { return false; } if (gav.isHash() || gav.isSignature()) { return false; } if ("pom".equalsIgnoreCase(gav.getExtension())) { return true; } if (!StringUtils.isEmpty(gav.getClassifier())) { return true; } return false; } }
if ( gav.isHash() )
@Override public void processItem(WalkerContext context, StorageItem item) throws Exception { // just process the POM files if (item instanceof StorageFileItem && !item.getRepositoryItemUid().getPath().endsWith(".pom")) { return; } try { Gav gav = this.gavCalculator.pathToGav(item.getPath()); // make sure we've really got a POM file if (gav != null && !gav.isHash() && !gav.isSignature() && gav.getExtension().equals("pom")) { // and then calculate the artifact usage calculateArtifactUsage((StorageFileItem) item); } } catch (Exception e) { getLogger().warn( "Error processing POM file for artifact usage data: " + item.getPath(), ExceptionUtils.getRootCause(e)); } } }
if ( !gav.isHash() && !gav.isSignature() && gav.getExtension().equals( "pom" ) )
buildNo, buildTs, gav.getName(), gav.isHash(), gav.getHashType(), gav.isSignature(), gav.getSignatureType() );
if (gav == null || gav.isSignature() || gav.isHash()) { return;
if (gav == null || gav.isSignature() || gav.isHash()) { return;
public static org.apache.maven.index.artifact.Gav convert(final Gav gav) { final org.apache.maven.index.artifact.Gav.HashType ht = gav.getHashType() != null ? org.apache.maven.index.artifact.Gav.HashType.valueOf(gav.getHashType().name()) : null; final org.apache.maven.index.artifact.Gav.SignatureType st = gav.getSignatureType() != null ? org.apache.maven.index.artifact.Gav.SignatureType .valueOf(gav.getSignatureType().name()) : null; return new org.apache.maven.index.artifact.Gav(gav.getGroupId(), gav.getArtifactId(), gav.getVersion(), gav.getClassifier(), gav.getExtension(), gav.getSnapshotBuildNumber(), gav.getSnapshotTimeStamp(), gav.getName(), gav.isHash(), ht, gav.isSignature(), st); }
public StorageFileItem retrieveArtifactPom( ArtifactStoreRequest gavRequest ) throws IllegalOperationException, ItemNotFoundException, StorageException, AccessDeniedException { Gav pomGav = new Gav( gavRequest.getGav().getGroupId(), gavRequest.getGav().getArtifactId(), gavRequest.getGav().getVersion(), null, // gavRequest.getGav().getClassifier(), "pom", // gavRequest.getGav().getExtension(), gavRequest.getGav().getSnapshotBuildNumber(), gavRequest.getGav().getSnapshotTimeStamp(), gavRequest.getGav().getName(), gavRequest.getGav().isHash(), gavRequest.getGav().getHashType(), gavRequest.getGav().isSignature(), gavRequest.getGav().getSignatureType() ); ArtifactStoreRequest pomRequest = new ArtifactStoreRequest( gavRequest.getMavenRepository(), pomGav, gavRequest.isRequestLocalOnly(), gavRequest.isRequestRemoteOnly() ); return retrieveArtifact( pomRequest ); }
protected Gav resolveSnapshotFromM3Metadata( final ArtifactStoreRequest gavRequest, final Gav gav, final Metadata gavMd ) throws IOException { for ( SnapshotVersion sv : gavMd.getVersioning().getSnapshotVersions() ) { if ( StringUtils.equals( sv.getExtension(), gav.getExtension() ) && StringUtils.equals( StringUtils.defaultString( sv.getClassifier(), "" ), StringUtils.defaultString( gav.getClassifier(), "" ) ) ) { Long buildTs = getTimeFromMetadataTimestampMaven3Updated( sv.getUpdated() ); Integer buildNo = getBuildNumberForMetadataMaven3Value( sv.getVersion() ); return new Gav( gav.getGroupId(), gav.getArtifactId(), sv.getVersion(), gav.getClassifier(), gav.getExtension(), buildNo, buildTs, gav.getName(), gav.isHash(), gav.getHashType(), gav.isSignature(), gav.getSignatureType() ); } } // even if model version is 1.1.0, we have no snapshots versions? return resolveSnapshotFromM2Metadata( gavRequest, gav, gavMd ); }
if ( gav == null || gav.isSignature() || gav.isHash() )
if (gav == null || gav.isSignature() || gav.isHash()) {