You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2022/06/01 16:32:35 UTC

[GitHub] [netbeans] sdedic opened a new pull request, #4184: Maven / dependency query fixes.

sdedic opened a new pull request, #4184:
URL: https://github.com/apache/netbeans/pull/4184

   During testing (and usage), it turned out that the newer `DependencyGraphBuilder` does not give out as much information as the older `DependencyTreeBuilder`. Namely duplicated artifacts are omitted from the dependency report and in case of a version clash, the clashing artifact is **removed at all** from the report.
   
   So this PR mainly rewrites the maven implementation back to the older API so that more info can be pulled out from maven.
   
   I've realized that the client may need to allow artifact fetching (online / offline mode) as well as order to flush caches before running the query. I changed the private API so that `DependencyQuery` object is now used as a parameter (+ added a `Builder` for it). Further extensions should be API-compatible.
   
   Strangely enough, our infrastructure (?) sometimes fails to configure the session properly (?) or maybe Maven does not propagate the offline flag everywhere, so our `RepositoryConnector` pulls on an emergency brake and throws `AssertionError` to abort the unexpected and disallowed online operation. I've added a test method to see whether the throwable is an 'offline' exception.
   
   I've extended `DependencyTreeFactory` API to allow multiple scopes to be specified; and also wraps maven internal errors into `MavenExecutionException` instead of just returning `null` (which can't be inspected for what happened). The older method variant remains compatible (catches, logs, returns `null`).


-- 
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: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

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


[GitHub] [netbeans] sdedic commented on a diff in pull request #4184: Maven / dependency query fixes.

Posted by GitBox <gi...@apache.org>.
sdedic commented on code in PR #4184:
URL: https://github.com/apache/netbeans/pull/4184#discussion_r887745484


##########
ide/project.dependency/src/org/netbeans/modules/project/dependency/DependencyResult.java:
##########
@@ -45,8 +46,18 @@ public interface DependencyResult extends Lookup.Provider {
      */
     public Dependency getRoot();
     
+    /**
+     * Checks if the data is still valid
+     * @return true, if the data is valid
+     */
     public boolean isValid();
     
+    /**
+     * Returns artifacts that may be unavailable or erroneous.
+     * @return problem artifacts
+     */
+    public Collection<ArtifactSpec> getProblemArtifacts();
+    

Review Comment:
   They can be ... but they are 'problematic' :) e.g. they do not have the `getFile()` valid / filled in. Or some other issue like version conflict. Maybe this could rather identify the `Dependency` structure -- which means an exact position in the tree  ?



##########
ide/project.dependency/src/org/netbeans/modules/project/dependency/ArtifactSpec.java:
##########
@@ -62,9 +63,10 @@ public enum VersionKind {
     private final String versionSpec;
     private final String classifier;
     private final boolean optional;
+    private final FileObject localFile;
     final T data;
 
-    ArtifactSpec(VersionKind kind, String groupId, String artifactId, String versionSpec, String type, String classifier, boolean optional, T impl) {
+    ArtifactSpec(VersionKind kind, String groupId, String artifactId, String versionSpec, String type, String classifier, boolean optional, FileObject localFile, T impl) {

Review Comment:
   Yes.



-- 
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: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

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


[GitHub] [netbeans] sdedic merged pull request #4184: Maven / dependency query fixes.

Posted by GitBox <gi...@apache.org>.
sdedic merged PR #4184:
URL: https://github.com/apache/netbeans/pull/4184


-- 
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: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

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


[GitHub] [netbeans] ppisl commented on a diff in pull request #4184: Maven / dependency query fixes.

Posted by GitBox <gi...@apache.org>.
ppisl commented on code in PR #4184:
URL: https://github.com/apache/netbeans/pull/4184#discussion_r887733070


##########
ide/project.dependency/src/org/netbeans/modules/project/dependency/DependencyResult.java:
##########
@@ -45,8 +46,18 @@ public interface DependencyResult extends Lookup.Provider {
      */
     public Dependency getRoot();
     
+    /**
+     * Checks if the data is still valid
+     * @return true, if the data is valid
+     */
     public boolean isValid();
     
+    /**
+     * Returns artifacts that may be unavailable or erroneous.
+     * @return problem artifacts
+     */
+    public Collection<ArtifactSpec> getProblemArtifacts();
+    

Review Comment:
   So this artefacts are not part of the dependency tree?



##########
ide/project.dependency/src/org/netbeans/modules/project/dependency/ArtifactSpec.java:
##########
@@ -62,9 +63,10 @@ public enum VersionKind {
     private final String versionSpec;
     private final String classifier;
     private final boolean optional;
+    private final FileObject localFile;
     final T data;
 
-    ArtifactSpec(VersionKind kind, String groupId, String artifactId, String versionSpec, String type, String classifier, boolean optional, T impl) {
+    ArtifactSpec(VersionKind kind, String groupId, String artifactId, String versionSpec, String type, String classifier, boolean optional, FileObject localFile, T impl) {

Review Comment:
   Am I rihgt, when I expect that the localFile represnets the artefact file (jar for example)?



-- 
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: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

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


[GitHub] [netbeans] ebarboni commented on pull request #4184: Maven / dependency query fixes.

Posted by GitBox <gi...@apache.org>.
ebarboni commented on PR #4184:
URL: https://github.com/apache/netbeans/pull/4184#issuecomment-1143862103

   I see changes on file related to an issue I got so linking. 
   


-- 
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: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

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


[GitHub] [netbeans] sdedic commented on pull request #4184: Maven / dependency query fixes.

Posted by GitBox <gi...@apache.org>.
sdedic commented on PR #4184:
URL: https://github.com/apache/netbeans/pull/4184#issuecomment-1143868555

   @ebarboni Well, this PR does not really fix the issue; actually I am suffering from it as well. I hope I can steal some work time to trace it down - sometimes the execution passes the `isOffline` barriers inside maven. Despite about 4 hours testing / debugging through Maven, I don't still know what exactly breaks.


-- 
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: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

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