Example usage for org.apache.maven.plugin.logging Log info

List of usage examples for org.apache.maven.plugin.logging Log info

Introduction

In this page you can find the example usage for org.apache.maven.plugin.logging Log info.

Prototype

void info(Throwable error);

Source Link

Document

Send an exception to the user in the info error level.
The stack trace for this exception will be output when this error level is enabled.

Usage

From source file:de.smartics.maven.alias.AbstractReportMojo.java

License:Apache License

/**
 * Runs the report generation.// ww w.  j  a  v  a2  s . co m
 *
 * @throws MojoExecutionException on any problem encountered.
 */
public void execute() throws MojoExecutionException {
    final Log log = getLog();
    if (!canGenerateReport()) {
        if (log.isInfoEnabled()) {
            log.info("Report '" + getName(Locale.getDefault()) + "' skipped due to offline mode.");
        }
        return;
    }

    provideSink();
}

From source file:de.smartics.maven.ea.EaImageExportMojo.java

License:Apache License

@Override
public void execute() throws MojoExecutionException, MojoFailureException {
    if (skip) {//from   w w w. j ava2  s .c  o m
        final Log log = getLog();
        log.info("Skipping exporting the Enterprise Architect Model since skip='true'.");
        return;
    }

    provideDefaultConfig();

    runExport();
}

From source file:de.smartics.maven.ea.EaImageExportMojo.java

License:Apache License

private void provideDefaultConfig() {
    if (htmlExportConfig == null) {
        htmlExportConfig = new HtmlExport();
    }/*from w w  w  .  j  a v  a  2s.  c  o m*/

    if (xmiPackageExportConfig == null) {
        xmiPackageExportConfig = new XmiPackageExport();
    }

    xmiPackageExportConfig.init();

    final Log log = getLog();
    if (generateHtmlSite) {
        if (verbose)
            log.info("HTML config: " + htmlExportConfig);
    }
    if (generateXmi) {
        if (verbose)
            log.info("XMI config: " + xmiPackageExportConfig);
    }
}

From source file:de.smartics.maven.enforcer.rule.AbstractNoCyclicPackageDependencyRule.java

License:Apache License

/**
 * {@inheritDoc}/*from  www  .j  av  a 2  s  .c  o m*/
 */
// CHECKSTYLE:OFF
@SuppressWarnings("unchecked")
public void execute(final EnforcerRuleHelper helper) throws EnforcerRuleException {
    final Log log = helper.getLog();

    try {
        final MavenProject project = (MavenProject) helper.evaluate("${project}");
        final String projectName = project.getName();

        final File classesDir = new File((String) helper.evaluate("${project.build.outputDirectory}"));

        if (classesDir.canRead()) {
            final JDepend jdepend = new JDepend();
            jdepend.addDirectory(classesDir.getAbsolutePath());
            addTestClassesIfRequested(helper, classesDir, jdepend);

            final Collection<JavaPackage> packages = jdepend.analyze();
            if (jdepend.containsCycles()) {
                final String buffer = collectCycles(packages);
                throw new EnforcerRuleException(
                        "Dependency cycle check found package cycles in '" + projectName + "': " + buffer);
            } else {
                log.info("No package cycles found in '" + projectName + "'.");
            }
        } else {
            log.warn("Skipping package cycle analysis since '" + classesDir + "' does not exist.");
        }
    } catch (final ExpressionEvaluationException e) {
        throw new EnforcerRuleException(
                "Dependency cycle check is unable to evaluate expression '" + e.getLocalizedMessage() + "'.",
                e);
    } catch (final IOException e) {
        throw new EnforcerRuleException("Dependency cycle check is unable to access a classes directory '"
                + e.getLocalizedMessage() + "'.", e);
    }
}

From source file:de.smartics.maven.enforcer.rule.NoSnapshotsInDependencyManagementRule.java

License:Apache License

/**
 * {@inheritDoc}/* w w  w.  j a va 2s .  c o m*/
 */
public void execute(final EnforcerRuleHelper helper) throws EnforcerRuleException {
    final Log log = helper.getLog();

    try {
        final MavenProject project = (MavenProject) helper.evaluate("${project}");

        final boolean isSnapshot = project.getArtifact().isSnapshot();
        if (onlyWhenRelease && isSnapshot) {
            log.info(getCacheId() + ": Skipping since not a release.");
            return;
        }

        final DependencyManagement dependencyManagement = project.getModel().getDependencyManagement();
        if (dependencyManagement == null) {
            log.debug(getCacheId() + ": No dependency management block found.");
            return;
        }

        if (!checkOnlyResolvedDependencies) {
            final DependencyManagement originalDependencyManagement = project.getOriginalModel()
                    .getDependencyManagement();
            if (originalDependencyManagement != null) {
                final List<Dependency> declaredDependencies = originalDependencyManagement.getDependencies();
                if (declaredDependencies != null && !declaredDependencies.isEmpty()) {
                    checkDependenciesForSnapshots(helper, log, declaredDependencies);
                }
            }
        }

        final List<Dependency> dependencies = dependencyManagement.getDependencies();
        if (dependencies == null || dependencies.isEmpty()) {
            log.debug(getCacheId() + ": No dependencies in dependency management block found.");
            return;
        }
        checkDependenciesForSnapshots(helper, log, dependencies);
    } catch (final ExpressionEvaluationException e) {
        throw new EnforcerRuleException("Unable to evaluate expression '" + e.getLocalizedMessage() + "'.", e);
    }
}

From source file:de.smartics.maven.plugin.jboss.modules.IndexMojo.java

License:Apache License

@Override
public void execute() throws MojoExecutionException, MojoFailureException {
    final Log log = getLog();

    if (skip) {//from w  w w. ja  v a  2s  . co m
        log.info("Skipping creating index since skip='true'.");
        return;
    }

    runIndexing();
}

From source file:de.smartics.maven.plugin.jboss.modules.JandexMojo.java

License:Apache License

@Override
public void execute() throws MojoExecutionException, MojoFailureException {
    final Log log = getLog();

    if (skip) {/* w  w  w  . j  a  va  2 s. c o m*/
        log.info("Skipping creating Jandex since skip='true'.");
        return;
    }

    runIndexing();
}

From source file:de.smartics.maven.plugin.jboss.modules.JBossModulesArchiveMojo.java

License:Apache License

@Override
public void execute() throws MojoExecutionException, MojoFailureException {
    final Log log = getLog();

    if (skip) {/*from w  w w.  j  a  v  a 2  s.  c  om*/
        log.info("Skipping creating archive for JBoss modules since skip='true'.");
        return;
    }

    this.modulesDescriptors = initModulesDescriptors();
    this.allModules = initModules();
    this.repositorySession = adjustSession();

    final List<Dependency> rootDependencies = calcRootDependencies();
    final List<Dependency> dependencies = resolve(rootDependencies);

    logDependencies(rootDependencies, dependencies);
    runModuleCreation(dependencies);
    attach();
}

From source file:de.tarent.maven.plugins.pkg.AbstractPackagingMojo.java

License:Open Source License

protected final boolean packagingTypeBelongsToIgnoreList() {
    boolean inList = false;
    Log l = getLog();
    l.info("ignorePackagingTypes set. Contains: " + ignorePackagingTypes + " . Project packaging is "
            + project.getPackaging());/*ww w .j a  v  a 2s  . c  om*/
    for (String s : ignorePackagingTypes.split(",")) {
        if (project.getPackaging().compareToIgnoreCase(s) == 0) {
            inList = true;
        }
    }
    return inList;
}

From source file:de.tarent.maven.plugins.pkg.AbstractPackagingMojo.java

License:Open Source License

/**
 * Validates arguments and test tools./*from   w  w w . j  av a2  s.c  o m*/
 * 
 * @throws MojoExecutionException
 */
protected void checkEnvironment(Log l, TargetConfiguration tc) throws MojoExecutionException {
    // l.info("distribution             : " + tc.getChosenDistro());
    l.info("default package map      : "
            + (defaultPackageMapURL == null ? "built-in" : defaultPackageMapURL.toString()));
    l.info("auxiliary package map    : " + (auxPackageMapURL == null ? "no" : auxPackageMapURL.toString()));
    l.info("type of project          : " + ((tc.getMainClass() != null) ? "application" : "library"));
    l.info("section                  : " + tc.getSection());
    l.info("bundle all dependencies  : " + ((tc.isBundleAll()) ? "yes" : "no"));
    l.info("ahead of time compilation: " + ((tc.isAotCompile()) ? "yes" : "no"));
    l.info("custom jar libraries     : "
            + ((tc.getJarFiles().isEmpty()) ? "<none>" : String.valueOf(tc.getJarFiles().size())));
    l.info("JNI libraries            : "
            + ((tc.getJniFiles().isEmpty()) ? "<none>" : String.valueOf(tc.getJniFiles().size())));
    l.info("auxiliary file source dir: "
            + (tc.getSrcAuxFilesDir().length() == 0 ? (getDefaultSrcAuxfilesdir() + " (default)")
                    : tc.getSrcAuxFilesDir()));
    l.info("auxiliary files          : "
            + ((tc.getAuxFiles().isEmpty()) ? "<none>" : String.valueOf(tc.getAuxFiles().size())));
    l.info("prefix                   : " + (tc.getPrefix().length() == 1 ? "/ (default)" : tc.getPrefix()));
    l.info("sysconf files source dir : "
            + (tc.getSrcSysconfFilesDir().length() == 0 ? (getDefaultSrcAuxfilesdir() + " (default)")
                    : tc.getSrcSysconfFilesDir()));
    l.info("sysconfdir               : "
            + (tc.getSysconfdir().length() == 0 ? "(default)" : tc.getSysconfdir()));
    l.info("dataroot files source dir: "
            + (tc.getSrcDatarootFilesDir().length() == 0 ? (getDefaultSrcAuxfilesdir() + " (default)")
                    : tc.getSrcDatarootFilesDir()));
    l.info("dataroot                 : "
            + (tc.getDatarootdir().length() == 0 ? "(default)" : tc.getDatarootdir()));
    l.info("data files source dir    : "
            + (tc.getSrcDataFilesDir().length() == 0 ? (getDefaultSrcAuxfilesdir() + " (default)")
                    : tc.getSrcDataFilesDir()));
    l.info("datadir                  : " + (tc.getDatadir().length() == 0 ? "(default)" : tc.getDatadir()));
    l.info("bindir                   : " + (tc.getBindir().length() == 0 ? "(default)" : tc.getBindir()));

    /*
     * if (ws.getChosenDistro() == null) { throw new
     * MojoExecutionException("No distribution configured!"); }
     */

    if (tc.isAotCompile()) {
        l.info("aot compiler             : " + tc.getGcjExec());
        l.info("aot classmap generator   : " + tc.getGcjDbToolExec());
    }

    if (tc.getMainClass() == null) {
        if (!"libs".equals(tc.getSection())) {
            throw new MojoExecutionException("section has to be 'libs' if no main class is given.");
        }
        if (tc.isBundleAll()) {
            throw new MojoExecutionException("Bundling dependencies to a library makes no sense.");
        }
    } else {
        if ("libs".equals(tc.getSection())) {
            throw new MojoExecutionException("Set a proper section if main class parameter is set.");
        }
    }

    if (tc.isAotCompile()) {
        AotCompileUtils.setGcjExecutable(tc.getGcjExec());
        AotCompileUtils.setGcjDbToolExecutable(tc.getGcjDbToolExec());

        AotCompileUtils.checkToolAvailability();
    }
}