Class PomEditor.Extensions
java.lang.Object
eu.maveniverse.domtrip.maven.PomEditor.Extensions
- Enclosing class:
PomEditor
- Since:
- 0.1
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioneu.maveniverse.domtrip.ElementaddExtension(eu.maveniverse.domtrip.Element extensionsElement, String groupId, String artifactId, 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[].
-
Constructor Details
-
Extensions
public Extensions()
-
-
Method Details
-
addExtension
public eu.maveniverse.domtrip.Element addExtension(eu.maveniverse.domtrip.Element extensionsElement, String groupId, String artifactId, String version) throws eu.maveniverse.domtrip.DomTripException Adds 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.DomTripException Updates 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
-