Package eu.maveniverse.domtrip.maven
Class PomEditor.Extensions
- java.lang.Object
-
- eu.maveniverse.domtrip.maven.PomEditor.Extensions
-
- Enclosing class:
- PomEditor
public class PomEditor.Extensions extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description Extensions()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description eu.maveniverse.domtrip.ElementaddExtension(eu.maveniverse.domtrip.Element extensionsElement, java.lang.String groupId, java.lang.String artifactId, java.lang.String version)Adds a extension element with the specified coordinates.booleandeleteExtension(Coordinates coordinates)Removes an extension fromproject/build/extensions/extension[].booleanupdateExtension(boolean upsert, Coordinates coordinates)Updates or inserts an extension inproject/build/extensions/extension[].
-
-
-
Method Detail
-
addExtension
public eu.maveniverse.domtrip.Element addExtension(eu.maveniverse.domtrip.Element extensionsElement, java.lang.String groupId, java.lang.String artifactId, java.lang.String version) throws eu.maveniverse.domtrip.DomTripExceptionAdds a extension element with the specified coordinates.- Parameters:
extensionsElement- the extensions container elementgroupId- the extension groupIdartifactId- the extension artifactIdversion- the extension version- Returns:
- the newly created extension element
- Throws:
eu.maveniverse.domtrip.DomTripException- if the plugin cannot be added
-
updateExtension
public boolean updateExtension(boolean upsert, Coordinates coordinates) throws eu.maveniverse.domtrip.DomTripExceptionUpdates or inserts an extension inproject/build/extensions/extension[].If the extension exists (matched by GA), its version is updated. If the version is a property reference (${...}), the property value is updated instead. If
upsertis true and the plugin doesn't exist, it will be created.Example:
PomEditor editor = new PomEditor(document); Coordinates myExtension = Coordinates.of("org.apache.maven.extensions", "some-extension", "1.11.0"); editor.updateExtension(true, myExtension);- Parameters:
upsert- whether to create the extension if it doesn't existcoordinates- the artifact coordinates- Returns:
- true if the extension was updated or created, false otherwise
- Throws:
eu.maveniverse.domtrip.DomTripException- if an error occurs during editing- Since:
- 0.3.1
-
deleteExtension
public boolean deleteExtension(Coordinates coordinates) throws eu.maveniverse.domtrip.DomTripException
Removes an extension fromproject/build/extensions/extension[].Example:
PomEditor editor = new PomEditor(document); Coordinates myExtension = Coordinates.of("org.apache.maven.extension", "my-extension", "1.11.0"); editor.deleteExtension(myExtension);- Parameters:
coordinates- the artifact to remove (matched by GA)- Returns:
- true if the extension was removed, false if it didn't exist
- Throws:
eu.maveniverse.domtrip.DomTripException- Since:
- 0.3.1
-
-