/** @param d not null */ protected boolean match(Dependency d) { boolean r = true; /* match if not attributes given */ if (hasattribs() == false) return r; if (r && this.alias != null) r = match(this.alias, d.getAlias()); if (r && this.scope != null) { String[] scope; scope = d.getScope(); r = false; for (int i = 0; !r && i < scope.length; ++i) r = match(this.scope, scope[i]); } if (r && this.bname != null) r = match(this.bname, d.basename()); if (r && this.type != null) r = match(this.type, d.getType()); if (r && this.gid != null) r = match(this.gid, d.getGroupId()); if (r && this.path != null) r = match(this.path, d.m1path()); if (r && this.version != null) r = match(this.version, d.getVersion()); return r; }
public boolean isDepended(String artifactId, String version) { if (this.dependencies == null || this.dependencies.size() == 0) { return false; } for (Dependency depend : this.dependencies) { if (artifactId.equals(depend.getArtifactId())) { if (version == null || version.equals(depend.getVersion())) { return true; } } } return false; }
@Test public void testDependenciesWithSameVersionAreEqual() { // Set up final Dependency dependency1 = new Dependency(DEPENDENCY_GROUP_ID, DEPENDENCY_ARTIFACT_ID, DEPENDENCY_VERSION); final Dependency dependency2 = new Dependency( dependency1.getGroupId(), dependency1.getArtifactId(), dependency1.getVersion()); // Invoke final boolean equal = dependency1.equals(dependency2); // Check assertTrue(equal); }
@Test public void testDependenciesWithSameVersionHaveSameCoordinates() { // Set up final Dependency dependency1 = new Dependency(DEPENDENCY_GROUP_ID, DEPENDENCY_ARTIFACT_ID, DEPENDENCY_VERSION); final Dependency dependency2 = new Dependency( dependency1.getGroupId(), dependency1.getArtifactId(), dependency1.getVersion()); // Invoke final boolean same = dependency1.hasSameCoordinates(dependency2); // Check assertTrue(same); }
/** Return the 'spring-boot-dependencies' POM version. */ public String getSpringBootVersion() { Dependency dependency = find("org.springframework.boot", "spring-boot"); return (dependency == null ? null : dependency.getVersion()); }
@Override public String getVersion(String module) { Dependency dependency = find(module); return dependency == null ? null : dependency.getVersion(); }