protected static List < MavenVersionedArtifact > getMavenArtifacts ( final String channelId , final Supplier < Collection < ArtifactInformation > > artifactsSupplier , final String groupId , final String artifactId , final boolean snapshot , final Predicate < ComparableVersion > versionFilter ) { final List < MavenVersionedArtifact > arts = new ArrayList <> ( ) ; for ( final ArtifactInformation ai : artifactsSupplier . get ( ) ) { if ( ! isZip ( ai ) ) { // if is is anot a zip, then this is not for the unzip plugin continue ; } // fetch meta data final String mvnGroupId = ai . getMetaData ( ) . get ( MK_GROUP_ID ) ; final String mvnArtifactId = ai . getMetaData ( ) . get ( MK_ARTIFACT_ID ) ; final String classifier = ai . getMetaData ( ) . get ( MK_CLASSIFIER ) ; final String mvnVersion = ai . getMetaData ( ) . get ( MK_VERSION ) ; final String mvnSnapshotVersion = ai . getMetaData ( ) . get ( MK_SNAPSHOT_VERSION ) ; if ( mvnGroupId == null || mvnArtifactId == null || mvnVersion == null ) { // no GAV information continue ; } if ( classifier != null && ! classifier . isEmpty ( ) ) { // no classifiers right now continue ; } if ( ! mvnGroupId . equals ( groupId ) || ! mvnArtifactId . equals ( artifactId ) ) { // wrong group or artifact id continue ; } if ( ! snapshot && ( mvnSnapshotVersion != null || mvnVersion . endsWith ( "-SNAPSHOT" ) ) ) { // we are not looking for snapshots continue ; } final ComparableVersion v = parseVersion ( mvnVersion ) ; final ComparableVersion sv = parseVersion ( mvnSnapshotVersion ) ; if ( v == null ) { // unable to parse v continue ; } if ( versionFilter == null ) { // no filter, add it arts . add ( new MavenVersionedArtifact ( sv != null ? sv : v , channelId , ai ) ) ; } else if ( versionFilter . test ( v ) ) { // filter matched, add it arts . add ( new MavenVersionedArtifact ( sv != null ? sv : v , channelId , ai ) ) ; } else if ( sv != null && versionFilter . test ( sv ) ) { // we have a snapshot version and it matched, add it arts . add ( new MavenVersionedArtifact ( sv , channelId , ai ) ) ; } } return arts ; }
Get a list of all relevant maven artifacts