public final class PomUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static File |
extractPomFromJar(JarFile jar,
String groupId,
String artifactId) |
static String |
getGroupId(org.apache.maven.model.Model model)
Gets the artifact group ID from the provided model.
|
static String |
getVersion(File pomXmlFile)
Reads the artifact version from the provided pom.xml file.
|
static String |
getVersion(org.apache.maven.model.Model model)
Gets the artifact version from the provided model.
|
static org.apache.maven.model.Model |
read(File pomXmlFile)
Parses the Maven project model from the specified pom.xml file.
|
static org.apache.maven.model.Model |
read(InputStream pomXmlStream)
Parses the Maven project model from the specified pom.xml input stream.
|
static void |
updateDistributionManagement(File pomXmlFile,
String repositoryId,
String repositoryUrl)
Updates the distribution management repository in the specified Maven project file.
|
static void |
updateForgeUrl(File pomXmlFile,
String forgeUrl) |
static void |
updateJahiaDepends(File pomXmlFile,
String depends,
boolean useProperties)
Updates the Jahia-Depends information in the maven-bundle-plugin to reflect the new list of dependencies.
|
static void |
updateScm(File pomXmlFile,
String scmUrl)
Updates the SCM connection URL in the specified Maven project file.
|
static void |
updateVersion(File pomXmlFile,
String version)
Updates the project version in the specified Maven project file.
|
static void |
write(org.apache.maven.model.Model model,
File targetPomXmlFile)
Serializes Maven project model into a specified file.
|
public static String getGroupId(org.apache.maven.model.Model model)
null.model - the Maven project modelnullpublic static String getVersion(File pomXmlFile) throws IOException, org.codehaus.plexus.util.xml.pull.XmlPullParserException
null.pomXmlFile - the Maven project descriptor file to readnullIOException - in case of a reading problemorg.codehaus.plexus.util.xml.pull.XmlPullParserException - in case of a parsing errorpublic static String getVersion(org.apache.maven.model.Model model)
null.model - the Maven project modelnullpublic static org.apache.maven.model.Model read(File pomXmlFile) throws IOException, org.codehaus.plexus.util.xml.pull.XmlPullParserException
pomXmlFile - the Maven project descriptor to read model fromIOException - in case of a reading problemorg.codehaus.plexus.util.xml.pull.XmlPullParserException - in case of a parsing errorpublic static org.apache.maven.model.Model read(InputStream pomXmlStream) throws IOException, org.codehaus.plexus.util.xml.pull.XmlPullParserException
pomXmlStream - the Maven project descriptor input stream to read model fromIOException - in case of a reading problemorg.codehaus.plexus.util.xml.pull.XmlPullParserException - in case of a parsing errorpublic static void updateDistributionManagement(File pomXmlFile, String repositoryId, String repositoryUrl) throws IOException, org.codehaus.plexus.util.xml.pull.XmlPullParserException
pomXmlFile - the Maven project descriptor file to updaterepositoryId - the server ID for the distribution repositoryrepositoryUrl - the URL of the target distribution repositoryIOException - in case of a reading problemorg.codehaus.plexus.util.xml.pull.XmlPullParserException - in case of a parsing errorpublic static void updateForgeUrl(File pomXmlFile, String forgeUrl) throws IOException, org.codehaus.plexus.util.xml.pull.XmlPullParserException
IOExceptionorg.codehaus.plexus.util.xml.pull.XmlPullParserExceptionpublic static void updateJahiaDepends(File pomXmlFile, String depends, boolean useProperties) throws IOException, org.codehaus.plexus.util.xml.pull.XmlPullParserException
pomXmlFile - the Maven project descriptor file to updatedepends - comma-separated list of dependenciesuseProperties - IOException - in case of a reading problemorg.codehaus.plexus.util.xml.pull.XmlPullParserException - in case of a parsing errorpublic static void updateScm(File pomXmlFile, String scmUrl) throws IOException, org.codehaus.plexus.util.xml.pull.XmlPullParserException
pomXmlFile - the Maven project descriptor file to updatescmUrl - the SCM connection URL to setIOException - in case of a reading problemorg.codehaus.plexus.util.xml.pull.XmlPullParserException - in case of a parsing errorpublic static void updateVersion(File pomXmlFile, String version) throws IOException, org.codehaus.plexus.util.xml.pull.XmlPullParserException
pomXmlFile - the Maven project descriptor file to updateversion - the new version to setIOException - in case of a reading problemorg.codehaus.plexus.util.xml.pull.XmlPullParserException - in case of a parsing errorpublic static void write(org.apache.maven.model.Model model,
File targetPomXmlFile)
throws IOException
model - the Maven project model to serializetargetPomXmlFile - the target file to write the provided model intoIOException - in case of a serialization errorpublic static File extractPomFromJar(JarFile jar, String groupId, String artifactId) throws IOException
IOExceptionCopyright © 2004–2020 Jahia Solutions Group SA. All rights reserved.