If uri is not specified, use defaultUri for library resolution.