petrovic-d commented on code in PR #7700:
URL: https://github.com/apache/netbeans/pull/7700#discussion_r1736058335


##########
enterprise/cloud.oracle/src/org/netbeans/modules/cloud/oracle/assets/DependencyUtils.java:
##########
@@ -64,4 +56,39 @@ public static void addDependency(Project project, String 
groupId, String artifac
         }
     }
     
+    public static void addAnnotationProcessor(Project project, String groupId, 
String artifactId) {
+        Project projectToModify = getProjectToModify(project, "lib");
+        
+        if (projectToModify != null) {
+            ArtifactSpec spec = ArtifactSpec.make(groupId, artifactId);
+            Dependency dep = Dependency.make(spec, Scopes.PROCESS);
+            DependencyChange change = 
DependencyChange.builder(DependencyChange.Kind.ADD)
+                    .dependency(dep)
+                    .create();
+
+            try {
+                ModificationResult mod = ProjectDependencies
+                        .modifyDependencies(projectToModify, new 
DependencyChangeRequest(Collections.singletonList(change)));
+                mod.commit();
+            } catch (IOException | DependencyChangeException | 
ProjectOperationException ex) {
+                throw new IllegalStateException(ex);

Review Comment:
   If dependency is already there we should silently continue IMO, in that case 
NullPointerException will be thrown.
   And for other failures, I am not sure if we can recover



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to