Java Code Examples for org.apache.maven.model.Model#setProperties()
The following examples show how to use
org.apache.maven.model.Model#setProperties() .
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: MojoUtils.java From quarkus with Apache License 2.0 | 5 votes |
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(); sorted.putAll(props); model.setProperties(sorted); } try (OutputStream stream = fileOutputStream) { new MavenXpp3Writer().write(stream, model); } }
Example 2
Source File: PomAddProperty.java From butterfly with MIT License | 5 votes |
@Override 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); break; case NoOp: return TOExecutionResult.noOp(this, notAddMessage); case Overwrite: // Nothing to be done here break; case Fail: // Fail is the default 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) { result.addWarning(warning); } return result; }
Example 3
Source File: MavenSessionMock.java From gitflow-incremental-builder with MIT License | 5 votes |
private static MavenProject createProject(Path path) { MavenProject project = new MavenProject(); Model model = new Model(); model.setProperties(new Properties()); project.setModel(model); project.setArtifactId(path.getFileName().toString()); project.setGroupId(path.getFileName().toString()); project.setVersion("1"); project.setFile(path.resolve("pom.xml").toFile()); return project; }
Example 4
Source File: PropertyVersionChangerTests.java From spring-cloud-release-tools with Apache License 2.0 | 4 votes |
ModelWrapper modelWithSameValues() { Model model = new Model(); model.setProperties(propertiesWithSameValues()); return new ModelWrapper(model); }
Example 5
Source File: PropertyVersionChangerTests.java From spring-cloud-release-tools with Apache License 2.0 | 4 votes |
ModelWrapper nonMatchingModel() { Model model = new Model(); model.setProperties(nonMatchingProperties()); return new ModelWrapper(model); }
Example 6
Source File: PomProperty.java From flatten-maven-plugin with Apache License 2.0 | 4 votes |
@Override public void set( Model model, Properties value ) { model.setProperties( value ); }