mbien commented on code in PR #7499:
URL: https://github.com/apache/netbeans/pull/7499#discussion_r1650527555
##########
java/maven/src/org/netbeans/modules/maven/queries/RepositoryMavenCPProvider.java:
##########
@@ -133,6 +141,16 @@ public ClassPath findClassPath(FileObject file, String
type) {
return null;
}
+ private boolean fromGradleMetadata(File pom) {
+ try {
+ String content = Files.readString(pom.toPath());
+ return content.contains("<!-- do_not_remove:
published-with-gradle-metadata -->"); //NOI18N
Review Comment:
I don't know how often this is called but:
this marker has to be right before the `<project ` tag which is always on
top of the file, no?
https://github.com/jjohannes/gradle-module-metadata-maven-plugin
For damage control this could read the file line by line and quit if the
line contains `<project ` or the marker.
Doing repeated IO in a classpath query because gradle gets creative with
poms isn't ideal.
(An additional mitigation would be to remember all paths which do not have
this marker in a concurrent hash set. It should be unlikely that a regular pom
suddenly becomes a generated pom within a session. It would leak but this is
probably not a problem given that the pom count should be low.)
--
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