Java Code Examples for org.apache.maven.model.Model#setProperties()

The following examples show how to use org.apache.maven.model.Model#setProperties() . These examples are extracted from open source projects. 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 Project: quarkus   File:    License: Apache License 2.0 5 votes vote down vote up
public static void write(Model model, OutputStream fileOutputStream) throws IOException {
    final Properties props = model.getProperties();
    // until we can preserve the user ordering, it's better to stick to the alphabetical one
    if (!props.isEmpty() && !(props instanceof SortedProperties)) {
        final Properties sorted = new SortedProperties();
    try (OutputStream stream = fileOutputStream) {
        new MavenXpp3Writer().write(stream, model);
Example 2
Source Project: butterfly   File:    License: MIT License 5 votes vote down vote up
protected TOExecutionResult pomExecution(String relativePomFile, Model model) {
    Exception warning = null;

    if (model.getProperties() == null ) {
        model.setProperties(new Properties());

    Properties properties = model.getProperties();

    if (properties.getProperty(propertyName) != null) {
        String notAddMessage = "Property " + propertyName + " was not added to POM file " + getRelativePath() + " because it is already present";
        switch (ifPresent) {
            case WarnNotAdd:
                return TOExecutionResult.warning(this, new TransformationOperationException(notAddMessage));
            case WarnButAdd:
                warning = new TransformationOperationException("Property " + propertyName + " was already present in POM file " + getRelativePath() + ", but it was overwritten to " + propertyValue);
            case NoOp:
                return TOExecutionResult.noOp(this, notAddMessage);
            case Overwrite:
                // Nothing to be done here
            case Fail:
                // Fail is the default
                return TOExecutionResult.error(this, new TransformationOperationException(notAddMessage));

    properties.put(propertyName, propertyValue);
    String details = String.format("Property %s=%s has been added to POM file %s", propertyName, propertyValue, relativePomFile);
    TOExecutionResult result = TOExecutionResult.success(this, details);

    if (warning != null) {

    return result;
Example 3
private static MavenProject createProject(Path path) {
    MavenProject project = new MavenProject();
    Model model = new Model();
    model.setProperties(new Properties());
    return project;
Example 4
ModelWrapper modelWithSameValues() {
	Model model = new Model();
	return new ModelWrapper(model);
Example 5
ModelWrapper nonMatchingModel() {
	Model model = new Model();
	return new ModelWrapper(model);
Example 6
public void set( Model model, Properties value )
    model.setProperties( value );