Java 类org.apache.maven.plugin.logging.Log 实例源码

项目:Pogamut3    文件:AbstractDependencyMojo.java   
/**
 * Does the actual copy of the file and logging.
 *
 * @param artifact represents the file to copy.
 * @param destFile file name of destination file.
 *
 * @throws MojoExecutionException with a message if an
 *             error occurs.
 */
protected void copyFile ( File artifact, File destFile )
    throws MojoExecutionException
{
    Log theLog = this.getLog();
    try
    {
        theLog.info( "Copying "
            + ( this.outputAbsoluteArtifactFilename ? artifact.getAbsolutePath() : artifact.getName() ) + " to "
            + destFile );
        FileUtils.copyFile( artifact, destFile );

    }
    catch ( Exception e )
    {
        throw new MojoExecutionException( "Error copying artifact from " + artifact + " to " + destFile, e );
    }
}
项目:Pogamut3    文件:TestSilentLog.java   
public void testLog()
{
    Log log = new DependencySilentLog();
    String text = new String( "Text" );
    Throwable e = new RuntimeException();
    log.debug( text );
    log.debug( text, e );
    log.debug( e );
    log.info( text );
    log.info( text, e );
    log.info( e );
    log.warn( text );
    log.warn( text, e );
    log.warn( e );
    log.error( text );
    log.error( text, e );
    log.error( e );
    log.isDebugEnabled();
    log.isErrorEnabled();
    log.isWarnEnabled();
    log.isInfoEnabled();
}
项目:Pogamut3    文件:DependencyTestUtils.java   
/**
 * Deletes a directory and its contents.
 * 
 * @param dir
 *            The base directory of the included and excluded files.
 * @throws IOException
 * @throws MojoExecutionException
 *             When a directory failed to get deleted.
 */
public static void removeDirectory( File dir )
    throws IOException
{
    if ( dir != null )
    {
        Log log = new SilentLog();
        FileSetManager fileSetManager = new FileSetManager( log, false );

        FileSet fs = new FileSet();
        fs.setDirectory( dir.getPath() );
        fs.addInclude( "**/**" );
        fileSetManager.delete( fs );

    }
}
项目:devops-cstack    文件:RestUtils.java   
/**
 * sendGetCommand
 * 
 * @param url
 * @param log
 * @return
 * @throws MojoExecutionException
 * @throws CheckException
 */
public Map<String, String> sendGetCommand( String url, Log log )
    throws CheckException
{
    Map<String, String> response = new HashMap<String, String>();
    CloseableHttpClient httpclient = HttpClients.createDefault();
    HttpGet httpget = new HttpGet( url );
    try
    {
        CloseableHttpResponse httpResponse = httpclient.execute( httpget, localContext );
        ResponseHandler<String> handler = new ResponseErrorHandler();
        String body = handler.handleResponse( httpResponse );
        response.put( "body", body );
        httpResponse.close();

    }
    catch ( Exception e )
    {
        log.warn( "GET request failed!" );

        throw new CheckException( "Send GET to server failed!", e );
    }

    return response;
}
项目:magic-beanstalk    文件:ZipMojo.java   
@Override
public void execute() throws MojoExecutionException {
  final Log log = getLog();

  if (skipZip) {
    log.info("skipZip is true. Skipping zipping.");
    return;
  }
  try {
    for (ZipTarget zipTarget : zipTargets) {

      ZipUtil.writeZip(zipTarget.getZipFiles(), zipTarget.getZipDest(), buildPath);
      log.info("Created zip:" + zipTarget.getZipDest());
    }
  } catch (IOException e) {
    throw new MojoExecutionException("IO Exception encountered: ", e);
  }
}
项目:magic-beanstalk    文件:DefaultDockerrunMojo.java   
@Override
public void execute() throws MojoExecutionException {
  final Log log = getLog();

  if (skipGenTemplate) {
    log.info("skipGenTemplate is true. Skipping generate template step.");
    return;
  }

  try {
    log.info("Generating default Dockerrun.aws.json template...");
    Map<String, Object> templateArgs = getTemplateArgs();
    FileGenerator.generateDefaultDockerrunFile(
        dockerrunDest,
        templateArgs
    );
  } catch (Exception e) {
    throw new MojoExecutionException("Failed to generate file", e);
  }
}
项目:carnotzet    文件:Welcome.java   
public static void execute(ContainerOrchestrationRuntime runtime, Carnotzet carnotzet, Log log)
        throws MojoExecutionException, MojoFailureException {
    try {
        IpPlaceholderResolver ipPlaceholderResolver = new IpPlaceholderResolver(runtime);

        WelcomePageGenerator generator = new WelcomePageGenerator(Arrays.asList(ipPlaceholderResolver));

        Path moduleResources = carnotzet.getResourcesFolder().resolve("expanded-jars");
        Path welcomePagePath = carnotzet.getResourcesFolder().resolve("welcome.html");

        generator.buildWelcomeHtmlFile(moduleResources, welcomePagePath);

        new ProcessBuilder("xdg-open", "file://" + welcomePagePath).start();
        log.info("********************************************************");
        log.info("*                                                      *");
        log.info("* The WELCOME page was opened in your default browser  *");
        log.info("*                                                      *");
        log.info("********************************************************");
    }
    catch (IOException e) {
        throw new MojoExecutionException("Cannot start browser:" + e, e);
    }
}
项目:carnotzet    文件:Addresses.java   
public static void execute(ContainerOrchestrationRuntime runtime, Log log) {
    List<Container> containers = runtime.getContainers();
    if (containers.isEmpty()) {
        log.info("There doesn't seem to be any containers created yet for this carnotzet, please make sure the carnotzet is started");
        return;
    }

    log.info("");
    log.info(String.format("%-25s", "APPLICATION") + "   IP ADDRESS");
    log.info("");
    for (Container container : containers) {
        log.info(String.format("%-25s", container.getServiceName()) + " : "
                + (container.getIp() == null ? "No address, is container started ?"
                : container.getIp() + " (" + container.getServiceName() + ".docker)"));
    }
    log.info("");
}
项目:carnotzet    文件:Shell.java   
/**
 * Lists services and prompts the user to choose one
 */
private static Container promptForContainer(List<Container> containers, Prompter prompter, Log log) throws MojoExecutionException {

    log.info("");
    log.info("SERVICE");
    log.info("");
    Map<Integer, Container> options = new HashMap<>();
    Integer i = 1;

    for (Container container : containers) {
        options.put(i, container);
        log.info(String.format("%2d", i) + " : " + container.getServiceName());
        i++;
    }
    log.info("");
    try {
        String prompt = prompter.prompt("Choose a service");
        return options.get(Integer.valueOf(prompt));
    }
    catch (PrompterException e) {
        throw new MojoExecutionException("Prompter error" + e.getMessage());
    }
}
项目:apache-maven-shade-plugin    文件:MinijarFilter.java   
/**
 * @param project {@link MavenProject}
 * @param log {@link Log}
 * @param simpleFilters {@link SimpleFilter}
 * @throws IOException in case of errors.
 * @since 1.6
 */
public MinijarFilter( MavenProject project, Log log, List<SimpleFilter> simpleFilters )
    throws IOException
{

    this.log = log;

    Clazzpath cp = new Clazzpath();

    ClazzpathUnit artifactUnit =
        cp.addClazzpathUnit( new FileInputStream( project.getArtifact().getFile() ), project.toString() );

    for ( Artifact dependency : project.getArtifacts() )
    {
        addDependencyToClasspath( cp, dependency );
    }

    removable = cp.getClazzes();
    removePackages( artifactUnit );
    removable.removeAll( artifactUnit.getClazzes() );
    removable.removeAll( artifactUnit.getTransitiveDependencies() );
    removeSpecificallyIncludedClasses( project, simpleFilters == null ? Collections.<SimpleFilter>emptyList()
                    : simpleFilters );
}
项目:solr-maven-plugin    文件:SolrCloudManager.java   
/**
 * Upload config to ZK
 * 
 * @param log maven log
 * @throws MojoExecutionException exception
 */
public synchronized void uploadConfig(Log log) throws MojoExecutionException {
    try (SolrZkClient zkClient = new SolrZkClient(solrCloud.getZkServer().getZkAddress(chroot), TIMEOUT, TIMEOUT, null)) {
        ZkConfigManager manager = new ZkConfigManager(zkClient);
        if(manager.configExists(configName)) {
            throw new MojoExecutionException("Config " + configName + " already exists on ZK");
        }

        log.debug("about to upload config from " + confDir + " to " + configName);
        manager.uploadConfigDir(confDir, configName);
        log.debug("Config uploaded");
    }
    catch (IOException e) {
        throw new MojoExecutionException("Can't upload solr config in ZK " + configName, e);
    }
}
项目:dockerfile-maven    文件:AbstractDockerMojo.java   
@Nonnull
protected File buildDockerInfoJar(@Nonnull Log log) throws MojoExecutionException {
  final File jarFile = getJarFile(buildDirectory, finalName, classifier);

  final MavenArchiver archiver = new MavenArchiver();
  archiver.setArchiver(jarArchiver);
  archiver.setOutputFile(jarFile);

  archive.setForced(forceCreation);

  if (dockerInfoDirectory.exists()) {
    final String prefix = getMetaSubdir();
    archiver.getArchiver().addDirectory(dockerInfoDirectory, prefix);
  } else {
    log.warn("Docker info directory not created - Docker info JAR will be empty");
  }

  try {
    archiver.createArchive(session, project, archive);
  } catch (Exception e) {
    throw new MojoExecutionException("Could not build Docker info JAR", e);
  }

  return jarFile;
}
项目:beyondj    文件:Zips.java   
/**
 * Creates a zip fie from the given source directory and output zip file name
 */
public static void createZipFile(Log log, File sourceDir, File outputZipFile) throws IOException {
    outputZipFile.getParentFile().mkdirs();
    OutputStream os = new FileOutputStream(outputZipFile);
    ZipOutputStream zos = new ZipOutputStream(os);
    try {
        //zos.setLevel(Deflater.DEFAULT_COMPRESSION);
        //zos.setLevel(Deflater.NO_COMPRESSION);
        String path = "";
        FileFilter filter = null;
        zipDirectory(log, sourceDir, zos, path, filter);
    } finally {
        try {
            zos.close();
        } catch (Exception e) {
        }
    }
}
项目:mavensonarsputnik    文件:MavenEnvironment.java   
public MavenEnvironment(MavenSession aMavenSession, BuildPluginManager aBuildPluginManager, Log aLog,
        DependencyTreeBuilder aDependencyTreeBuilder, ArtifactRepository aLocalRepository,
        SecDispatcher aSecurityDispatcher, MavenProjectBuilder aProjectBuilder,
        LifecycleExecutor aLifecycleExecutor, ArtifactFactory aArtifactFactory,
        ArtifactMetadataSource aArtifactMetadataSource, ArtifactCollector aArtifactCollector, RuntimeInformation aRuntimeInformation,
        MojoExecution aExecution) {
    mavenSession = aMavenSession;
    buildPluginManager = aBuildPluginManager;
    log = aLog;
    dependencyTreeBuilder = aDependencyTreeBuilder;
    localRepository = aLocalRepository;
    securityDispatcher = aSecurityDispatcher;
    projectBuilder = aProjectBuilder;
    lifecycleExecutor = aLifecycleExecutor;
    artifactFactory = aArtifactFactory;
    artifactMetadataSource = aArtifactMetadataSource;
    artifactCollector = aArtifactCollector;
    runtimeInformation = aRuntimeInformation;
    mojoExecution = aExecution;
}
项目:gwtcoverage-maven-plugin    文件:SourcesListMojo.java   
private void scanDirectory(File directory, BufferedWriter writer) throws IOException {
    if (!directory.exists())
        return;

    final Log log = getLog();
    log.info("scanning source directory '" + directory.getAbsolutePath() + "'");

    DirectoryScanner scanner = new DirectoryScanner();
    scanner.setIncludes(includes);
    scanner.setExcludes(excludes);
    scanner.setBasedir(directory);
    scanner.scan();

    for (String fileName : scanner.getIncludedFiles()) {
        writer.write(fileName);
        writer.newLine();
    }
}
项目:mvn-golang    文件:CvsSVN.java   
@Override
public boolean processCVSRequisites(
        @Nonnull final Log logger,
        @Nullable final ProxySettings proxy,
        @Nullable final String customCommand,
        @Nonnull final File cvsFolder,
        @Nullable final String branchId,
        @Nullable final String tagId,
        @Nullable final String revisionId
) {
    boolean noError = true;

    if (branchId != null) {
        noError &= upToBranch(logger, proxy, customCommand, cvsFolder, branchId);
    }

    if (noError && tagId != null) {
        noError &= upToTag(logger, proxy, customCommand, cvsFolder, tagId);
    }

    if (noError && revisionId != null) {
        noError &= upToRevision(logger, proxy, customCommand, cvsFolder, revisionId);
    }

    return noError;
}
项目:maven-javassist    文件:ClassProcessorTask.java   
/**
 * Constructor.
 *
 * @param context The {@code BuildContext} instance.
 * @param ctClass The {@code CtClass} instance to conditionally process.
 * @param processor The {@code ClassProcessor} instance to apply if included.
 * @param includePredicate The {@code Predicate} to include an element in processing.
 * @param excludePredicate The {@code Predicate} to exclude an element from processing.
 * @param outputDirectory The output directory to write the transformed class to.
 * @param log The {@code Log} instance to record processing to.
 */
ClassProcessorTask(
        final BuildContext context,
        final CtClass ctClass,
        final ClassProcessor processor,
        final Predicate<CtClass> includePredicate,
        final Predicate<CtClass> excludePredicate,
        final Path outputDirectory,
        final Log log) {
    _context = context;
    _ctClass = ctClass;
    _processor = processor;
    _includePredicate = includePredicate;
    _excludePredicate = excludePredicate;
    _outputDirectory = outputDirectory;
    _log = log;
}
项目:Maven-IIB9-Plug-In    文件:EclipseProjectUtils.java   
/**
 * @param projectDirectory the (workspace) directory containing the project
 * @param log logger to be used if debugging information should be produced
 * @return true if the project is an IIB Application
 * @throws MojoFailureException if something went wrong
 */
public static boolean isLibrary(File projectDirectory, Log log) throws MojoFailureException {
    try
    {
        if (projectDirectory.getName().equalsIgnoreCase("BARFiles")) {
            return false;
        }

        List<String> natureList = getProjectDescription(projectDirectory).getNatures().getNature();
        if (natureList
                .contains("com.ibm.etools.msgbroker.tooling.libraryNature")) {
            log.debug(projectDirectory + " is an IIB Library");
            return true;
        } else {
            return false;
        }
    } catch (Exception e)
    {
        String message = "An error occurred trying to determine the nature of the eclipse project at " + projectDirectory.getAbsolutePath() + ".";
        message += "\n" + "The error was: " + e;
        message += "\n" + "Instead of allowing the build to fail, the EclipseProjectUtils.isLibrary() method is returning false";
        log.warn(message);
        return false;
    }
}
项目:cloudera-parcel    文件:Parcel.java   
public boolean install(Log log) throws MojoExecutionException {
  isValid(ImmutableMap.of("buildDirectory", buildDirectory, "localRepositoryDirectory", localRepositoryDirectory));
  File buildPath = new File(getFile(buildDirectory).getAbsolutePath(), getArtifactName());
  File buildPathSha1 = new File(getFile(buildDirectory).getAbsolutePath(), getArtifactName() + SUFFIX_SHA1);
  File repositoryRootPath = new File(getFile(localRepositoryDirectory).getAbsolutePath(), getLocalPath()).getParentFile();
  File repositoryPath = new File(repositoryRootPath, getArtifactName());
  File repositoryPathSha1 = new File(repositoryRootPath, getArtifactName() + SUFFIX_SHA1);
  try {
    if (assertSha1(log, buildPath, buildPathSha1, false)) {
      log.info("Installing " + buildPath + " to " + repositoryPath);

      FileUtils.copyFileToDirectory(buildPath, repositoryRootPath);
      FileUtils.copyFileToDirectory(buildPathSha1, repositoryRootPath);
    }
  } catch (Exception exception) {
    throw new MojoExecutionException(
      "Failed to install artifact [" + getArtifactNamespace() + "] from [" + buildPath + "] to [" + repositoryRootPath + "]",
      exception);
  }
  return assertSha1(log, repositoryPath, repositoryPathSha1, false);
}
项目:git-changelog-maven-plugin    文件:RepositoryProcessor.java   
public RepositoryProcessor(boolean deduplicateChildCommits, String toRef, String nextRelease, String gitHubUrl,
                           Predicate<RevCommit> commitFilter, List<CommitHandler> commitHandlers, String pathFilter,
                           String tagPrefix, Log log) {
    this.deduplicateChildCommits = deduplicateChildCommits;
    this.toRef = toRef;
    this.nextRelease = nextRelease;
    this.gitHubUrl = gitHubUrl;
    this.commitFilter = commitFilter;
    if (!isBlank(pathFilter) && !"/".equals(pathFilter)) {
        this.pathFilter = PathFilter.create(pathFilter);
    } else {
        this.pathFilter = PathFilter.ALL;
    }
    this.commitHandlers.addAll(commitHandlers);
    tagPattern = Pattern.compile(tagPrefix + "-([^-]+?)$");
    this.log = log;
}
项目:spring-boot-concourse    文件:ArtifactsLibrariesTests.java   
@Test
public void renamesDuplicates() throws Exception {
    Artifact artifact1 = mock(Artifact.class);
    Artifact artifact2 = mock(Artifact.class);
    given(artifact1.getType()).willReturn("jar");
    given(artifact1.getScope()).willReturn("compile");
    given(artifact1.getGroupId()).willReturn("g1");
    given(artifact1.getFile()).willReturn(new File("a"));
    given(artifact2.getType()).willReturn("jar");
    given(artifact2.getScope()).willReturn("compile");
    given(artifact2.getGroupId()).willReturn("g2");
    given(artifact2.getFile()).willReturn(new File("a"));
    this.artifacts = new LinkedHashSet<Artifact>(Arrays.asList(artifact1, artifact2));
    this.libs = new ArtifactsLibraries(this.artifacts, null, mock(Log.class));
    this.libs.doWithLibraries(this.callback);
    verify(this.callback, times(2)).library(this.libraryCaptor.capture());
    assertThat(this.libraryCaptor.getAllValues().get(0).getName()).isEqualTo("g1-a");
    assertThat(this.libraryCaptor.getAllValues().get(1).getName()).isEqualTo("g2-a");
}
项目:cloudera-parcel    文件:Parcel.java   
private boolean downloadHttpResource(Log log, String remote, File local) throws MojoExecutionException {
  local.getParentFile().mkdirs();
  InputStream stream = null;
  CloseableHttpClient httpclient = HttpClients.custom().disableContentCompression().build();
  try {
    HttpEntity entity = httpclient.execute(new HttpGet(remote)).getEntity();
    if (entity != null) {
      stream = entity.getContent();
      Files.copy(stream, local.toPath());
      return true;
    }
  } catch (Exception exception) {
    if (log.isDebugEnabled()) {
      log.debug("Error downloading resource [" + remote + "]", exception);
    }
  } finally {
    IOUtils.closeQuietly(stream);
    IOUtils.closeQuietly(httpclient);
  }
  return false;
}
项目:Camel    文件:PackageHelper.java   
public static boolean haveResourcesChanged(Log log, MavenProject project, BuildContext buildContext, String suffix) {
    String baseDir = project.getBasedir().getAbsolutePath();
    for (Resource r : project.getBuild().getResources()) {
        File file = new File(r.getDirectory());
        if (file.isAbsolute()) {
            file = new File(r.getDirectory().substring(baseDir.length() + 1));
        }
        String path = file.getPath() + "/" + suffix;
        log.debug("checking  if " + path + " (" + r.getDirectory() + "/" + suffix + ") has changed.");
        if (buildContext.hasDelta(path)) {
            log.debug("Indeed " + suffix + " has changed.");
            return true;
        }
    }
    return false;
}
项目:closure-maven-plugin    文件:DefaultProcessRunner.java   
private static void attachProcessOutputSink(
    final Log log, final String prefix, final InputStream processOutput,
    final OutputReceiver receiver, final AtomicInteger watcherCounter) {
  watcherCounter.incrementAndGet();
  executor.execute(new Runnable() {

    @Override
    public void run() {
      try (InputStream in = processOutput) {
        try (BufferedReader reader = new BufferedReader(
               new InputStreamReader(in, Charsets.UTF_8))) {
          for (String line; (line = reader.readLine()) != null;) {
            receiver.processLine(line);
          }
        }
      } catch (IOException ex) {
        log.error("Failed to read process output for " + prefix, ex);
      } finally {
        if (watcherCounter.decrementAndGet() == 0) {
          receiver.allProcessed();
        }
      }
    }

  });
}
项目:GitHub    文件:ProjectClasspath.java   
/**
 * Provides a class loader that can be used to load classes from this
 * project classpath.
 * 
 * @param project
 *            the maven project currently being built
 * @param parent
 *            a classloader which should be used as the parent of the newly
 *            created classloader.
 * @param log
 *            object to which details of the found/loaded classpath elements
 *            can be logged.
 * 
 * @return a classloader that can be used to load any class that is
 *         contained in the set of artifacts that this project classpath is
 *         based on.
 * @throws DependencyResolutionRequiredException
 *             if maven encounters a problem resolving project dependencies
 */
public ClassLoader getClassLoader(MavenProject project, final ClassLoader parent, Log log) throws DependencyResolutionRequiredException {

    @SuppressWarnings("unchecked")
    List<String> classpathElements = project.getCompileClasspathElements();

    final List<URL> classpathUrls = new ArrayList<URL>(classpathElements.size());

    for (String classpathElement : classpathElements) {

        try {
            log.debug("Adding project artifact to classpath: " + classpathElement);
            classpathUrls.add(new File(classpathElement).toURI().toURL());
        } catch (MalformedURLException e) {
            log.debug("Unable to use classpath entry as it could not be understood as a valid URL: " + classpathElement, e);
        }

    }

    return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
        @Override
        public ClassLoader run() {
            return new URLClassLoader(classpathUrls.toArray(new URL[classpathUrls.size()]), parent);
        }
    });

}
项目:Pogamut3    文件:AbstractDependencyMojo.java   
/**
 * @return Returns the log.
 */
public Log getLog ()
{
    if ( silent )
    {
        log = new DependencySilentLog();
    }
    else
    {
        log = super.getLog();
    }

    return this.log;
}
项目:devops-cstack    文件:RestUtils.java   
/**
 * @param url
 * @param parameters
 * @param log
 * @return
 * @throws MojoExecutionException
 */
public Map<String, String> connect( String url, Map<String, Object> parameters, Log log )
    throws MojoExecutionException
{

    Map<String, String> response = new HashMap<String, String>();
    CloseableHttpClient httpclient = HttpClients.createDefault();
    List<NameValuePair> nvps = new ArrayList<>();
    nvps.add( new BasicNameValuePair( "j_username", (String) parameters.get( "login" ) ) );
    nvps.add( new BasicNameValuePair( "j_password", (String) parameters.get( "password" ) ) );
    localContext = HttpClientContext.create();
    localContext.setCookieStore( new BasicCookieStore() );
    HttpPost httpPost = new HttpPost( url );

    try
    {
        httpPost.setEntity( new UrlEncodedFormEntity( nvps ) );
        CloseableHttpResponse httpResponse = httpclient.execute( httpPost, localContext );
        ResponseHandler<String> handler = new ResponseErrorHandler();
        String body = handler.handleResponse( httpResponse );
        response.put( "body", body );
        httpResponse.close();
        isConnected = true;
        log.info( "Connection successful" );
    }
    catch ( Exception e )
    {
        log.error( "Connection failed!  : " + e.getMessage() );
        isConnected = false;
        throw new MojoExecutionException(
                                          "Connection failed, please check your manager location or your credentials" );
    }

    return response;
}
项目:devops-cstack    文件:RestUtils.java   
/**
 * @param url
 * @param parameters
 * @return
 * @throws MojoExecutionException
 * @throws CheckException
 */
public Map<String, Object> sendPostCommand( String url, Map<String, String> parameters, Log log )
    throws CheckException
{
    Map<String, Object> response = new HashMap<String, Object>();
    CloseableHttpClient httpclient = HttpClients.createDefault();

    HttpPost httpPost = new HttpPost( url );
    httpPost.setHeader( "Accept", "application/json" );
    httpPost.setHeader( "Content-type", "application/json" );

    try
    {
        ObjectMapper mapper = new ObjectMapper();
        StringEntity entity = new StringEntity( mapper.writeValueAsString( parameters ) );
        httpPost.setEntity( entity );
        CloseableHttpResponse httpResponse = httpclient.execute( httpPost, localContext );
        ResponseHandler<String> handler = new ResponseErrorHandler();
        String body = handler.handleResponse( httpResponse );
        response.put( "body", body );
        httpResponse.close();
    }
    catch ( Exception e )
    {
        log.warn( "POST request failed!" );

        throw new CheckException( "Send POST to server failed!", e );
    }

    return response;
}
项目:devops-cstack    文件:RestUtils.java   
public Map<String, Object> sendPostForUpload( String url, String path, Log log )
    throws IOException
{
    File file = new File( path );
    FileInputStream fileInputStream = new FileInputStream( file );
    fileInputStream.available();
    fileInputStream.close();
    FileSystemResource resource = new FileSystemResource( file );
    Map<String, Object> params = new HashMap<>();
    params.put( "file", resource );
    RestTemplate restTemplate = new RestTemplate();
    MultiValueMap<String, Object> postParams = new LinkedMultiValueMap<String, Object>();
    postParams.setAll( params );
    Map<String, Object> response = new HashMap<String, Object>();
    HttpHeaders headers = new HttpHeaders();
    headers.set( "Content-Type", "multipart/form-data" );
    headers.set( "Accept", "application/json" );
    headers.add( "Cookie", "JSESSIONID=" + localContext.getCookieStore().getCookies().get( 0 ).getValue() );
    org.springframework.http.HttpEntity<Object> request =
        new org.springframework.http.HttpEntity<Object>( postParams, headers );
    ResponseEntity<?> result = restTemplate.exchange( url, HttpMethod.POST, request, String.class );
    String body = result.getBody().toString();
    MediaType contentType = result.getHeaders().getContentType();
    HttpStatus statusCode = result.getStatusCode();
    response.put( "content-type", contentType );
    response.put( "statusCode", statusCode );
    response.put( "body", body );

    return response;
}
项目:web3j-maven-plugin    文件:SolidityCompiler.java   
private SolidityCompiler(Log log) {
    this.LOG = log;
    if (!solidityCompilerExists()) {
        LOG.info("Solidity Compiler from library is used");
        solc = new SolC();
    }
}
项目:magic-beanstalk    文件:CustomDockerrunMojo.java   
@Override
public void execute() throws MojoExecutionException {
  final Log log = getLog();

  if (skipGenTemplate) {
    log.info("skipGenTemplate is true. Skipping generate template step.");
    return;
  }

  try {
    for (DockerrunTemplate customDockerrunConfig : customDockerrunConfigs) {

      if (customDockerrunConfig.getMappingArgs() == null) {
        customDockerrunConfig.initializeMap();
      }
      Map<String, Object> mappingArgs = customDockerrunConfig.getMappingArgs();

      addImageName(mappingArgs);
      FileGenerator.generateUserDockerrunFile(
          customDockerrunConfig.getDockerrunFilePath(),
          customDockerrunConfig.getDockerrunDest(),
          mappingArgs
      );
      log.info("Created custom Dockerrun file: " + customDockerrunConfig.getDockerrunDest());

    }
  } catch (Exception e) {
    throw new MojoExecutionException("Failed to generate file", e);
  }
}
项目:magic-beanstalk    文件:PushMojo.java   
@Override
public void execute() throws MojoExecutionException {
  final Log log = getLog();

  if (skipPush) {
    log.info("skipPush is true. Skipping image push step.");
    return;
  }

  if (imageName == null || imageName.isEmpty()) {
    imageName = DockerImageUtil.getImageName(
        imageRepository,
        tagName
    );
  }
  try {
    DockerClientManagerWithAuth dockerClientManager =
        new DockerClientManagerWithAuth(region, customRegistry, authPush);

    if (authPush) {
      dockerClientManager.pushImage(imageName);
    } else {
      dockerClientManager.pushImageNoAuth(imageName);
    }
  } catch (InvalidCredentialsException | SdkClientException e) {
    throw new MojoExecutionException(
        "Could not create docker client. Invalid credentials.",
        e
    );
  }
}
项目:magic-beanstalk    文件:AllGoalsMojo.java   
private void setupInvokerLogger(Invoker invoker) {
  final Log log = getLog();
  invoker.setOutputHandler(new InvocationOutputHandler() {
    @Override
    public void consumeLine(String myString) {
      log.info(myString);
    }
  });
}
项目:neoscada    文件:DefaultPomHelper.java   
@Override
public Set<MavenProject> expandProjects ( final Collection<MavenProject> projects, final Log log, final MavenSession session )
{
    try
    {
        final Set<MavenProject> result = new HashSet<MavenProject> ();

        final Queue<MavenProject> queue = new LinkedList<MavenProject> ( projects );
        while ( !queue.isEmpty () )
        {
            final MavenProject project = queue.poll ();
            log.debug ( "Checking project: " + project );
            if ( project.getFile () == null )
            {
                log.info ( "Skipping non-local project: " + project );
                continue;
            }
            if ( !result.add ( project ) )
            {
                // if the project was already in our result, there is no need to process twice
                continue;
            }
            // add all children to the queue
            queue.addAll ( loadChildren ( project, log, session ) );
            if ( hasLocalParent ( project ) )
            {
                // if we have a parent, add the parent as well
                queue.add ( project.getParent () );
            }
        }
        return result;
    }
    catch ( final Exception e )
    {
        throw new RuntimeException ( e );
    }
}
项目:hippo-groovy-updater    文件:GroovyToUpdaterBootstrap.java   
protected void logPluginConfigurationItems(){
    final Log log = getLog();
    log.info("sourceDir: " + sourceDir.getAbsolutePath());
    log.info("targetDir: " + targetDir.getAbsolutePath());
    log.info("initializeNamePrefix: " + initializeNamePrefix);

}
项目:carnotzet    文件:Shell.java   
public static void execute(ContainerOrchestrationRuntime runtime, Prompter prompter, Log log, String service)
        throws MojoExecutionException, MojoFailureException {
    List<Container> containers = runtime.getContainers();
    if (containers.isEmpty()) {
        log.info("There doesn't seem to be any containers created yet for this carnotzet, please make sure the carnotzet is started");
        return;
    }
    Container container = containers.stream().filter(c -> c.getServiceName().equals(service)).findFirst().orElse(null);
    if (container == null) {
        container = promptForContainer(containers, prompter, log);
    }

    runtime.shell(container);
}
项目:maven-git-code-format    文件:DefaulExecutable.java   
DefaulExecutable(Supplier<Log> log, Path file) throws IOException {
  requireNonNull(log);
  requireNonNull(file);
  this.log = log;

  this.file = file;

  if (!Files.exists(file)) {
    this.log.get().debug("Creating " + file);
    Files.createFile(file);
    truncate();
  } else {
    this.log.get().debug(file + " already exists");
  }

  this.log.get().debug("Marking '" + file + "' as executable");
  Set<PosixFilePermission> permissions;
  try {
    permissions = Files.getPosixFilePermissions(file);
  } catch (UnsupportedOperationException ignored) {
    return;
  }

  permissions.add(PosixFilePermission.OWNER_EXECUTE);
  permissions.add(PosixFilePermission.GROUP_EXECUTE);
  permissions.add(PosixFilePermission.OTHERS_EXECUTE);

  Files.setPosixFilePermissions(file, permissions);
}
项目:dcos-maven-plugin    文件:AbstractDcosMojo.java   
void logConfiguration() {
  Log log = getLog();
  log.info("app definition: " + appDefinitionFile);
  log.info("legacy default app definition: " + legacyAppDefinitionFile);
  log.info("dcos token: " + dcosTokenFile);
  log.info("dcos url: " + dcosUrl);
  log.info("ignore ssl certificate: " + ignoreSslCertificate);
  log.info("deployable: " + deployable);
}
项目:Maven-IIB9-Plug-In    文件:MqsiCommandLauncher.java   
public void logReplacementCommands(Log log, List<String> osCommands)
{
    String launchMessage = "\n\n"
            + "replacement mqsiCommand follows...\n"
            + "--------------------------------\n\n";
    launchMessage += new CommandParser().toSingleLineCommand(osCommands);
    launchMessage += "\n\n";
    launchMessage += "--------------------------------\n";
    log.info(launchMessage);
}
项目:release-maven-plugin-parent    文件:UpdateProcessor.java   
@Inject
UpdateProcessor(final Log pLog, final ContextFactory pContextFactory,
        final DefaultChangeSetFactory pChangeSetFactory, final List<Command> pCommands) {
    log = pLog;
    contextFactory = pContextFactory;
    changeSetFactory = pChangeSetFactory;
    final List<Command> sortedCmds = new ArrayList<>(pCommands);
    sort(sortedCmds);
    commands = unmodifiableList(sortedCmds);
}