org.codehaus.plexus.resource.loader.ResourceNotFoundException Java Examples

The following examples show how to use org.codehaus.plexus.resource.loader.ResourceNotFoundException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AbstractXmlMojo.java    From xml-maven-plugin with Apache License 2.0 6 votes vote down vote up
protected URL getResource( String pResource )
    throws MojoFailureException
{
    try
    {
        return getLocator().getResource( pResource ).getURL();
    }
    catch ( ResourceNotFoundException exception )
    {
        throw new MojoFailureException( "Could not find stylesheet: " + pResource );
    }
    catch ( IOException e )
    {
        throw new MojoFailureException( "Error while locating resource: " + pResource );
    }
}
 
Example #2
Source File: CamelKafkaConnectorUpdateMojo.java    From camel-kafka-connector with Apache License 2.0 5 votes vote down vote up
private Document createPackageFile() throws ResourceNotFoundException, FileResourceCreationException, IOException {
    getLog().info("Creating a new package.xml for the connector.");
    Template packageTemplate = MavenUtils.getTemplate(rm.getResourceAsFile(packageFileTemplate));
    Map<String, String> props = new HashMap<>();
    try {
        return MavenUtils.createCrateXmlDocumentFromTemplate(packageTemplate, props);
    } catch (Exception e) {
        getLog().error("Cannot create package.xml file from Template: " + packageTemplate + " with properties: " + props, e);
    }
    return null;
}
 
Example #3
Source File: CamelKafkaConnectorUpdateMojo.java    From camel-kafka-connector with Apache License 2.0 5 votes vote down vote up
private void writeStaticFiles(File connectorDir) throws IOException, ResourceNotFoundException, FileResourceCreationException {
    String notice;
    String license;
    try (InputStream isNotice = new FileInputStream(rm.getResourceAsFile(noticeTemplate)); InputStream isLicense = new FileInputStream(rm.getResourceAsFile(licenseTemplate))) {
        notice = IOUtils.toString(isNotice, StandardCharsets.UTF_8);
        license = IOUtils.toString(isLicense, StandardCharsets.UTF_8);
    }

    writeFileIfChanged(notice, new File(connectorDir, "src/main/resources/META-INF/NOTICE.txt"), getLog());
    writeFileIfChanged(license, new File(connectorDir, "src/main/resources/META-INF/LICENSE.txt"), getLog());
}
 
Example #4
Source File: AbstractCamelKafkaConnectorMojo.java    From camel-kafka-connector with Apache License 2.0 5 votes vote down vote up
/**
 * Execute goal.
 *
 * @throws MojoExecutionException execution of the main class or one of the
 *                                                        threads it generated failed.
 * @throws MojoFailureException   something bad happened...
 */
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
    configureResourceManager();
    if (!project.getArtifactId().equals(connectorsProjectName)) {
        getLog().debug("Skipping project " + project.getArtifactId() + " since it is not " + connectorsProjectName + " can be configured with <connectors-project-name> option.");
        return;
    }
    try {
        executeAll();
    } catch (IOException | ResourceNotFoundException | FileResourceCreationException e) {
        throw new MojoExecutionException("Error executing mojo", e);
    }
}
 
Example #5
Source File: KeysMap.java    From pgpverify-maven-plugin with Apache License 2.0 5 votes vote down vote up
public void load(String locale) throws ResourceNotFoundException, IOException {
    if (locale != null && !locale.trim().isEmpty()) {
        try (final InputStream inputStream = resourceManager.getResourceAsInputStream(locale)) {
            loadKeysMap(inputStream);
        }
    }
    if (keysMapList.isEmpty()) {
        LOG.warn("No keysmap specified in configuration or keysmap contains no entries. PGPVerify will only " +
                "check artifacts against their signature. File corruption will be detected. However, without a " +
                "keysmap as a reference for trust, valid signatures of any public key will be accepted.");
    }
}
 
Example #6
Source File: AbstractCamelKafkaConnectorMojo.java    From camel-kafka-connector with Apache License 2.0 votes vote down vote up
protected abstract void executeAll() throws MojoExecutionException, MojoFailureException, IOException, ResourceNotFoundException, FileResourceCreationException;