throw new UnsupportedOperationException(
"Unable to publish since no release service is configured. Was a serviceURL provided in the preferences?");
Metadata metadata = forgeUtil.getMetadataFromPackage(moduleArchive);
if(metadata == null)
throw new ForgeException("No \"metadata.json\" found in archive: " + moduleArchive.getAbsolutePath());
if(metadata.getName() == null)
throw new ForgeException("The \"metadata.json\" found in archive: " + moduleArchive.getAbsolutePath() +
" has no name");
if(metadata.getVersion() == null)
throw new ForgeException("The \"metadata.json\" found in archive: " + moduleArchive.getAbsolutePath() +
" has no version");
try {
if(metadataRepo.resolve(metadata.getName(), metadata.getVersion()) != null)
throw new AlreadyPublishedException("Module " + metadata.getName() + ':' + metadata.getVersion() +
" has already been published");
}
catch(HttpResponseException e) {
// A SC_NOT_FOUND can be expected and is OK.
if(e.getStatusCode() != HttpStatus.SC_NOT_FOUND)
throw new ForgeException("Unable to check module existence on the forge: " + e.getMessage());
}
if(dryRun) {
result.addChild(new Diagnostic(INFO, PUBLISHER, "Module file " + moduleArchive.getName() +
" would have been uploaded (but wasn't since this is a dry run)"));