[forge-dev] Manipulating the pom: classifiers and dependencyManagement
Brian Leathem
bleathem at gmail.com
Sun Apr 3 00:22:27 EDT 2011
FYI, I ended up doing the following hack (which is probably along the
lines of what you are implementing):
private void installDependencyManagement(Project project, PipeOut pipeOut) {
MavenCoreFacet maven = project.getFacet(MavenCoreFacet.class);
Model pom = maven.getPOM();
DependencyManagement dependencyManagement =
pom.getDependencyManagement();
if (dependencyManagement == null) {
dependencyManagement = new DependencyManagement();
}
DependencyBuilder bomDependency = DependencyBuilder.create();
bomDependency.setArtifactId("richfaces-bom").setGroupId("org.richfaces").setVersion("4.0.0.Final").setScopeType(ScopeType.IMPORT).setPackagingType("pom");
for (org.apache.maven.model.Dependency dependency :
dependencyManagement.getDependencies()) {
Dependency localDependency = new
MavenDependencyAdapter(dependency);
if
(bomDependency.getArtifactId().equals(localDependency.getArtifactId())
&& bomDependency.getGroupId().equals(localDependency.getGroupId())) {
pipeOut.println(ShellColor.YELLOW,
String.format(ALREADY_INSTALLED_MSG_FMT, "RichFaces BOM"));
return;
}
}
dependencyManagement.addDependency(new
MavenDependencyAdapter(bomDependency));
pom.setDependencyManagement(dependencyManagement);
maven.setPOM(pom);
pipeOut.println(ShellColor.GREEN,
String.format(SUCCESS_MSG_FMT, "RichFaces BOM"));
}
Brian
On 04/02/2011 03:23 PM, Ken Finnigan wrote:
> Brian
>
> The dep man stuff I'm working on at moment. There is a jira I created last night for it
>
> Ken
>
> Sent from my iPhone
>
> On Apr 2, 2011, at 18:07, Brian Leathem<bleathem at gmail.com> wrote:
>
>> Hey Forgeheads!
>>
>> I'm using the DependencyBuilder to add dependencies to the pom, but I'm
>> missing a "setClassifier" method. I'll file a jira for this, and maybe
>> even submit a patch if no one else beats me to it!
>>
>> The next piece I'm looking for is adding a<dependencyManagement>
>> section to my pom, and adding dependencies to that. I can't however
>> find anywhere in the API to do this. Does this functionality exist? Or
>> should I file a jira?
>>
>> Thanks,
>> Brian Leathem
>>
>> _______________________________________________
>> forge-dev mailing list
>> forge-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/forge-dev
> _______________________________________________
> forge-dev mailing list
> forge-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/forge-dev
More information about the forge-dev
mailing list