getParams(String params) {
String[] split = params == null ? new String[0] : params.split(",");
return Arrays.asList(split);
}
+
+ /**
+ * {@link MavenProject#getDependencyArtifacts()} is deprecated.
+ *
+ *
+ * This method checks if the dependency artifacts is {@code null} and returns an empty {@code HashSet} to avoid the
+ * {@code NullPointerException}s caused by the {@link MavenProject#getDependencyArtifacts()} returning {@code null}.
+ *
+ *
+ * @param project the MavenProject to retrieve artifacts from
+ * @return a HashSet of dependencies or an empty set
+ */
+ public static Set getDependencyArtifacts(MavenProject project) {
+ if (project == null || project.getDependencyArtifacts() == null) {
+ LOG.warn("");
+ LOG.warn("Non-transitive dependencies cannot be found. ");
+ LOG.warn("");
+ return Collections.emptySet();
+ }
+ return project.getDependencyArtifacts();
+ }
}