in nb-repository-plugin/src/main/java/org/apache/netbeans/nbm/repository/PopulateRepositoryMojo.java [967:1004]
private Dependency findExternal( File f )
{
if ( externallist == null )
{
return null;
}
try
{
List<String> content512 = Files.readAllLines( externallist.toPath() );
MessageDigest shaDig = MessageDigest.getInstance( "SHA1" );
try ( InputStream is = new FileInputStream( f ); OutputStream os = new DigestOutputStream( new NullOutputStream(), shaDig ); )
{
IOUtil.copy( is, os );
}
String sha1 = encode ( shaDig.digest() ).toUpperCase();
for ( String string : content512 )
{
if ( string.startsWith( "#" ) )
{
continue;
}
String[] split = string.split( ";" );
if ( split[0].equals( sha1 ) && split[1].contains( ":" ) )
{
Dependency dep = splitDependencyString( split[1] );
getLog().info( "found match " + dep.getGroupId() + ":" + dep.getArtifactId() + ":" + dep.getVersion() + " for " + f.getName() );
return dep;
}
}
getLog().info( "no repository match for " + f.getName() + f.getAbsolutePath() + " with sha " + sha1 );
}
catch ( Exception x )
{
getLog().error( x );
}
return null;
}