private Assembly addAssemblyFromDescriptor( final String spec, final Locator locator,
final AssemblerConfigurationSource configSource,
final List<Assembly> assemblies )
throws AssemblyReadException, InvalidAssemblerConfigurationException
{
final Location location = locator.resolve( spec );
if ( location == null )
{
if ( configSource.isIgnoreMissingDescriptor() )
{
getLogger().debug( "Ignoring missing assembly descriptor with ID '" + spec
+ "' per configuration.\nLocator output was:\n\n"
+ locator.getMessageHolder().render() );
return null;
}
else
{
throw new AssemblyReadException( "Error locating assembly descriptor: " + spec + "\n\n"
+ locator.getMessageHolder().render() );
}
}
Reader r = null;
try
{
// TODO use ReaderFactory.newXmlReader() when plexus-utils is upgraded to 1.4.5+
r = new InputStreamReader( location.getInputStream(), "UTF-8" );
File dir = null;
if ( location.getFile() != null )
{
dir = location.getFile().getParentFile();
}
final Assembly assembly = readAssembly( r, spec, dir, configSource );
assemblies.add( assembly );