use of org.apache.maven.model.Dependency in project maven-plugins by apache.
the class DependencyManagementRenderer method renderDependenciesForScope.
private void renderDependenciesForScope(String scope, List<Dependency> artifacts) {
if (artifacts != null) {
// can't use straight artifact comparison because we want optional last
Collections.sort(artifacts, getDependencyComparator());
startSection(scope);
paragraph(getI18nString("intro." + scope));
startTable();
boolean hasClassifier = false;
for (Dependency dependency : artifacts) {
if (StringUtils.isNotEmpty(dependency.getClassifier())) {
hasClassifier = true;
break;
}
}
String[] tableHeader = getDependencyTableHeader(hasClassifier);
tableHeader(tableHeader);
for (Dependency dependency : artifacts) {
tableRow(getDependencyRow(dependency, hasClassifier));
}
endTable();
endSection();
}
}
use of org.apache.maven.model.Dependency in project maven-plugins by apache.
the class MavenProjectArtifactsStub method getDependencies.
public List<Dependency> getDependencies() {
if (getArtifacts() == null) {
return new ArrayList<Dependency>();
}
final List<Dependency> dependencies = new ArrayList<Dependency>();
for (Object o : getArtifacts()) {
Artifact a = (Artifact) o;
Dependency dependency = new Dependency();
dependency.setArtifactId(a.getArtifactId());
dependency.setGroupId(a.getGroupId());
dependency.setVersion(a.getVersion());
dependency.setScope(a.getScope());
dependency.setType(a.getType());
dependency.setClassifier(a.getClassifier());
dependencies.add(dependency);
}
return dependencies;
}
use of org.apache.maven.model.Dependency in project maven-plugins by apache.
the class WebappStructureTest method testDependencyAnalysisNoChange.
public void testDependencyAnalysisNoChange() {
final List<Dependency> dependencies = new ArrayList<Dependency>();
dependencies.add(createDependency("groupTest", "artifactTest", "1.0"));
final WebappStructure cache = new WebappStructure(dependencies);
final WebappStructure webappStructure = new WebappStructure(dependencies, cache);
webappStructure.analyseDependencies(new WebappStructure.DependenciesAnalysisCallback() {
int count = 0;
public void unchangedDependency(Dependency dependency) {
if (count == 0) {
count++;
} else {
fail("Should have called unchanged dependency only once");
}
}
public void newDependency(Dependency dependency) {
fail("Should have failed to trigger this callback");
}
public void removedDependency(Dependency dependency) {
fail("Should have failed to trigger this callback");
}
public void updatedVersion(Dependency dependency, String previousVersion) {
fail("Should have failed to trigger this callback");
}
public void updatedScope(Dependency dependency, String previousScope) {
fail("Should have failed to trigger this callback");
}
public void updatedOptionalFlag(Dependency dependency, boolean previousOptional) {
fail("Should have failed to trigger this callback");
}
public void updatedUnknown(Dependency dependency, Dependency previousDep) {
fail("Should have failed to trigger this callback");
}
});
}
use of org.apache.maven.model.Dependency in project maven-plugins by apache.
the class WarUtilsTest method testDependencyEquals.
/**
* Test for MWAR-160.
*/
public void testDependencyEquals() {
Dependency firstDependency = new Dependency();
firstDependency.setGroupId("1");
firstDependency.setArtifactId("a");
Dependency secondDependency = new Dependency();
secondDependency.setGroupId("2");
secondDependency.setArtifactId("b");
Dependency thirdDependency = new Dependency();
thirdDependency.setGroupId("1");
thirdDependency.setArtifactId("c");
Dependency fourthDependency = new Dependency();
fourthDependency.setGroupId("4");
fourthDependency.setArtifactId("a");
assertFalse("dependencies 1:a and 2:b should not be equal", WarUtils.dependencyEquals(firstDependency, secondDependency));
assertFalse("dependencies 1:a and 1:c should not be equal", WarUtils.dependencyEquals(firstDependency, thirdDependency));
assertFalse("dependencies 1:a and 4:a should not be equal", WarUtils.dependencyEquals(firstDependency, fourthDependency));
assertFalse("dependencies 2:b and 1:c should not be equal", WarUtils.dependencyEquals(secondDependency, thirdDependency));
assertFalse("dependencies 2:b and 4:a should not be equal", WarUtils.dependencyEquals(secondDependency, fourthDependency));
assertFalse("dependencies 1:c and 4:a should not be equal", WarUtils.dependencyEquals(thirdDependency, fourthDependency));
}
use of org.apache.maven.model.Dependency in project maven-plugins by apache.
the class WebappStructureTest method testUnknownFileNotAvailable.
public void testUnknownFileNotAvailable() {
final WebappStructure structure = new WebappStructure(new ArrayList<Dependency>());
assertFalse(structure.isRegistered("/foo/bar.txt"));
}
Aggregations