Search in sources :

Example 1 with ToolchainPrivate

use of org.apache.maven.toolchain.ToolchainPrivate in project maven-plugins by apache.

the class ToolchainMojo method selectToolchain.

protected boolean selectToolchain(String type, Map<String, String> params) throws MojoExecutionException {
    getLog().info("Required toolchain: " + getToolchainRequirementAsString(type, params));
    int typeFound = 0;
    try {
        ToolchainPrivate[] tcs = getToolchains(type);
        for (ToolchainPrivate tc : tcs) {
            if (!type.equals(tc.getType())) {
                // useful because of MNG-5716
                continue;
            }
            typeFound++;
            if (tc.matchesRequirements(params)) {
                getLog().info("Found matching toolchain for type " + type + ": " + tc);
                // store matching toolchain to build context
                toolchainManagerPrivate.storeToolchainToBuildContext(tc, session);
                return true;
            }
        }
    } catch (MisconfiguredToolchainException ex) {
        throw new MojoExecutionException("Misconfigured toolchains.", ex);
    }
    getLog().error("No toolchain " + ((typeFound == 0) ? "found" : ("matched from " + typeFound + " found")) + " for type " + type);
    return false;
}
Also used : MojoExecutionException(org.apache.maven.plugin.MojoExecutionException) ToolchainPrivate(org.apache.maven.toolchain.ToolchainPrivate) MisconfiguredToolchainException(org.apache.maven.toolchain.MisconfiguredToolchainException)

Example 2 with ToolchainPrivate

use of org.apache.maven.toolchain.ToolchainPrivate in project maven-plugins by apache.

the class ToolchainMojo method selectToolchain.

protected boolean selectToolchain(String type, Map<String, String> params) throws MojoExecutionException {
    getLog().info("Required toolchain: " + getToolchainRequirementAsString(type, params));
    int typeFound = 0;
    try {
        ToolchainPrivate[] tcs = getToolchains(type);
        for (ToolchainPrivate tc : tcs) {
            if (!type.equals(tc.getType())) {
                // useful because of MNG-5716
                continue;
            }
            typeFound++;
            if (tc.matchesRequirements(params)) {
                getLog().info("Found matching toolchain for type " + type + ": " + tc);
                // store matching toolchain to build context
                toolchainManagerPrivate.storeToolchainToBuildContext(tc, session);
                return true;
            }
        }
    } catch (MisconfiguredToolchainException ex) {
        throw new MojoExecutionException("Misconfigured toolchains.", ex);
    }
    getLog().error("No toolchain " + ((typeFound == 0) ? "found" : ("matched from " + typeFound + " found")) + " for type " + type);
    return false;
}
Also used : MojoExecutionException(org.apache.maven.plugin.MojoExecutionException) ToolchainPrivate(org.apache.maven.toolchain.ToolchainPrivate) MisconfiguredToolchainException(org.apache.maven.toolchain.MisconfiguredToolchainException)

Aggregations

MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)2 MisconfiguredToolchainException (org.apache.maven.toolchain.MisconfiguredToolchainException)2 ToolchainPrivate (org.apache.maven.toolchain.ToolchainPrivate)2