public final class ModelUtils extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
ModelUtils.Descriptor |
static class |
ModelUtils.LibraryDescriptor |
static class |
ModelUtils.RepositoryDescriptor |
| Modifier and Type | Field and Description |
|---|---|
static String |
LIBRARY_PROP_DEPENDENCIES
library descriptor property containing whitespace separated list of maven coordinate values groupid:artifactId:version:[classifier:]type
|
static String |
LIBRARY_PROP_REPOSITORIES
library descriptor property containing whitespace separated list of maven coordinate values repo_type:repo_url
|
| Modifier and Type | Method and Description |
|---|---|
static void |
addDependency(FileObject pom,
String group,
String artifact,
String version,
String type,
String scope,
String classifier,
boolean acceptNull) |
static org.netbeans.modules.maven.model.pom.Repository |
addModelRepository(org.apache.maven.project.MavenProject project,
org.netbeans.modules.maven.model.pom.POMModel mdl,
String url) |
static boolean |
checkByCLIMavenValidationLevel(org.apache.maven.model.building.ModelProblem problem) |
static ModelUtils.Descriptor |
checkLibraries(Library library)
return a descriptor for entire
Library containing recognized dependencies and repositories,
both in old (volume) and new (properties) format |
static ModelUtils.LibraryDescriptor |
checkLibrary(URL pom)
Deprecated.
in favor of
checkLibraries(Library) |
static org.netbeans.modules.maven.model.pom.Dependency |
checkModelDependency(org.netbeans.modules.maven.model.pom.POMModel pom,
String groupId,
String artifactId,
boolean add) |
static org.netbeans.modules.maven.model.pom.POMExtensibilityElement |
getOrCreateChild(org.netbeans.modules.maven.model.pom.POMComponent parent,
String localQName,
org.netbeans.modules.maven.model.pom.POMModel pomModel)
Returns child element of given parent, specified by its local name.
|
static boolean |
hasModelDependency(org.netbeans.modules.maven.model.pom.POMModel mdl,
String groupid,
String artifactid) |
static void |
openAtPlugin(org.netbeans.modules.maven.model.pom.POMModel model,
String groupId,
String artifactId)
Opens pom at a plugin with the given groupId and artifactId.
|
static void |
openAtSource(org.apache.maven.model.InputLocation location)
Opens a pom file at location defined in InputLocation parameter
|
static void |
setSourceLevel(org.netbeans.modules.maven.model.pom.POMModel mdl,
String sourceLevel)
Sets the Java source and target level of a project (will set release if previously set).
|
static void |
updatePluginVersion(String groupId,
String artifactId,
String version,
org.netbeans.modules.maven.model.pom.Project prj) |
public static final String LIBRARY_PROP_DEPENDENCIES
public static final String LIBRARY_PROP_REPOSITORIES
public static void addDependency(FileObject pom, String group, String artifact, String version, String type, String scope, String classifier, boolean acceptNull)
pom - FileObject that represents POMgroup - artifact - version - type - scope - classifier - acceptNull - accept null values to scope,type and classifier.
If true null values will remove corresponding tag.public static org.netbeans.modules.maven.model.pom.Dependency checkModelDependency(org.netbeans.modules.maven.model.pom.POMModel pom,
String groupId,
String artifactId,
boolean add)
public static boolean hasModelDependency(org.netbeans.modules.maven.model.pom.POMModel mdl,
String groupid,
String artifactid)
public static void openAtSource(org.apache.maven.model.InputLocation location)
location - public static void openAtPlugin(org.netbeans.modules.maven.model.pom.POMModel model,
String groupId,
String artifactId)
model - the model to opengroupId - the plugin groupIdartifactId - the plugin artifactIdpublic static void updatePluginVersion(String groupId, String artifactId, String version, org.netbeans.modules.maven.model.pom.Project prj)
public static org.netbeans.modules.maven.model.pom.Repository addModelRepository(org.apache.maven.project.MavenProject project,
org.netbeans.modules.maven.model.pom.POMModel mdl,
String url)
mdl - url - of the repositorypublic static boolean checkByCLIMavenValidationLevel(org.apache.maven.model.building.ModelProblem problem)
public static void setSourceLevel(org.netbeans.modules.maven.model.pom.POMModel mdl,
String sourceLevel)
PluginPropertyUtils.getPluginProperty(org.netbeans.api.project.Project,String,String,String,String,String) first
(Constants.GROUP_APACHE_PLUGINS, Constants.PLUGIN_COMPILER, Constants.SOURCE_PARAM, "compile")
to make sure that the current level is actually not what you want.
Please Note: This method will not take existing properties into account (maven.compiler.source, maven.compiler.target or maven.compiler.release),
it is only updating the plugin configuration itself.mdl - a POM modelsourceLevel - the desired source levelpublic static org.netbeans.modules.maven.model.pom.POMExtensibilityElement getOrCreateChild(org.netbeans.modules.maven.model.pom.POMComponent parent,
String localQName,
org.netbeans.modules.maven.model.pom.POMModel pomModel)
parent - parent elementlocalQName - local name of the childpomModel - whole pom model@Deprecated public static ModelUtils.LibraryDescriptor checkLibrary(URL pom)
checkLibraries(Library)pom - library to checkpublic static ModelUtils.Descriptor checkLibraries(Library library)
Library containing recognized dependencies and repositories,
both in old (volume) and new (properties) formatlibrary -