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

下面列出了怎么用org.apache.maven.plugin.logging.Log的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: jax-maven-plugin   文件: Util.java
static File createOutputDirectoryIfSpecifiedOrDefault(Log log, String param, List<String> arguments) {
    for (int i = 0; i < arguments.size(); i++) {
        if (isOptionParamSpecifiedAndNotEmpty(arguments, i, param)) {
            String path = arguments.get(i + 1);
            Preconditions.checkNotNull(path, "path for output directory not found, option="+ param);
            File outputDir = new File(path);
            if (!outputDir.exists()) {
                log.info("destination directory (" + param + " option) specified and does not exist, creating: "
                        + outputDir);
                outputDir.mkdirs();
            }
            return outputDir;
        }
    }
    log.warn("destination directory (" + param
            + " option) NOT specified. Generated source will be placed in project root if -keep argument is present.");
    return new File(".");
}
 
源代码2 项目: jax-maven-plugin   文件: Util.java
static Stream<String> getPluginRuntimeDependencyEntries(AbstractMojo mojo, MavenProject project, Log log,
        RepositorySystem repositorySystem, ArtifactRepository localRepository,
        List<ArtifactRepository> remoteRepositories) {
    PluginDescriptor pluginDescriptor = (PluginDescriptor) mojo.getPluginContext().get(PLUGIN_DESCRIPTOR);
    Plugin plugin = project.getBuild().getPluginsAsMap().get(pluginDescriptor.getPluginLookupKey());

    List<ArtifactResolutionResult> artifactResolutionResults = plugin //
            .getDependencies() //
            .stream() //
            .map(repositorySystem::createDependencyArtifact) //
            .map(a -> Util.resolve(log, a, repositorySystem, localRepository, remoteRepositories)) //
            .collect(Collectors.toList());

    Stream<Artifact> originalArtifacts = artifactResolutionResults.stream()
            .map(ArtifactResolutionResult::getOriginatingArtifact);

    Stream<Artifact> childArtifacts = artifactResolutionResults.stream()
            .flatMap(resolutionResult -> resolutionResult.getArtifactResolutionNodes().stream())
            .map(ResolutionNode::getArtifact);

    return Stream.concat(originalArtifacts, childArtifacts).map(Artifact::getFile).map(File::getAbsolutePath);
}
 
源代码3 项目: swagger-maven-plugin   文件: JaxrsReaderTest.java
@Test
public void createCommonParameters() throws Exception {
    reader = new JaxrsReader(new Swagger(), Mockito.mock(Log.class));
    Swagger result = reader.read(CommonParametersApi.class);
    Parameter headerParam = result.getParameter("headerParam");
    assertTrue(headerParam instanceof HeaderParameter);
    Parameter queryParam = result.getParameter("queryParam");
    assertTrue(queryParam instanceof QueryParameter);

    result = reader.read(ReferenceCommonParametersApi.class);
    Operation get = result.getPath("/apath").getGet();
    List<Parameter> parameters = get.getParameters();
    for (Parameter parameter : parameters) {
        assertTrue(parameter instanceof RefParameter);
    }

    ObjectMapper mapper = Json.mapper();
    ObjectWriter jsonWriter = mapper.writer(new DefaultPrettyPrinter());
    String json = jsonWriter.writeValueAsString(result);
    JsonNode expectJson = mapper.readTree(this.getClass().getResourceAsStream("/expectedOutput/swagger-common-parameters.json"));
    JsonAssert.assertJsonEquals(expectJson, json);
}
 
源代码4 项目: 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("resolved");
		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);
	}
}
 
源代码5 项目: mvn-golang   文件: CvsBZR.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;
}
 
源代码6 项目: maven-process-plugin   文件: ExecProcess.java
public void execute(File workingDirectory, Log log, String... args) {
    final ProcessBuilder pb = new ProcessBuilder();

    if(redirectErrorStream) {
        pb.redirectErrorStream(true);
        pb.redirectOutput(ProcessBuilder.Redirect.INHERIT);
    }

    log.info("Using working directory for this process: " + workingDirectory);
    pb.directory(workingDirectory);
    pb.command(args);
    try {
        process = pb.start();
        pumpOutputToLog(process, log);
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
}
 
源代码7 项目: siddhi   文件: DocumentationUtils.java
/**
 * Build the mkdocs site using the mkdocs config file
 *
 * @param mkdocsConfigFile The mkdocs configuration file
 * @param logger           The maven logger
 * @return true if the documentation generation is successful
 */
public static boolean generateMkdocsSite(File mkdocsConfigFile, Log logger) {
    boolean isDocumentationGenerationSuccessful = false;
    try {
        // Building the mkdocs site
        executeCommand(new String[]{Constants.MKDOCS_COMMAND,
                Constants.MKDOCS_BUILD_COMMAND,
                Constants.MKDOCS_BUILD_COMMAND_CLEAN_ARGUEMENT,
                Constants.MKDOCS_BUILD_COMMAND_CONFIG_FILE_ARGUMENT,
                mkdocsConfigFile.getAbsolutePath(),
                Constants.MKDOCS_BUILD_COMMAND_SITE_DIRECTORY_ARGUMENT,
                Constants.MKDOCS_SITE_DIRECTORY}, logger);
        isDocumentationGenerationSuccessful = true;
    } catch (Throwable t) {
        logger.warn("Failed to generate the mkdocs site.", t);
    }
    return isDocumentationGenerationSuccessful;
}
 
源代码8 项目: jaxb2-maven-plugin   文件: LocaleFacet.java
/**
 * Helper method used to parse a locale configuration string into a Locale instance.
 *
 * @param localeString A configuration string parameter on the form
 *                     {@code &lt;language&gt;[,&lt;country&gt;[,&lt;variant&gt;]]}
 * @param log          The active Maven Log. Cannot be null.
 * @return A fully constructed Locale.
 * @throws MojoExecutionException if the localeString was not supplied on the required form.
 */
public static LocaleFacet createFor(final String localeString, final Log log) throws MojoExecutionException {

    // Check sanity
    Validate.notNull(log, "log");
    Validate.notEmpty(localeString, "localeString");

    final StringTokenizer tok = new StringTokenizer(localeString, ",", false);
    final int numTokens = tok.countTokens();
    if (numTokens > 3 || numTokens == 0) {
        throw new MojoExecutionException("A localeString must consist of up to 3 comma-separated parts on the "
                + "form <language>[,<country>[,<variant>]]. Received incorrect value '" + localeString + "'");
    }

    // Extract the locale configuration data.
    final String language = tok.nextToken().trim();
    final String country = numTokens > 1 ? tok.nextToken().trim() : null;
    final String variant = numTokens > 2 ? tok.nextToken().trim() : null;

    // All done.
    return new LocaleFacet(log, findOptimumLocale(language, country, variant));
}
 
protected void parseJson(ElasticsearchClient client, Log log, Path path)
{
    try
    {
        String json = new String(Files.readAllBytes(path));

        List<Map<String, Object>> commands = new ObjectMapper().readValue(
                json,
                new TypeReference<List<Map<String, Object>>>(){});
        commands.forEach(command ->
        {
            log.debug(String.format("Parsing command: %s", command));
            
            ElasticsearchCommand esCommand = parseMapCommand(command);
            executeInitCommand(client, log, esCommand);
        });
    }
    catch (IOException e)
    {
        throw new ElasticsearchSetupException("Cannot read the init json file", e);
    }
}
 
public void execute() throws MojoExecutionException {
  if (!isExecutionRoot()) {
    getLog().debug("Not in execution root. Do not execute.");
    return;
  }
  if (skip) {
    Log log = getLog();
    if (log.isInfoEnabled()) {
      log.info("skipped");
    }
    return;
  }

  try {
    getLog().info("Installing git hooks");
    doExecute();
    getLog().info("Installed git hooks");
  } catch (Exception e) {
    throw new MojoExecutionException(e.getMessage(), e);
  }
}
 
源代码11 项目: siddhi   文件: DocumentationUtils.java
/**
 * Remove the snapshot version documentation files from docs/api directory
 *
 * @param mkdocsConfigFile           The mkdocs configuration file
 * @param documentationBaseDirectory The path of the base directory in which the documentation will be generated
 * @param logger                     The maven plugin logger
 */
public static void removeSnapshotAPIDocs(File mkdocsConfigFile, String documentationBaseDirectory, Log logger) {
    // Retrieving the documentation file names
    File apiDocsDirectory = new File(documentationBaseDirectory
            + File.separator + Constants.API_SUB_DIRECTORY);
    String[] documentationFileNames = apiDocsDirectory.list(
            (directory, fileName) -> fileName.endsWith(Constants.MARKDOWN_FILE_EXTENSION)
    );

    if (documentationFileNames != null) {
        // Removing snapshot files and creating a list of the files that are left out
        for (String documentationFileName : documentationFileNames) {
            if (documentationFileName.endsWith(Constants.SNAPSHOT_VERSION_POSTFIX
                    + Constants.MARKDOWN_FILE_EXTENSION)) {
                // Removing the snapshot documentation file
                File documentationFile = new File(apiDocsDirectory.getAbsolutePath()
                        + File.separator + documentationFileName);
                if (!documentationFile.delete()) {
                    logger.warn("Failed to delete SNAPSHOT documentation file "
                            + documentationFile.getAbsolutePath());
                }
            }
        }

    }
}
 
源代码12 项目: coroutines   文件: TestInstrumentMojo.java
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
    Log log = getLog();

    File testOutputFolder = new File(getProject().getBuild().getTestOutputDirectory());
    if (!testOutputFolder.isDirectory()) {
        log.warn("Test folder doesn't exist -- nothing to instrument");
        return;
    }
    
    List<String> classpath;
    try {
        classpath = getProject().getTestClasspathElements();
    } catch (DependencyResolutionRequiredException ex) {
        throw new MojoExecutionException("Dependency resolution problem", ex);
    }
    
    log.debug("Processing test output folder ... ");
    instrumentPath(log, classpath, testOutputFolder);
}
 
MavenContractsDownloader(MavenProject project, Dependency contractDependency,
		String contractsPath, String contractsRepositoryUrl,
		StubRunnerProperties.StubsMode stubsMode, Log log, String repositoryUsername,
		String repositoryPassword, String repositoryProxyHost,
		Integer repositoryProxyPort, boolean deleteStubsAfterTest,
		Map<String, String> contractsProperties, boolean failOnNoContracts) {
	this.project = project;
	this.contractDependency = contractDependency;
	this.contractsPath = contractsPath;
	this.contractsRepositoryUrl = contractsRepositoryUrl;
	this.stubsMode = stubsMode;
	this.log = log;
	this.repositoryUsername = repositoryUsername;
	this.repositoryPassword = repositoryPassword;
	this.repositoryProxyHost = repositoryProxyHost;
	this.repositoryProxyPort = repositoryProxyPort;
	this.stubDownloaderBuilderProvider = new StubDownloaderBuilderProvider();
	this.deleteStubsAfterTest = deleteStubsAfterTest;
	this.contractsProperties = contractsProperties;
	this.failOnNoStubs = failOnNoContracts;
}
 
源代码14 项目: wisdom   文件: NPM.java
/**
 * Utility method to extract the version from a NPM by reading its 'package.json' file.
 *
 * @param npmDirectory the directory in which the NPM is installed
 * @param log          the logger object
 * @return the read version, "0.0.0" if there are not 'package.json' file, {@code null} if this file cannot be
 * read or does not contain the "version" metadata
 */
public static String getVersionFromNPM(File npmDirectory, Log log) {
    File packageFile = new File(npmDirectory, PACKAGE_JSON);
    if (!packageFile.isFile()) {
        return "0.0.0";
    }

    FileReader reader = null;
    try {
        reader = new FileReader(packageFile);  //NOSONAR
        JSONObject json = (JSONObject) JSONValue.parseWithException(reader);
        return (String) json.get("version");
    } catch (IOException | ParseException e) {
        log.error("Cannot extract version from " + packageFile.getAbsolutePath(), e);
    } finally {
        IOUtils.closeQuietly(reader);
    }

    return null;
}
 
源代码15 项目: siddhi   文件: DocumentationUtils.java
/**
 * Commit the documentation directory and the mkdocs config file
 *
 * @param docsDirectory    The docs drectory
 * @param mkdocsConfigFile The mkdocs configuration file
 * @param readmeFile       The read me file
 * @param version          The version of the documentation
 * @param logger           The maven logger
 */
public static void updateDocumentationOnGitHub(String docsDirectory, File mkdocsConfigFile, File readmeFile,
                                               String version, Log logger) {
    try {
        executeCommand(new String[]{Constants.GIT_COMMAND,
                Constants.GIT_ADD_COMMAND,
                docsDirectory, mkdocsConfigFile.getAbsolutePath(), readmeFile.getAbsolutePath()}, logger);
        executeCommand(new String[]{Constants.GIT_COMMAND,
                Constants.GIT_COMMIT_COMMAND,
                Constants.GIT_COMMIT_COMMAND_MESSAGE_ARGUMENT,
                String.format(Constants.GIT_COMMIT_COMMAND_MESSAGE_FORMAT, version, version),
                Constants.GIT_COMMIT_COMMAND_FILES_ARGUMENT,
                docsDirectory, mkdocsConfigFile.getAbsolutePath(), readmeFile.getAbsolutePath()}, logger);
    } catch (Throwable t) {
        logger.warn("Failed to update the documentation on GitHub repository", t);
    }
}
 
源代码16 项目: emodb   文件: EmoExec.java
public void execute(File workingDirectory, Log log, String... args) {
    final ProcessBuilder pb = new ProcessBuilder();
    log.info("Using working directory for emo: " + workingDirectory);
    pb.directory(workingDirectory);
    pb.command(buildCommandLineArguments(args));
    try {
        process = pb.start();
        pumpOutputToLog(process, log);
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
}
 
源代码17 项目: xtext-xtend   文件: MavenLog4JConfigurator.java
protected void configureLog4j(Log log, String name) {
	Logger logger = Logger.getLogger(name);
	logger.setAdditivity(false);
	try {
		logger.setLevel(LOG4J_DEFAULT_LOG_LEVEL);
	} catch (NoSuchMethodError e) {
		// see http://bugzilla.slf4j.org/show_bug.cgi?id=279
	}
	logger.removeAllAppenders();
	logger.addAppender(createMojoLogAppender(log));
}
 
public PersistenceXmlHandler(
    final StandardServiceRegistryBuilder registryBuilder,
    final Log log,
    final Set<String> propertiesToUse) {

    this.registryBuilder = registryBuilder;
    this.log = log;
    this.propertiesToUse = propertiesToUse;
}
 
/**
 * Creates a SystemPropertySave which will remember the original value of the
 * supplied system property for the duration of this SystemPropertySave.
 *
 * @param key A non-null key.
 * @param log The active Maven Log.
 */
public SystemPropertySaveEnvironmentFacet(final String key, final Log log) {
    // Delegate
    super(log);

    // Assign internal state
    this.key = key;
    this.originalValue = System.getProperty(key);
}
 
public List<Ec2Instance> getInstancesForAutoScalingGroup(Log log, AutoScalingGroup autoScalingGroup) throws MojoFailureException {
    log.info("retrieving list of instanceId's for auto scaling group with id : " + activeConfiguration.getAutoScalingGroupId());

    activeConfiguration.getHosts().clear();

    log.debug("describing instances in auto scaling group");

    if (autoScalingGroup.getInstances().isEmpty()) {
        return new ArrayList<>();
    }

    Map<String, Instance> instanceMap = autoScalingGroup.getInstances().stream().collect(Collectors.toMap(Instance::getInstanceId, Function.identity()));

    try {
        DescribeInstancesResult instancesResult = awsEc2Client.describeInstances(new DescribeInstancesRequest().withInstanceIds(autoScalingGroup.getInstances().stream().map(Instance::getInstanceId).collect(Collectors.toList())));
        List<Ec2Instance> ec2Instances = instancesResult.getReservations().stream().flatMap(r -> r.getInstances().stream()).map(this::toEc2Instance).collect(Collectors.toList());
        log.debug("describing elb status");
        autoScalingGroup.getLoadBalancerNames().forEach(elb -> this.updateInstancesStateOnLoadBalancer(elb, ec2Instances));
        ec2Instances.forEach(i -> i.updateAsState(AwsState.map(instanceMap.get(i.getInstanceId()).getLifecycleState())));
        ec2Instances.sort((o1, o2) -> {

            int sComp = o1.getAsState().compareTo(o2.getAsState());

            if (sComp != 0) {
                return sComp;
            } else {
                return o1.getElbState().compareTo(o2.getElbState());
            }
        });
        if (activeConfiguration.isIgnoreInStandby()) {
            return ec2Instances.stream().filter(i -> i.getAsState() != AwsState.STANDBY).collect(Collectors.toList());
        }
        return ec2Instances;
    } catch (AmazonClientException e) {
        log.error(e.getMessage(), e);
        throw new MojoFailureException(e.getMessage());
    }

}
 
源代码21 项目: vertx-maven-plugin   文件: WebJars.java
private static File getOutput(Log log, File out, boolean stripVersion, String path) {
    if (stripVersion) {
        Matcher matcher = WEBJAR_INTERNAL_PATH_REGEX.matcher(path);
        if (matcher.matches()) {
            return new File(out, matcher.group(1) + "/" + matcher.group(3));
        } else {
            log.warn(path + " does not match the regex - did not strip the version for this file");
        }
    }
    return new File(out, path);
}
 
@Override
public void execute(InstanceConfiguration config)
{
    if (config.getClusterConfiguration().getPlugins().size() > 0)
    {
        if (VersionUtil.isEqualOrGreater_6_4_0(config.getClusterConfiguration().getVersion()))
        {
            FilesystemUtil.setScriptPermission(config, "elasticsearch-cli");
        }
        FilesystemUtil.setScriptPermission(config, "elasticsearch-plugin");
    }

    Log log = config.getClusterConfiguration().getLog();
    
    for (PluginConfiguration plugin : config.getClusterConfiguration().getPlugins())
    {
        log.info(String.format(
                "Installing plugin '%s' with options '%s'",
                plugin.getUri(), plugin.getEsJavaOpts()));
        
        Map<String, String> environment = new HashMap<>(config.getEnvironmentVariables());
        
        if (StringUtils.isNotBlank(plugin.getEsJavaOpts()))
        {
            environment.put("ES_JAVA_OPTS", plugin.getEsJavaOpts());
        }

        CommandLine cmd = ProcessUtil.buildCommandLine("bin/elasticsearch-plugin")
                .addArgument("install")
                .addArgument("--batch")
                .addArgument(plugin.getUri());
        
        ProcessUtil.executeScript(config, cmd, environment, null);
    }
}
 
/**
 * The method to perform the service provider combining
 *
 * @param project      the Maven project
 * @param patterns     the set of patterns
 * @param logger       the logger
 * @param dependencies the dependencies
 */
private void combine(MavenProject project, List<String> patterns, Log logger, List<File> dependencies) {
    Map<String, List<String>> locals = findLocalDescriptors(project, patterns);
    Map<String, List<List<String>>> deps = findDescriptorsFromDependencies(dependencies, patterns);

    // Keys are path relative to the archive root.
    logger.debug("Descriptors declared in the project: " + locals.keySet());
    logger.debug("Descriptors declared in dependencies: " + deps.keySet());

    Set<String> descriptorsToMerge = new LinkedHashSet<>(locals.keySet());
    descriptorsToMerge.addAll(deps.keySet());

    Map<String, List<String>> descriptors = new HashMap<>();
    for (String spi : descriptorsToMerge) {
        descriptors.put(spi, merge(project, spi, locals.get(spi), deps.get(spi)));
    }

    // Write the new files in target/classes
    File out = new File(project.getBuild().getOutputDirectory());

    descriptors.forEach((name, content) -> {
        File merged = new File(out, name);
        try {
            org.apache.commons.io.FileUtils.writeLines(merged, content);
            logger.debug("Descriptor combined into " + merged.getAbsolutePath());
        } catch (IOException e) {
            throw new RuntimeException("Cannot write combined Descriptor files", e);
        }
    });
}
 
public AwsAutoScalingDeployUtils(String region, DeployConfiguration activeConfiguration, Log log) {
    this.activeConfiguration = activeConfiguration;
    this.log = log;

    awsAsClient = AmazonAutoScalingClientBuilder.standard().withRegion(region).build();
    awsElbClient = AmazonElasticLoadBalancingClientBuilder.standard().withRegion(region).build();
    awsEc2Client = AmazonEC2ClientBuilder.standard().withRegion(region).build();

    activeConfiguration.withAutoScalingGroup(matchAutoScalingGroupName(activeConfiguration.getAutoScalingGroupId()));

}
 
源代码25 项目: herd   文件: DefinitionGenerator.java
/**
 * Instantiates a Swagger definition generator which generates the definitions based on the specified parameters.
 *
 * @param log the log.
 * @param swagger the Swagger metadata.
 * @param exampleClassNames the example class names.
 * @param modelClasses the model classes.
 * @param xsdParser the XSD parser
 *
 * @throws MojoExecutionException if any problems were encountered.
 */
public DefinitionGenerator(Log log, Swagger swagger, Set<String> exampleClassNames, Set<Class<?>> modelClasses, XsdParser xsdParser)
    throws MojoExecutionException
{
    this.log = log;
    this.swagger = swagger;
    this.exampleClassNames = exampleClassNames;
    this.modelClasses = modelClasses;
    this.xsdParser = xsdParser;

    generateDefinitions();
}
 
源代码26 项目: ph-schematron   文件: Slf4jAdapter.java
/**
 * Get Maven Log.
 * 
 * @return The log from Maven plugin
 */
private Log _log ()
{
  if (m_aMavenLog == null)
    throw new IllegalStateException ("initialize StaticLoggerBinder with #setMavenLog() first");
  return m_aMavenLog;
}
 
源代码27 项目: vertx-maven-plugin   文件: ServiceUtils.java
public static Set<Artifact> filterArtifacts(Set<Artifact> artifacts, List<String> includes,
                                            List<String> excludes,
                                            boolean actTransitively, Log logger,
                                            ArtifactFilter... additionalFilters) {

    final AndArtifactFilter filter = new AndArtifactFilter();

    if (additionalFilters != null && additionalFilters.length > 0) {
        for (final ArtifactFilter additionalFilter : additionalFilters) {
            if (additionalFilter != null) {
                filter.add(additionalFilter);
            }
        }
    }

    if (!includes.isEmpty()) {
        final ArtifactFilter includeFilter = new PatternIncludesArtifactFilter(includes, actTransitively);
        filter.add(includeFilter);
    }

    if (!excludes.isEmpty()) {
        final ArtifactFilter excludeFilter = new PatternExcludesArtifactFilter(excludes, actTransitively);
        filter.add(excludeFilter);
    }

    Set<Artifact> copy = new LinkedHashSet<>(artifacts);
    for (final Iterator<Artifact> it = copy.iterator(); it.hasNext(); ) {

        final Artifact artifact = it.next();

        if (!filter.include(artifact)) {
            it.remove();
            if (logger.isDebugEnabled()) {
                logger.debug(artifact.getId() + " was removed by one or more filters.");
            }
        }
    }

    return copy;
}
 
源代码28 项目: vertx-deploy-tools   文件: RequestExecutor.java
RequestExecutor(Log log, Integer requestTimeout, Integer port, String authToken) {
    this.log = log;
    this.port = port;
    this.authToken = authToken != null ? authToken : "";
    this.timeout = System.currentTimeMillis() + (60000L * requestTimeout);
    log.info("Setting timeout to : " + new Date(timeout));
}
 
源代码29 项目: japicmp   文件: SkipModuleStrategyTest.java
@Test
public void testModuleIsNotIncludedAndNoIncludesDefined() {
	PluginParameters pluginParameters = createPluginParameters();
	MavenParameters mavenParameters = createMavenParameters();
	mavenParameters.getMavenProject().setArtifactId("name-to-include");
	pluginParameters.getParameterParam().setIncludeModules(Collections.singletonList(".*test.*"));
	SkipModuleStrategy skipModuleStrategy = new SkipModuleStrategy(pluginParameters, mavenParameters, mock(Log.class));
	assertThat(skipModuleStrategy.skip(), is(true));
}
 
源代码30 项目: jaxb2-maven-plugin   文件: FileSystemUtilities.java
/**
 * Retrieves a List of Files containing all the existing files within the supplied files List, including all
 * files found in directories recursive to any directories provided in the files list. Each file included in the
 * result must pass an ExclusionRegExpFileFilter synthesized from the supplied exclusions pattern(s).
 *
 * @param files            The list of files to resolve, filter and return. If the {@code files} List
 *                         contains directories, they are searched for Files recursively. Any found Files in such
 *                         a search are included in the resulting File List if they do not match any of the
 *                         exclusionFilters supplied.
 * @param exclusionFilters A List of Filters which identify files to remove from the result - implying that any
 *                         File matched by any of these exclusionFilters will not be included in the result.
 * @param log              The active Maven Log.
 * @return All files in (or files in subdirectories of directories provided in) the files List, provided that each
 * file is accepted by an ExclusionRegExpFileFilter.
 */
public static List<File> resolveRecursively(final List<File> files,
                                            final List<Filter<File>> exclusionFilters,
                                            final Log log) {

    // Check sanity
    Validate.notNull(files, "files");

    final List<Filter<File>> effectiveExclusions = exclusionFilters == null
            ? new ArrayList<Filter<File>>()
            : exclusionFilters;

    final List<File> toReturn = new ArrayList<File>();

    if (files.size() > 0) {
        for (File current : files) {

            final boolean isAcceptedFile = EXISTING_FILE.accept(current)
                    && Filters.noFilterMatches(current, effectiveExclusions);
            final boolean isAcceptedDirectory = EXISTING_DIRECTORY.accept(current)
                    && Filters.noFilterMatches(current, effectiveExclusions);

            if (isAcceptedFile) {
                toReturn.add(current);
            } else if (isAcceptedDirectory) {
                recurseAndPopulate(toReturn, effectiveExclusions, current, true, log);
            }
        }
    }

    // All done
    return toReturn;
}
 
 类所在包