Search in sources :

Example 1 with NoSuchScmProviderException

use of org.apache.maven.scm.manager.NoSuchScmProviderException in project maven-plugins by apache.

the class AbstractScmPublishMojo method execute.

public void execute() throws MojoExecutionException, MojoFailureException {
    // setup the scm plugin with help from release plugin utilities
    try {
        setupScm();
    } catch (ScmRepositoryException e) {
        throw new MojoExecutionException(e.getMessage(), e);
    } catch (NoSuchScmProviderException e) {
        throw new MojoExecutionException(e.getMessage(), e);
    }
    boolean tmpCheckout = false;
    if (checkoutDirectory.getPath().contains("${project.")) {
        try {
            tmpCheckout = true;
            checkoutDirectory = File.createTempFile("maven-scm-publish", ".checkout");
            checkoutDirectory.delete();
            checkoutDirectory.mkdir();
        } catch (IOException ioe) {
            throw new MojoExecutionException(ioe.getMessage(), ioe);
        }
    }
    try {
        scmPublishExecute();
    } finally {
        if (tmpCheckout) {
            FileUtils.deleteQuietly(checkoutDirectory);
        }
    }
}
Also used : ScmRepositoryException(org.apache.maven.scm.repository.ScmRepositoryException) MojoExecutionException(org.apache.maven.plugin.MojoExecutionException) IOException(java.io.IOException) NoSuchScmProviderException(org.apache.maven.scm.manager.NoSuchScmProviderException)

Example 2 with NoSuchScmProviderException

use of org.apache.maven.scm.manager.NoSuchScmProviderException in project maven-scm by apache.

the class JazzScmProviderRepositoryTest method testBrokenUrl.

private void testBrokenUrl(String scmUrl) {
    try {
        ScmRepository repository = scmManager.makeScmRepository(scmUrl);
        fail("The expected ScmRepositoryException did not occur! " + repository);
    } catch (ScmRepositoryException expected) {
    // This is the expected behaviour, so we do nothing.
    } catch (NoSuchScmProviderException unexpected) {
        fail("Unexpected failure! " + unexpected.getMessage());
    }
}
Also used : ScmRepository(org.apache.maven.scm.repository.ScmRepository) ScmRepositoryException(org.apache.maven.scm.repository.ScmRepositoryException) NoSuchScmProviderException(org.apache.maven.scm.manager.NoSuchScmProviderException)

Aggregations

NoSuchScmProviderException (org.apache.maven.scm.manager.NoSuchScmProviderException)2 ScmRepositoryException (org.apache.maven.scm.repository.ScmRepositoryException)2 IOException (java.io.IOException)1 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)1 ScmRepository (org.apache.maven.scm.repository.ScmRepository)1