Java Code Examples for org.apache.maven.plugin.logging.Log#info()

The following examples show how to use org.apache.maven.plugin.logging.Log#info() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DefaultDescriptorsExtractor.java    From james-project with Apache License 2.0 6 votes vote down vote up
public DefaultDescriptorsExtractor extract(MavenProject project, Log log) {
    final Collection<JavaClass> classes = javaClasses(project);

    final URLClassLoader classLoader = classLoader(project, log);
    logProjectDependencies(project, log);
    logDirectories(project, log);
    
    try {
        final Class<?> mailetClass = classLoader.loadClass(MAILET_CLASS_NAME);
        final Class<?> matcherClass = classLoader.loadClass(MATCHER_CLASS_NAME);

        for (JavaClass nextClass : classes) {
            addDescriptor(log, classLoader, mailetClass, matcherClass, nextClass);
        }
    } catch (ClassNotFoundException e) {
        log.debug(e);
        log.info("No mailets in " + project.getName());
    }
    return this;
}
 
Example 2
Source File: ExecProcess.java    From maven-process-plugin with Apache License 2.0 6 votes vote down vote up
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);
    }
}
 
Example 3
Source File: Utils.java    From docker-maven-plugin with Apache License 2.0 6 votes vote down vote up
public static void pushImageTag(DockerClient docker, String imageName,
                              List<String> imageTags, Log log, boolean skipPush)
    throws MojoExecutionException, DockerException, IOException, InterruptedException {

  if (skipPush) {
    log.info("Skipping docker push");
    return;
  }
  // tags should not be empty if you have specified the option to push tags
  if (imageTags.isEmpty()) {
    throw new MojoExecutionException("You have used option \"pushImageTag\" but have"
                                     + " not specified an \"imageTag\" in your"
                                     + " docker-maven-client's plugin configuration");
  }
  final CompositeImageName compositeImageName = CompositeImageName.create(imageName, imageTags);
  for (final String imageTag : compositeImageName.getImageTags()) {
    final String imageNameWithTag = compositeImageName.getName() + ":" + imageTag;
    log.info("Pushing " + imageNameWithTag);
    docker.push(imageNameWithTag, new AnsiProgressHandler());
  }
}
 
Example 4
Source File: Shell.java    From carnotzet with Apache License 2.0 6 votes vote down vote up
/**
 * 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 = i + 1;
	}
	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());
	}
}
 
Example 5
Source File: LogUtil.java    From vertx-deploy-tools with Apache License 2.0 6 votes vote down vote up
public static void logDeployResult(Log log, String result) {
    if (result == null || result.isEmpty()) {
        return;
    }
    DeployResult deployResult;
    try {
        deployResult = new ObjectMapper().readValue(result, DeployResult.class);
        log.info("List of successfully deployed applications");
        deployResult.getSuccess().forEach(log::info);
        if (!deployResult.getError().isEmpty()) {
            log.error("List of applications that failed to deploy");
            deployResult.getError().forEach((key, entry) -> log.error(key + " -> " + entry));
        }
    } catch (IOException e) {
        log.error(e.getMessage(), e);
        log.warn("Unable to parse deploy result -> " + result);
    }
}
 
Example 6
Source File: MavenMessageHandler.java    From aspectj-maven-plugin with MIT License 6 votes vote down vote up
/**
 * Constructs a MessageHandler with a Maven plugin logger.
 *
 * @param log                           The active Maven Log.
 * @param showDetailsForMessageKindList A List holding all AJC message types for which this MavenMessageHandler
 *                                      should emit details onto the Maven log (i.e. class name,
 *                                      line/row number etc.)
 */
public MavenMessageHandler(final Log log,
                           final List<IMessage.Kind> showDetailsForMessageKindList) {

    // Check sanity
    // assert log != null : "Cannot handle null log argument.";
    // assert showDetailsForMessageKindList != null : "Cannot handle null showDetailsForMessageKindList argument.";
    if (log == null) {
        throw new NullPointerException("Cannot handle null log argument.");
    }
    if (showDetailsForMessageKindList == null) {
        throw new NullPointerException("Cannot handle null showDetailsForMessageKindList argument.");
    }

    // Assign internal state
    this.log = log;
    this.showDetailsForMessageKindList = showDetailsForMessageKindList;

    if (log.isInfoEnabled()) {
        log.info("Showing AJC message detail for messages of types: " + showDetailsForMessageKindList);
    }
}
 
Example 7
Source File: Util.java    From jax-maven-plugin with Apache License 2.0 6 votes vote down vote up
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(".");
}
 
Example 8
Source File: LayzQueryCodeGenerator.java    From vaadinator with Apache License 2.0 5 votes vote down vote up
@Override
public void generateCode(VaadinatorConfig vaadinatorConfig) throws Exception {
	Log log = vaadinatorConfig.getLog();
	log.info("Generating lazy query containers");
	if (vaadinatorConfig.getGenTypeEn() == VaadinatorConfig.GenType.SOURCES
			|| vaadinatorConfig.getGenTypeEn() == VaadinatorConfig.GenType.ALL) {
		if (vaadinatorConfig.getGenTypeEn() == VaadinatorConfig.GenType.SOURCES
				|| vaadinatorConfig.getGenTypeEn() == VaadinatorConfig.GenType.ALL) {
			for (BeanDescription desc : vaadinatorConfig.getBeanDescriptions()) {
				if (desc.isDisplayed()) {
					for (DisplayProfileDescription p : desc.getDisplayProfiles()) {
						String componentPckg = desc.getViewPckg(p) + ".container";
						runVelocity(desc, vaadinatorConfig.getCommonMap(), componentPckg, desc.getPckg(),
								desc.getPresenterPckg(p), desc.getViewPckg(p), p.getProfileName(),
								"LazyQueryContainer.template",
								packageToFile(vaadinatorConfig.getTargetFolderSrcStart(), componentPckg,
										desc.getClassName(), "LazyQueryContainer.java"),
								TEMPLATE_PACKAGE, log);
						runVelocity(desc, vaadinatorConfig.getCommonMap(), componentPckg, desc.getPckg(),
								desc.getPresenterPckg(p), desc.getViewPckg(p), p.getProfileName(),
								"LazyQuery.template", packageToFile(vaadinatorConfig.getTargetFolderSrcStart(),
										componentPckg, desc.getClassName(), "LazyQuery.java"),
								TEMPLATE_PACKAGE, log);
						runVelocity(desc, vaadinatorConfig.getCommonMap(), componentPckg, desc.getPckg(),
								desc.getPresenterPckg(p), desc.getViewPckg(p), p.getProfileName(),
								"LazyQueryFactory.template",
								packageToFile(vaadinatorConfig.getTargetFolderSrcStart(), componentPckg,
										desc.getClassName(), "LazyQueryFactory.java"),
								TEMPLATE_PACKAGE, log);
					}

				}
			}
		}
	}
}
 
Example 9
Source File: ApplicationSecretGenerator.java    From wisdom with Apache License 2.0 5 votes vote down vote up
/**
 * Checks whether the application configuration file as the application secret.
 * If not generates one.
 *
 * @param project the Maven Project
 * @param log     the logger
 * @throws java.io.IOException if the application file cannot be read, or rewritten
 */
public static void ensureOrGenerateSecret(MavenProject project, Log log) throws IOException {
    File conf = new File(project.getBasedir(), "src/main/configuration/application.conf");
    if (conf.isFile()) {
        List<String> lines = FileUtils.readLines(conf);

        boolean changed = false;
        for (int i = 0; i < lines.size(); i++) {
            String line = lines.get(i);
            Matcher matcher = OLD_SECRET_LINE_PATTERN.matcher(line);
            if (matcher.matches()) {
                if (matcher.group(1).length() == 0) {
                    lines.set(i, "application.secret=\"" + generate() + "\"");
                    changed = true;
                }
            } else {
                matcher = SECRET_LINE_PATTERN.matcher(line);
                if (matcher.matches()) {
                    if (matcher.group(2).trim().length() == 0) {
                        lines.set(i, "  secret = \"" + generate() + "\"");
                        changed = true;
                    }
                }
            }

        }

        if (changed) {
            FileUtils.writeLines(conf, lines);
            log.info("Application Secret generated - the configuration file was updated.");
        }

    }
}
 
Example 10
Source File: DetectMojo.java    From os-maven-plugin with Apache License 2.0 5 votes vote down vote up
@Override
protected void logProperty(String name, String value) {
    final Log log = getLog();
    if (log.isInfoEnabled()) {
        log.info(name + ": " + value);
    }
}
 
Example 11
Source File: BaseMojo.java    From jax-maven-plugin with Apache License 2.0 5 votes vote down vote up
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
    Log log = getLog();
    log.info("Starting " + cmd + " mojo");

    List<File> outputDirectories = cmd. //
            getDirectoryParameters() //
            .stream() //
            .map(param -> Util.createOutputDirectoryIfSpecifiedOrDefault(log, param, arguments))
            .collect(Collectors.toList());
    try {
        List<String> command = createCommand();

        new ProcessExecutor() //
                .command(command) //
                .directory((project.getBasedir()))
                .exitValueNormal() //
                .redirectOutput(System.out) //
                .redirectError(System.out) //
                .execute();

        outputDirectories.forEach(buildContext::refresh);

        addSources(log);
        
        addResources(log);

    } catch (InvalidExitValueException | IOException | InterruptedException | TimeoutException
            | DependencyResolutionRequiredException e) {
        throw new MojoExecutionException(e.getMessage(), e);
    }
    log.info(cmd + " mojo finished");
}
 
Example 12
Source File: InstallPluginsStep.java    From elasticsearch-maven-plugin with Apache License 2.0 5 votes vote down vote up
@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);
    }
}
 
Example 13
Source File: AwsAutoScalingDeployUtils.java    From vertx-deploy-tools with Apache License 2.0 5 votes vote down vote up
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());
    }

}
 
Example 14
Source File: R4TargetModelGeneratorImpl.java    From FHIR with Apache License 2.0 5 votes vote down vote up
@Override
public void process(MavenProject mavenProject, Log log) {
    // Only runs for the fhir-model, short-circuits otherwise.
    String targetDir = baseDirectory + "/src/main/java";
    String baseDirectoryJson = baseDirectory;
    String definitionsDir = baseDirectory + "/definitions";
    
    if (mavenProject.getArtifactId().contains("fhir-model") || !limit ) {

        // Check the base directory
        if ((new File(definitionsDir)).exists()) {

            // injecting for the purposes of setting the header
            log.info("Setting the base dir -> " + baseDirectory);
            System.setProperty("BaseDir", baseDirectory);
            System.setProperty("JsonBaseDir", baseDirectoryJson);

            Map<String, JsonObject> structureDefinitionMap =
                    CodeGenerator.buildResourceMap(definitionsDir + "/profiles-resources.json", "StructureDefinition");
            structureDefinitionMap.putAll(CodeGenerator.buildResourceMap(definitionsDir + "/profiles-types.json", "StructureDefinition"));

            Map<String, JsonObject> codeSystemMap = CodeGenerator.buildResourceMap(definitionsDir + "/valuesets.json", "CodeSystem");
            codeSystemMap.putAll(CodeGenerator.buildResourceMap(definitionsDir + "/v3-codesystems.json", "CodeSystem"));

            Map<String, JsonObject> valueSetMap = CodeGenerator.buildResourceMap(definitionsDir + "/valuesets.json", "ValueSet");
            valueSetMap.putAll(CodeGenerator.buildResourceMap(definitionsDir + "/v3-codesystems.json", "ValueSet"));

            log.info("[Started] generating the code for fhir-model");
            CodeGenerator generator = new CodeGenerator(structureDefinitionMap, codeSystemMap, valueSetMap);
            generator.generate(targetDir);

            log.info("[Finished] generating the code for fhir-model");
        } else {
            log.info("Skipping as the Definitions don't exist in this project " + baseDirectory);
        }
    } else {
        log.info("Skipping project as the artifact is not a model project -> " + mavenProject.getArtifactId());
    }

}
 
Example 15
Source File: JavadocPublisher.java    From osstrich with Apache License 2.0 4 votes vote down vote up
public static void main(String[] args) throws IOException {
  Log log = new SystemStreamLog();

  boolean force = false;
  boolean dryRun = false;
  List<String> strippedArgs = new ArrayList<>(args.length);
  for (String arg : args) {
    if ("--dry-run".equals(arg)) {
      dryRun = true;
    } else if ("force".equals(arg)) {
      force = true;
    } else {
      strippedArgs.add(arg);
    }
  }
  String[] finalArgs = strippedArgs.toArray(new String[strippedArgs.size()]);

  if (finalArgs.length != 3 && finalArgs.length != 5) {
    log.info(String.format(""
        + "Usage: %1$s <directory> <repo URL> <group ID>\n"
        + "       %1$s <directory> <repo URL> <group ID> <artifact ID> <version>\n",
        JavadocPublisher.class.getName()));
    System.exit(1);
    return;
  }

  File directory = new File(finalArgs[0]);
  String repoUrl = finalArgs[1];
  String groupId = finalArgs[2];

  JavadocPublisher javadocPublisher = new JavadocPublisher(
      new MavenCentral(), new Cli(), log, directory, dryRun, force);

  int artifactsPublished;
  if (finalArgs.length == 3) {
    artifactsPublished = javadocPublisher.publishLatest(repoUrl, groupId);
  } else {
    String artifactId = finalArgs[3];
    String version = finalArgs[4];
    artifactsPublished = javadocPublisher.publish(repoUrl, groupId, artifactId, version);
  }

  log.info("Published Javadoc for " + artifactsPublished + " artifacts of "
      + groupId + " to " + repoUrl);
}
 
Example 16
Source File: RemovePluginsStep.java    From elasticsearch-maven-plugin with Apache License 2.0 4 votes vote down vote up
@Override
public void execute(InstanceConfiguration config)
{
    Log log = config.getClusterConfiguration().getLog();
    
    File pluginsDir = new File(config.getBaseDir(), "plugins");
    try
    {
        log.debug(String.format(
                "Checking if the plugins directory with path: '%s' exists",
                pluginsDir.getCanonicalPath()));
    }
    catch (IOException e)
    {
        throw new ElasticsearchSetupException(
                "Cannot check if the plugins directory exists",
                e);
    }

    if (pluginsDir.exists())
    {
        log.debug("The plugins directory exists; removing all installed plugins");

        if (VersionUtil.isEqualOrGreater_6_4_0(config.getClusterConfiguration().getVersion()))
        {
            FilesystemUtil.setScriptPermission(config, "elasticsearch-cli");
        }
        FilesystemUtil.setScriptPermission(config, "elasticsearch-plugin");

        CommandLine cmd = ProcessUtil.buildCommandLine("bin/elasticsearch-plugin")
                .addArgument("list");
        
        List<String> output = ProcessUtil.executeScript(config, cmd);
        // remove empty entries and trim
        List<String> pluginNames = output.stream()
                .map(String::trim)
                .filter(StringUtils::isNotEmpty)
                .collect(Collectors.toCollection(ArrayList::new));

        for (String pluginName : pluginNames)
        {
            log.info(String.format("Removing plugin '%s'", pluginName));
            
            CommandLine removeCmd = ProcessUtil.buildCommandLine("bin/elasticsearch-plugin")
                    .addArgument("remove")
                    .addArgument(pluginName);
            
            ProcessUtil.executeScript(config, removeCmd, config.getEnvironmentVariables(), null);
        }
    }
    else
    {
        log.debug("The plugins directory does not exist");
    }
}
 
Example 17
Source File: R4ModelGeneratorImpl.java    From FHIR with Apache License 2.0 4 votes vote down vote up
@Override
public void process(MavenProject mavenProject, Log log) {
    // Only runs for the fhir-model, short-circuits otherwise.
    String targetDir = baseDirectory + "/src/main/java";
    String targetBaseDirectory = baseDirectory;
    baseDirectory = baseDirectory.replace("fhir-model", "fhir-tools");
    
    String definitionsDir = baseDirectory + "/definitions";
    
    if (mavenProject.getArtifactId().contains("fhir-model") || !limit) {

        // Check the base directory
        if ((new File(definitionsDir)).exists()) {

            // injecting for the purposes of setting the header
            log.info("Setting the base dir for definitions -> " + baseDirectory);
            log.info("Setting the Target Directory -> " + targetDir);
            System.setProperty("BaseDir", baseDirectory);
            System.setProperty("TargetBaseDir", targetBaseDirectory);

            Map<String, JsonObject> structureDefinitionMap =
                    CodeGenerator.buildResourceMap(definitionsDir + "/profiles-resources.json", "StructureDefinition");
            structureDefinitionMap.putAll(CodeGenerator.buildResourceMap(definitionsDir + "/profiles-types.json", "StructureDefinition"));

            Map<String, JsonObject> codeSystemMap = CodeGenerator.buildResourceMap(definitionsDir + "/valuesets.json", "CodeSystem");
            codeSystemMap.putAll(CodeGenerator.buildResourceMap(definitionsDir + "/v3-codesystems.json", "CodeSystem"));

            Map<String, JsonObject> valueSetMap = CodeGenerator.buildResourceMap(definitionsDir + "/valuesets.json", "ValueSet");
            valueSetMap.putAll(CodeGenerator.buildResourceMap(definitionsDir + "/v3-codesystems.json", "ValueSet"));

            log.info("[Started] generating the code for fhir-model");
            CodeGenerator generator = new CodeGenerator(structureDefinitionMap, codeSystemMap, valueSetMap);
            generator.generate(targetDir);

            log.info("[Finished] generating the code for fhir-model");
        } else {
            log.info("Skipping as the Definitions don't exist in this project " + baseDirectory);
        }
    } else {
        log.info("Skipping project as the artifact is not a model project -> " + mavenProject.getArtifactId());
    }

}
 
Example 18
Source File: AntTaskUtils.java    From was-maven-plugin with Apache License 2.0 4 votes vote down vote up
public static void execute(WebSphereModel model, PlexusConfiguration target, MavenProject project,
                           MavenProjectHelper projectHelper, List<Artifact> pluginArtifact, Log logger)
    throws IOException, MojoExecutionException {
  // The fileName should probably use the plugin executionId instead of the targetName
  boolean useDefaultTargetName = false;
  String antTargetName = target.getAttribute("name");
  if (null == antTargetName) {
    antTargetName = DEFAULT_ANT_TARGET_NAME;
    useDefaultTargetName = true;
  }
  StringBuilder fileName = new StringBuilder(50);
  fileName.append("build");
  if (StringUtils.isNotBlank(model.getHost())) {
    fileName.append("-").append(model.getHost());
  }
  if (StringUtils.isNotBlank(model.getApplicationName())) {
    fileName.append("-").append(model.getApplicationName());
  }
  fileName.append("-").append(antTargetName).append("-").append(CommandUtils.getTimestampString()).append(".xml");
  File buildFile = getBuildFile(project, fileName.toString());

  if (model.isVerbose()) {
    logger.info("ant fileName: " + fileName);
  }

  if (buildFile.exists()) {
    logger.info("[SKIPPED] already executed");
    return;
  }

  StringWriter writer = new StringWriter();
  AntXmlPlexusConfigurationWriter xmlWriter = new AntXmlPlexusConfigurationWriter();
  xmlWriter.write(target, writer);

  StringBuffer antXML = writer.getBuffer();

  if (useDefaultTargetName) {
    stringReplace(antXML, "<target", "<target name=\"" + antTargetName + "\"");
  }

  final String xmlHeader = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n";
  antXML.insert(0, xmlHeader);
  final String projectOpen = "<project name=\"" + Constants.PLUGIN_ID + "\" default=\"" + antTargetName + "\">\n";
  int index = antXML.indexOf("<target");
  antXML.insert(index, projectOpen);

  final String projectClose = "\n</project>";
  antXML.append(projectClose);

  buildFile.getParentFile().mkdirs();
  FileUtils.fileWrite(buildFile.getAbsolutePath(), "UTF-8", antXML.toString());

  Project antProject = generateAntProject(model, buildFile, project, projectHelper, pluginArtifact, logger);
  antProject.executeTarget(antTargetName);
}
 
Example 19
Source File: DefaultDescriptorsExtractor.java    From james-project with Apache License 2.0 4 votes vote down vote up
private void handleInfoLoadFailure(Log log, String nameOfClass,
        final Type type, Exception e) {
    log.info("Cannot load " + type + " info for " + nameOfClass, e);
    log.debug(e);
}
 
Example 20
Source File: StartMojo.java    From wildfly-maven-plugin with GNU Lesser General Public License v2.1 4 votes vote down vote up
private CommandBuilder createDomainCommandBuilder(final Path jbossHome) throws MojoExecutionException {
    final Path javaHome = (this.javaHome == null ? Paths.get(System.getProperty("java.home")) : Paths.get(this.javaHome));
    final DomainCommandBuilder commandBuilder = DomainCommandBuilder.of(jbossHome, javaHome)
            .addModuleDirs(modulesPath.getModulePaths());

    // Set the JVM options
    if (Utils.isNotNullOrEmpty(javaOpts)) {
        commandBuilder.setProcessControllerJavaOptions(javaOpts)
                .setHostControllerJavaOptions(javaOpts);
    }

    if (domainConfig != null) {
        commandBuilder.setDomainConfiguration(domainConfig);
    }

    if (hostConfig != null) {
        commandBuilder.setHostConfiguration(hostConfig);
    }

    if (propertiesFile != null) {
        commandBuilder.setPropertiesFile(propertiesFile);
    }

    if (serverArgs != null) {
        commandBuilder.addServerArguments(serverArgs);
    }

    // Workaround for WFCORE-4121
    if (Environment.isModularJvm(javaHome)) {
        commandBuilder.addHostControllerJavaOptions(Environment.getModularJvmArguments());
        commandBuilder.addProcessControllerJavaOptions(Environment.getModularJvmArguments());
    }

    // Print some server information
    final Log log = getLog();
    log.info("JAVA_HOME : " + commandBuilder.getJavaHome());
    log.info("JBOSS_HOME: " + commandBuilder.getWildFlyHome());
    log.info("JAVA_OPTS : " + Utils.toString(commandBuilder.getHostControllerJavaOptions(), " "));
    try {
        addUsers(commandBuilder.getWildFlyHome(), commandBuilder.getJavaHome());
    } catch (IOException e) {
        throw new MojoExecutionException("Failed to add users", e);
    }
    return commandBuilder;
}