本文整理匯總了Java中org.apache.maven.project.MavenProject.getDependencyManagement方法的典型用法代碼示例。如果您正苦於以下問題:Java MavenProject.getDependencyManagement方法的具體用法?Java MavenProject.getDependencyManagement怎麽用?Java MavenProject.getDependencyManagement使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.maven.project.MavenProject
的用法示例。
在下文中一共展示了MavenProject.getDependencyManagement方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: managedAsArtifacts
import org.apache.maven.project.MavenProject; //導入方法依賴的package包/類
public Set<Artifact> managedAsArtifacts(ProjectBuildingRequest projectBuildingRequest, MavenProject project) throws MavenExecutionException {
if (project.getDependencyManagement() != null) {
return asArtifacts(projectBuildingRequest, project.getDependencyManagement().getDependencies());
} else {
return Collections.emptySet();
}
}
示例2: getDependenciesFromDM
import org.apache.maven.project.MavenProject; //導入方法依賴的package包/類
private static List<Dependency> getDependenciesFromDM(MavenProject project, Project nbprj) {
NbMavenProjectImpl p = nbprj.getLookup().lookup(NbMavenProjectImpl.class);
MavenProject localProj = project;
DependencyManagement curDM;
List<Dependency> result = new ArrayList<Dependency>();
//mkleint: without the managementKey checks I got some entries multiple times.
// do we actually need to traverse the parent poms, are they completely resolved anyway?
//XXX
Set<String> knownKeys = new HashSet<String>();
while (localProj != null) {
curDM = localProj.getDependencyManagement();
if (curDM != null) {
@SuppressWarnings("unchecked")
List<Dependency> ds = curDM.getDependencies();
for (Dependency d : ds) {
if (knownKeys.contains(d.getManagementKey())) {
continue;
}
result.add(d);
knownKeys.add(d.getManagementKey());
}
}
try {
localProj = p.loadParentOf(EmbedderFactory.getProjectEmbedder(), localProj);
} catch (ProjectBuildingException x) {
break;
}
}
Collections.sort(result, new Comparator<Dependency>() {
@Override
public int compare(Dependency o1, Dependency o2) {
return o1.getManagementKey().compareTo(o2.getManagementKey());
}
});
return result;
}
示例3: hasEffectiveDependency
import org.apache.maven.project.MavenProject; //導入方法依賴的package包/類
private boolean hasEffectiveDependency(String groupId, String artifactId, NbMavenProject prj) {
MavenProject mp = prj.getMavenProject();
List<org.apache.maven.model.Dependency> dl = new ArrayList<org.apache.maven.model.Dependency>();
dl.addAll(mp.getDependencies());
org.apache.maven.model.DependencyManagement dm = mp.getDependencyManagement();
if (dm != null) {
dl.addAll(dm.getDependencies());
}
for (org.apache.maven.model.Dependency d : dl) {
if (groupId.equals(d.getGroupId()) && artifactId.equals(d.getArtifactId())) {
return true;
}
}
return false;
}