Package org.apache.maven.plugin.logging

Examples of org.apache.maven.plugin.logging.Log


            }
        }
    }

    protected String convertFile(File file, String format) throws CommandLineException {
        Log log = getLog();
        if (!useDot) {
            log.info("DOT generation disabled");
            return null;
        }
        if (this.executable == null || this.executable.length() == 0) {
            log.warn("Parameter <executable/> was not set in the pom.xml.  Skipping conversion.");
            return null;
        }

        String generatedFileName = removeFileExtension(file.getAbsolutePath()) + "." + format;
        Commandline cl = new Commandline();
        cl.setExecutable(executable);
        cl.createArgument().setValue("-T" + format);
        cl.createArgument().setValue("-o");
        cl.createArgument().setValue(generatedFileName);
        cl.createArgument().setValue(file.getAbsolutePath());

        log.debug("executing: " + cl.toString());

        CommandLineUtils.StringStreamConsumer stdout = new CommandLineUtils.StringStreamConsumer();
        CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();

        int exitCode = CommandLineUtils.executeCommandLine(cl, stdout, stderr);

        String output = stdout.getOutput();
        if (output.length() > 0) {
            log.debug(output);
        }
        String errOutput = stderr.getOutput();
        if (errOutput.length() > 0) {
            log.warn(errOutput);
        }
        return generatedFileName;
    }
View Full Code Here


     */
    private List<Compilation> compilations;

    @Override
    public void execute() throws MojoExecutionException, MojoFailureException {
        Log log = getLog();
        Preconditions.checkNotNull(this.compilations);

        for (Compilation compilation : this.compilations) {

            List<SourceFile> externs =
                    getSourceFiles(compilation.getExternFiles());
            List<SourceFile> source =
                    getSourceFiles(compilation.getSourceFiles());

            for (String sourceFile : compilation.getExternFiles()) {
                log.info("Compiling from extern: " + sourceFile);
            }
            for (String sourceFile : compilation.getSourceFiles()) {
                log.info("Compiling from source: " + sourceFile);
            }

            log.info("Compiling to: " + compilation.getOutputFile());
            log.info("Compiling with level: "
                    + compilation.getCompilationLevel());

            CompilationLevel compilationLevel = null;
            try {
                compilationLevel =
                        CompilationLevel.valueOf(compilation
                                .getCompilationLevel());
            } catch (IllegalArgumentException e) {
                throw new MojoFailureException("Compilation level invalid", e);
            }

            CompilerOptions compilerOptions =
                    compilation.getCompilerOptionsMojo().getCompilerOptions();
            if (null == compilerOptions) {
                log.info("With no compiler options");
                compilerOptions = new CompilerOptions();
            }
            log.info("Compiler Options:" + compilerOptions);

            compilationLevel.setOptionsForCompilationLevel(compilerOptions);

            Compiler compiler = new Compiler();
            Result result = compiler.compile(externs, source, compilerOptions);
View Full Code Here

   * @throws MojoExecutionException on any problem encountered.
   */
  @Override
public void execute() throws MojoExecutionException // CHECKSTYLE:ON
  {
    final Log log = getLog();
    if (!canGenerateReport())
    {
      if (log.isInfoEnabled())
      {
        log.info("Report '" + getName(Locale.getDefault())
                 + "' skipped due to offline mode.");
      }
      return;
    }
    getLog();
View Full Code Here

   * @see org.apache.maven.reporting.AbstractMavenReport#executeReport(java.util.Locale)
   */
  @Override
  protected void executeReport(final Locale locale) throws MavenReportException // CHECKSTYLE:ON
  {
  final Log log = getLog();
    if (!canGenerateReport())
    {
      if (log.isInfoEnabled())
      {
        log.info("Report '" + getName(Locale.getDefault())
                 + "' skipped due to offline mode.");
      }
      return;
    }
  }
View Full Code Here

  private static final String PORT = "9124"; // Using default port disturbs other tests for some reason

  @After
  public void tearDown() {
    ByteArrayOutputStream logStream = new ByteArrayOutputStream();
    Log log = new DefaultLog(new PrintStreamLogger(
      Logger.LEVEL_INFO, "test", new PrintStream(logStream)));
         new FitNesseHelper(log).shutdownFitNesseServer(PORT);
  }
View Full Code Here

  @Before
  public void setUp() {
    artifactHandler = mock(ArtifactHandler.class);
   
    logStream = new ByteArrayOutputStream();
    Log log = new DefaultLog(new PrintStreamLogger(
      Logger.LEVEL_INFO, "test", new PrintStream(logStream)));
   
    fitNesseHelper = new FitNesseHelper(log);
  }
View Full Code Here

    private File baseDirWhitespace;
   
  @Before
  public void setUp() {
    logStream = new ByteArrayOutputStream();
    Log log = new DefaultLog(new PrintStreamLogger(
      Logger.LEVEL_INFO, "test", new PrintStream(logStream)));
   
    fitNesseHelper = new FitNesseHelper(log);
   
        baseDir = new File("/tmp", BASE_DIR);
View Full Code Here

    @Parameter(alias = "startup-timeout", defaultValue = Defaults.TIMEOUT, property = PropertyNames.STARTUP_TIMEOUT)
    private long startupTimeout;

    @Override
    public void execute() throws MojoExecutionException, MojoFailureException {
        final Log log = getLog();
        // Validate the environment
        final File jbossHome = extractIfRequired(targetDir);
        if (!jbossHome.isDirectory()) {
            throw new MojoExecutionException(String.format("JBOSS_HOME '%s' is not a valid directory.", jbossHome));
        }
        // JVM arguments should be space delimited
        final String[] jvmArgs = (this.jvmArgs == null ? null : this.jvmArgs.split("\\s+"));
        final String javaHome;
        if (this.javaHome == null) {
            javaHome = SecurityActions.getEnvironmentVariable("JAVA_HOME");
        } else {
            javaHome = this.javaHome;
        }
        final List<String> invalidPaths = modulesPath.validate();
        if (!invalidPaths.isEmpty()) {
            throw new MojoExecutionException("Invalid module path(s). " + invalidPaths);
        }
        final ServerInfo serverInfo = ServerInfo.of(this, javaHome, jbossHome, modulesPath.get(), bundlesPath, jvmArgs, serverConfig, propertiesFile, startupTimeout);
        // Print some server information
        log.info(String.format("JAVA_HOME=%s", javaHome));
        log.info(String.format("JBOSS_HOME=%s%n", jbossHome));
        try {
            // Create the server
            final Server server = new StandaloneServer(serverInfo);
            // Add the shutdown hook
            SecurityActions.registerShutdown(server);
            // Start the server
            log.info("Server is starting up.");
            server.start();
            server.checkServerState();
        } catch (Exception e) {
            throw new MojoExecutionException("The server failed to start", e);
        }
View Full Code Here

    @Parameter(alias = "startup-timeout", defaultValue = Defaults.TIMEOUT, property = PropertyNames.STARTUP_TIMEOUT)
    private long startupTimeout;

    @Override
    protected void doExecute() throws MojoExecutionException, MojoFailureException {
        final Log log = getLog();
        final File deploymentFile = file();
        final String deploymentName = deploymentFile.getName();
        final File targetDir = deploymentFile.getParentFile();
        // The deployment must exist before we do anything
        if (!deploymentFile.exists()) {
            throw new MojoExecutionException(String.format("The deployment '%s' could not be found.", deploymentFile.getAbsolutePath()));
        }
        // Validate the environment
        final File jbossHome = extractIfRequired(targetDir);
        if (!jbossHome.isDirectory()) {
            throw new MojoExecutionException(String.format("JBOSS_HOME '%s' is not a valid directory.", jbossHome));
        }
        // JVM arguments should be space delimited
        final String[] jvmArgs = (this.jvmArgs == null ? null : this.jvmArgs.split("\\s+"));
        final String javaHome;
        if (this.javaHome == null) {
            javaHome = SecurityActions.getEnvironmentVariable("JAVA_HOME");
        } else {
            javaHome = this.javaHome;
        }
        final List<String> invalidPaths = modulesPath.validate();
        if (!invalidPaths.isEmpty()) {
            throw new MojoExecutionException("Invalid module path(s). " + invalidPaths);
        }
        final ServerInfo serverInfo = ServerInfo.of(this, javaHome, jbossHome, modulesPath.get(), bundlesPath, jvmArgs, serverConfig, propertiesFile, startupTimeout);

        // Print some server information
        log.info(String.format("JAVA_HOME=%s", javaHome));
        log.info(String.format("JBOSS_HOME=%s%n", jbossHome));
        try {
            // Create the server
            final Server server = new StandaloneServer(serverInfo);
            // Add the shutdown hook
            SecurityActions.registerShutdown(server);
            // Start the server
            log.info("Server is starting up. Press CTRL + C to stop the server.");
            server.start();
            // Deploy the application
            server.checkServerState();
            if (server.isRunning()) {
                log.info(String.format("Deploying application '%s'%n", deploymentFile.getName()));
                final ModelControllerClient client = server.getClient();
                final Deployment deployment = StandaloneDeployment.create(client, deploymentFile, deploymentName, getType(), null, null);
                switch (executeDeployment(client, deployment)) {
                    case REQUIRES_RESTART: {
                        client.execute(ServerOperations.createOperation(ServerOperations.RELOAD));
View Full Code Here

            }
        }
    }

    protected String convertFile(File file, String format) throws CommandLineException {
        Log log = getLog();
        if (!useDot) {
            log.info("DOT generation disabled.");
            return null;
        } else {           
            if (dotHelpExitCode() != 0) {
                log.info("'dot -?' execution failed so DOT generation disabled.");
                return null;
            }
        }
        if (this.executable == null || this.executable.length() == 0) {
            log.warn("Parameter <executable/> was not set in the pom.xml.  Skipping conversion.");
            return null;
        }

        String generatedFileName = removeFileExtension(file.getAbsolutePath()) + "." + format;
        Commandline cl = new Commandline();
        cl.setExecutable(executable);
        cl.createArgument().setValue("-T" + format);
        cl.createArgument().setValue("-o");
        cl.createArgument().setValue(generatedFileName);
        cl.createArgument().setValue(file.getAbsolutePath());

        log.debug("executing: " + cl.toString());

        CommandLineUtils.StringStreamConsumer stdout = new CommandLineUtils.StringStreamConsumer();
        CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();

        int exitCode = CommandLineUtils.executeCommandLine(cl, stdout, stderr);

        String output = stdout.getOutput();
        if (output.length() > 0) {
            log.debug(output);
        }
        String errOutput = stderr.getOutput();
        if (errOutput.length() > 0) {
            log.warn(errOutput);
        }
        return generatedFileName;
    }
View Full Code Here

TOP

Related Classes of org.apache.maven.plugin.logging.Log

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.