org.apache.maven.plugin.MojoExecutionException#getCause ( )源码实例Demo

下面列出了org.apache.maven.plugin.MojoExecutionException#getCause ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: wisdom   文件: LessCompilerMojo.java
private WatchingException buildWatchingException(String stream, File file, MojoExecutionException e) {
    String[] lines = stream.split("\n");
    for (String l : lines) {
        if (!Strings.isNullOrEmpty(l)) {
            stream = l.trim();
            break;
        }
    }
    final Matcher matcher = LESS_ERROR_PATTERN.matcher(stream);
    if (matcher.matches()) {
        String line = matcher.group(2);
        String character = matcher.group(3);
        String reason = matcher.group(1);
        return new WatchingException("Less Compilation Error", reason, file,
                Integer.valueOf(line), Integer.valueOf(character), null);
    } else {
        return new WatchingException("Less Compilation Error", stream, file, e.getCause());
    }
}
 
源代码2 项目: webstart   文件: UnsignTask.java
/**
 * {@inheritDoc}
 */
public void check( JnlpDependencyConfig config )
{
    if ( config == null )
    {
        throw new NullPointerException( "config can't be null" );
    }
    if ( config.getArtifact() == null )
    {
        throw new NullPointerException( "config.artifact can't be null" );
    }
    if ( config.getArtifact().getFile() == null )
    {
        throw new NullPointerException( "config.artifact.file can't be null" );
    }
    if ( !config.isSign() )
    {
        throw new IllegalStateException( "Can't sign if config.isSign is false" );
    }

    File file = config.getArtifact().getFile();

    boolean jarSigned;
    try
    {
        jarSigned = signTool.isJarSigned( file );
    }
    catch ( MojoExecutionException e )
    {
        throw new RuntimeException( e.getMessage(), e.getCause() );
    }

    if ( jarSigned && !config.isCanUnsign() )
    {
        throw new IllegalStateException( "Can't unsign the config.artifact.file if config.isCanUsign is false" );
    }
}
 
源代码3 项目: webstart   文件: SignTask.java
/**
 * {@inheritDoc}
 */
public void check( JnlpDependencyConfig config )
{
    if ( config == null )
    {
        throw new NullPointerException( "config can't be null" );
    }
    if ( config.getArtifact() == null )
    {
        throw new NullPointerException( "config.artifact can't be null" );
    }
    if ( config.getArtifact().getFile() == null )
    {
        throw new NullPointerException( "config.artifact.file can't be null" );
    }
    if ( !config.isSign() )
    {
        throw new IllegalStateException( "Can't sign if config.isSign is false" );
    }

    File file = config.getArtifact().getFile();

    boolean jarSigned;
    try
    {
        jarSigned = signTool.isJarSigned( file );
    }
    catch ( MojoExecutionException e )
    {
        throw new RuntimeException( e.getMessage(), e.getCause() );
    }

    if ( jarSigned && !config.isCanUnsign() )
    {
        throw new IllegalStateException( "Can't unsign the config.artifact.file if config.isCanUsign is false" );
    }
}
 
源代码4 项目: wisdom   文件: JavaCompilerMojo.java
private void compile() throws WatchingException {
    try {
        execute();
    } catch (MojoExecutionException e) {
        if (e.getCause() != null
                && e.getCause().getClass().getName().equals("org.apache.maven.plugin.compiler" +
                ".CompilationFailureException")) {
            throw CompilerExecutor.build(this, e.getCause());
        }
        throw new WatchingException("Compilation error", e);
    }
}
 
源代码5 项目: wisdom   文件: JavaTestCompilerMojo.java
private void compile() throws WatchingException {
    try {
        execute();
    } catch (MojoExecutionException e) {
        if (e.getCause() != null
                && e.getCause().getClass().getName().equals("org.apache.maven.plugin.compiler" +
                ".CompilationFailureException")) {
            throw CompilerExecutor.build(this, e.getCause());
        }
        throw new WatchingException("Compilation error", e);
    }
}
 
源代码6 项目: ci.maven   文件: DevMojo.java
@Override
public void runUnitTests() throws PluginExecutionException, PluginScenarioException {
    try {
        runTestMojo("org.apache.maven.plugins", "maven-surefire-plugin", "test");
        runTestMojo("org.apache.maven.plugins", "maven-surefire-report-plugin", "report-only");
    } catch (MojoExecutionException e) {
        Throwable cause = e.getCause();
        if (cause != null && cause instanceof MojoFailureException) {
            throw new PluginScenarioException("Unit tests failed: " + cause.getLocalizedMessage(), e);
        } else {
            throw new PluginExecutionException("Failed to run unit tests", e);
        }
    }
}
 
源代码7 项目: ci.maven   文件: DevMojo.java
@Override
public void runIntegrationTests() throws PluginExecutionException, PluginScenarioException {
    try {
        runTestMojo("org.apache.maven.plugins", "maven-failsafe-plugin", "integration-test");
        runTestMojo("org.apache.maven.plugins", "maven-surefire-report-plugin", "failsafe-report-only");
        runTestMojo("org.apache.maven.plugins", "maven-failsafe-plugin", "verify");
    } catch (MojoExecutionException e) {
        Throwable cause = e.getCause();
        if (cause != null && cause instanceof MojoFailureException) {
            throw new PluginScenarioException("Integration tests failed: " + cause.getLocalizedMessage(), e);
        } else {
            throw new PluginExecutionException("Failed to run integration tests", e);
        }
    }
}