/** * Indicates whether it's valid to add the given {@link Dependency} to this * POM. * * @param newDependency the {@link Dependency} to check (can be * <code>null</code>) * @return see above * @since 1.2.1 */ public boolean canAddDependency(final Dependency newDependency, boolean checkVersion) { return newDependency != null && !isDependencyRegistered(newDependency, checkVersion) && !Dependency.isHigherLevel(newDependency.getType().toString(), packaging); }
/** * Indicates whether it's valid to add the given {@link Dependency} to the dependencyManagement * of this pom * * @param newDependency the {@link Dependency} to check (can be * <code>null</code>) * @return see above * @since 2.0 */ public boolean canAddDependencyToDependencyManagement(final Dependency newDependency, boolean checkVersion) { return newDependency != null && !isDependencyRegisteredInDependencyManagement(newDependency, checkVersion) && !Dependency.isHigherLevel(newDependency.getType().toString(), packaging); }