You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by "sdedic (via GitHub)" <gi...@apache.org> on 2023/04/06 08:50:40 UTC
[GitHub] [netbeans] sdedic opened a new pull request, #5781: Force refresh of live subprojects when parent recovers from broken.
sdedic opened a new pull request, #5781:
URL: https://github.com/apache/netbeans/pull/5781
Sometimes, a Maven subprojects fails to load completely - most notably on a fresh computer or when a multi-module project is opened for the first time, because:
- it does not use explicit plugin or dependency versions, relying on parent pom
- the parent pom itself does not specify the versions, but relies on BOM artifact
- the BOM artifact is not in the local repository.
In this situation, the parent POM parses and loads - and ProblemDetectors detect it needs to be 'primed'. But the subproject fails, as (from maven perspective) it does not contain "V" in GAVs of its dependencies and model builder fails with an exception - NetBeans creates a fallback project with "error:error:0" coordinates in this case.
As a result, sources in the broken subprojects remain full of errors, even after the parent pom primes (and primes all its maven modules incl. the subprojects). If NB IDE is closed and started again, POMs are evaluated again, this time (after priming) with BOM artifact and its dependencies (and versions) available and errors disappear - but the restart is required.
This PR adds code that, after the parent pom recovers from broken state (is reloaded, and is not a fallback), forces reload of dependent projects, if they are still cached. This gives dependent projects a change to be parsed, now with versions available (after the priming build).
This is rather a hotfix as NBLS for vscode is released shortly. Later, I would like to replace the dummy placeholder with a partially loaded project which is available in the thrown exception - but it needs thorough testing as code that was used to get 'all or dummy' would now receive half-populated model.
Even the re-parsing could be more precise, subprojects would register on their declared parent POM so they refresh when the parent pom reloads. But at the moment, the placeholder project simply does not have parent POM data in its model, so this is left for the future to fix.
--
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 #5781: Force refresh of live subprojects when parent recovers from broken.
Posted by "sdedic (via GitHub)" <gi...@apache.org>.
sdedic commented on code in PR #5781:
URL: https://github.com/apache/netbeans/pull/5781#discussion_r1159768572
##########
java/maven/src/org/netbeans/modules/maven/modelcache/MavenProjectCache.java:
##########
@@ -350,6 +359,44 @@ private static boolean isLifecycleParticipatnIgnored(AbstractMavenLifecycleParti
}
return newproject;
}
+
+ private static final String CONTEXT_PARTIAL_PROJECT = "org.netbeans.modules.maven.partialProject"; // NOI18N
+ private static final String CONTEXT_FALLBACK_PROJECT = "org.netbeans.modules.maven.fallbackProject"; // NOI18N
+
+ /**
+ * Create a fallback project, but patch the incomplete project from the building result into it.
+ * The method will eventually start to return the partial project but still flagged as a fallback - see {@link #isFallbackproject(org.apache.maven.project.MavenProject)}.
+ *
+ * @param result the maven execution / project building result.
+ * @param projectFile the project file.
+ * @return fallback project
+ * @throws AssertionError
+ */
+ public static MavenProject getFallbackProject(MavenExecutionResult result, File projectFile) throws AssertionError {
+ MavenProject toReturn = getFallbackProject(projectFile);
+ if (result == null) {
+ return toReturn;
+ }
+ MavenProject partial = null;
+
+ for (Throwable t : result.getExceptions()) {
Review Comment:
I wonder how should I change library class.
--
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 #5781: Force refresh of live subprojects when parent recovers from broken.
Posted by "sdedic (via GitHub)" <gi...@apache.org>.
sdedic commented on code in PR #5781:
URL: https://github.com/apache/netbeans/pull/5781#discussion_r1159527188
##########
java/maven/src/org/netbeans/modules/maven/NbMavenProjectImpl.java:
##########
@@ -552,6 +555,50 @@ public RequestProcessor.Task fireProjectReload() {
}
return reloadTask;
}
+
+ private void reloadPossibleBrokenModules(MavenProject preceding, MavenProject p) {
+ // restrict to just poms that were marked as broken/incomplete.
+ if (!(MavenProjectCache.isFallbackproject(preceding) ||
+ preceding.getContextValue("org.netbeans.modules.maven.problems.primingNotDone") != Boolean.TRUE)) {
+ return;
+ }
+ // but do not cascade from projects, which are themselves broken.
+ if (MavenProjectCache.isFallbackproject(p)) {
+ return;
+ }
+ File basePOMFile = p.getFile().getParentFile();
+ for (String modName : p.getModules()) {
+ File modPom = new File(new File(basePOMFile, modName), "pom.xml");
+ if (!modPom.exists() && modPom.isFile()) {
+ LOG.log(Level.FINE, "POM file {0} for module {1} does not exist", new Object[] { modPom, modName });
+ continue;
+ }
+ MavenProject child = MavenProjectCache.getMavenProject(modPom, true, false);
+ // the project may have more problems, more subtle, but now repair just total breakage
+ if (!MavenProjectCache.isFallbackproject(child)) {
Review Comment:
Thanks! Fixed in e0159d8f0f86
--
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] lbownik commented on a diff in pull request #5781: Force refresh of live subprojects when parent recovers from broken.
Posted by "lbownik (via GitHub)" <gi...@apache.org>.
lbownik commented on code in PR #5781:
URL: https://github.com/apache/netbeans/pull/5781#discussion_r1159556946
##########
java/maven/src/org/netbeans/modules/maven/modelcache/MavenProjectCache.java:
##########
@@ -350,6 +359,44 @@ private static boolean isLifecycleParticipatnIgnored(AbstractMavenLifecycleParti
}
return newproject;
}
+
+ private static final String CONTEXT_PARTIAL_PROJECT = "org.netbeans.modules.maven.partialProject"; // NOI18N
+ private static final String CONTEXT_FALLBACK_PROJECT = "org.netbeans.modules.maven.fallbackProject"; // NOI18N
+
+ /**
+ * Create a fallback project, but patch the incomplete project from the building result into it.
+ * The method will eventually start to return the partial project but still flagged as a fallback - see {@link #isFallbackproject(org.apache.maven.project.MavenProject)}.
+ *
+ * @param result the maven execution / project building result.
+ * @param projectFile the project file.
+ * @return fallback project
+ * @throws AssertionError
+ */
+ public static MavenProject getFallbackProject(MavenExecutionResult result, File projectFile) throws AssertionError {
+ MavenProject toReturn = getFallbackProject(projectFile);
+ if (result == null) {
+ return toReturn;
Review Comment:
this is strange tactics. shouldn't this
if (result == null)
be executed by a call site and then
getFallbackProject(MavenExecutionResult result, File projectFile)
be called only when result is not nulll ??
withi this approach short circuit approach methods mean "meybeExecuteSomething" :/
--
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 #5781: Force refresh of live subprojects when parent recovers from broken.
Posted by "sdedic (via GitHub)" <gi...@apache.org>.
sdedic commented on code in PR #5781:
URL: https://github.com/apache/netbeans/pull/5781#discussion_r1159764742
##########
java/maven/src/org/netbeans/modules/maven/modelcache/MavenProjectCache.java:
##########
@@ -364,11 +411,16 @@ public static MavenProject getFallbackProject(File projectFile) throws Assertion
newproject.setName(Bundle.LBL_Incomplete_Project_Name());
newproject.setDescription(Bundle.LBL_Incomplete_Project_Desc());
newproject.setFile(projectFile);
+ newproject.setContextValue(CONTEXT_FALLBACK_PROJECT, true);
return newproject;
}
public static boolean isFallbackproject(MavenProject prj) {
- return "error".equals(prj.getGroupId()) && "error".equals(prj.getArtifactId()) && Bundle.LBL_Incomplete_Project_Name().equals(prj.getName());
+ if ("error".equals(prj.getGroupId()) && "error".equals(prj.getArtifactId()) && Bundle.LBL_Incomplete_Project_Name().equals(prj.getName())) {
Review Comment:
`org.apache.maven.project.MavenProject` is not part of NetBeans project. I need some utility place to put this helper in; maybe the cache is not the best place -- will solve in subsequent PR with 'more appropriate fix' described at the top.
--
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 #5781: Force refresh of live subprojects when parent recovers from broken.
Posted by "sdedic (via GitHub)" <gi...@apache.org>.
sdedic commented on code in PR #5781:
URL: https://github.com/apache/netbeans/pull/5781#discussion_r1159762426
##########
java/maven/src/org/netbeans/modules/maven/NbMavenProjectImpl.java:
##########
@@ -552,6 +555,53 @@ public RequestProcessor.Task fireProjectReload() {
}
return reloadTask;
}
+
+ private void reloadPossibleBrokenModules(MavenProject preceding, MavenProject p) {
+ // restrict to just poms that were marked as broken/incomplete.
+ if (!(MavenProjectCache.isFallbackproject(preceding) ||
+ preceding.getContextValue("org.netbeans.modules.maven.problems.primingNotDone") != Boolean.TRUE)) {
+ return;
+ }
+ // but do not cascade from projects, which are themselves broken.
+ if (MavenProjectCache.isFallbackproject(p)) {
+ return;
+ }
+ File basePOMFile = p.getFile().getParentFile();
+ for (String modName : p.getModules()) {
+ File modPom = new File(new File(basePOMFile, modName), "pom.xml");
+ if (!modPom.exists() && modPom.isFile()) {
+ LOG.log(Level.FINE, "POM file {0} for module {1} does not exist", new Object[] { modPom, modName });
+ continue;
+ }
+ MavenProject child = MavenProjectCache.getMavenProject(modPom, true, false);
+ if (child == null) {
+ continue;
+ }
+ // the project may have more problems, more subtle, but now repair just total breakage
+ if (!MavenProjectCache.isFallbackproject(child)) {
+ LOG.log(Level.FINE, "Project for module {0} is not a fallback, skipping", modName);
Review Comment:
Unit tests are fine, but when you try to analyse some weird behaviour either with timing dependency or on-site (e.g. on colleague's computer, or in the datacenter), logs are **very** useful.
--
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 #5781: Force refresh of live subprojects when parent recovers from broken.
Posted by "sdedic (via GitHub)" <gi...@apache.org>.
sdedic commented on code in PR #5781:
URL: https://github.com/apache/netbeans/pull/5781#discussion_r1159767373
##########
java/maven/src/org/netbeans/modules/maven/NbMavenProjectImpl.java:
##########
@@ -552,6 +555,53 @@ public RequestProcessor.Task fireProjectReload() {
}
return reloadTask;
}
+
+ private void reloadPossibleBrokenModules(MavenProject preceding, MavenProject p) {
+ // restrict to just poms that were marked as broken/incomplete.
+ if (!(MavenProjectCache.isFallbackproject(preceding) ||
+ preceding.getContextValue("org.netbeans.modules.maven.problems.primingNotDone") != Boolean.TRUE)) {
+ return;
+ }
+ // but do not cascade from projects, which are themselves broken.
+ if (MavenProjectCache.isFallbackproject(p)) {
+ return;
+ }
+ File basePOMFile = p.getFile().getParentFile();
+ for (String modName : p.getModules()) {
+ File modPom = new File(new File(basePOMFile, modName), "pom.xml");
+ if (!modPom.exists() && modPom.isFile()) {
+ LOG.log(Level.FINE, "POM file {0} for module {1} does not exist", new Object[] { modPom, modName });
+ continue;
+ }
+ MavenProject child = MavenProjectCache.getMavenProject(modPom, true, false);
+ if (child == null) {
+ continue;
+ }
+ // the project may have more problems, more subtle, but now repair just total breakage
+ if (!MavenProjectCache.isFallbackproject(child)) {
+ LOG.log(Level.FINE, "Project for module {0} is not a fallback, skipping", modName);
+ }
+ FileObject dir = FileUtil.toFileObject(modPom.getParentFile());
+ if (dir == null) {
+ LOG.log(Level.FINE, "Project directory for {0} is not a FileObject", modName);
+ continue;
+ }
+ Project c;
+ try {
+ c = ProjectManager.getDefault().findProject(dir);
+ if (c == null) {
+ LOG.log(Level.FINE, "Module {0} is not a project", modName);
+ }
+ } catch (IOException ex) {
+ LOG.log(Level.FINE, "Error getting module project {0} is not a project", modName);
+ LOG.log(Level.FINE, "Exception was: ", ex);
+ continue;
+ }
+ LOG.log(Level.INFO, "Recovering module {0}, pomfile {1}", new Object[] { modName, modPom });
Review Comment:
Is there a vararg variant of `log` method ?
--
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] lbownik commented on a diff in pull request #5781: Force refresh of live subprojects when parent recovers from broken.
Posted by "lbownik (via GitHub)" <gi...@apache.org>.
lbownik commented on code in PR #5781:
URL: https://github.com/apache/netbeans/pull/5781#discussion_r1159558529
##########
java/maven/src/org/netbeans/modules/maven/modelcache/MavenProjectCache.java:
##########
@@ -350,6 +359,44 @@ private static boolean isLifecycleParticipatnIgnored(AbstractMavenLifecycleParti
}
return newproject;
}
+
+ private static final String CONTEXT_PARTIAL_PROJECT = "org.netbeans.modules.maven.partialProject"; // NOI18N
+ private static final String CONTEXT_FALLBACK_PROJECT = "org.netbeans.modules.maven.fallbackProject"; // NOI18N
+
+ /**
+ * Create a fallback project, but patch the incomplete project from the building result into it.
+ * The method will eventually start to return the partial project but still flagged as a fallback - see {@link #isFallbackproject(org.apache.maven.project.MavenProject)}.
+ *
+ * @param result the maven execution / project building result.
+ * @param projectFile the project file.
+ * @return fallback project
+ * @throws AssertionError
+ */
+ public static MavenProject getFallbackProject(MavenExecutionResult result, File projectFile) throws AssertionError {
+ MavenProject toReturn = getFallbackProject(projectFile);
+ if (result == null) {
+ return toReturn;
+ }
+ MavenProject partial = null;
+
+ for (Throwable t : result.getExceptions()) {
Review Comment:
I wonder if lines 383 to 392 would fit better into MavenExecutionResult class ....
--
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] dbalek commented on a diff in pull request #5781: Force refresh of live subprojects when parent recovers from broken.
Posted by "dbalek (via GitHub)" <gi...@apache.org>.
dbalek commented on code in PR #5781:
URL: https://github.com/apache/netbeans/pull/5781#discussion_r1159521322
##########
java/maven/src/org/netbeans/modules/maven/NbMavenProjectImpl.java:
##########
@@ -552,6 +555,50 @@ public RequestProcessor.Task fireProjectReload() {
}
return reloadTask;
}
+
+ private void reloadPossibleBrokenModules(MavenProject preceding, MavenProject p) {
+ // restrict to just poms that were marked as broken/incomplete.
+ if (!(MavenProjectCache.isFallbackproject(preceding) ||
+ preceding.getContextValue("org.netbeans.modules.maven.problems.primingNotDone") != Boolean.TRUE)) {
+ return;
+ }
+ // but do not cascade from projects, which are themselves broken.
+ if (MavenProjectCache.isFallbackproject(p)) {
+ return;
+ }
+ File basePOMFile = p.getFile().getParentFile();
+ for (String modName : p.getModules()) {
+ File modPom = new File(new File(basePOMFile, modName), "pom.xml");
+ if (!modPom.exists() && modPom.isFile()) {
+ LOG.log(Level.FINE, "POM file {0} for module {1} does not exist", new Object[] { modPom, modName });
+ continue;
+ }
+ MavenProject child = MavenProjectCache.getMavenProject(modPom, true, false);
+ // the project may have more problems, more subtle, but now repair just total breakage
+ if (!MavenProjectCache.isFallbackproject(child)) {
Review Comment:
A possible NPE when `child` obtained from `MavenProjectCache.getMavenProject(modPom, true, false)` is `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] lbownik commented on a diff in pull request #5781: Force refresh of live subprojects when parent recovers from broken.
Posted by "lbownik (via GitHub)" <gi...@apache.org>.
lbownik commented on code in PR #5781:
URL: https://github.com/apache/netbeans/pull/5781#discussion_r1159579300
##########
java/maven/src/org/netbeans/modules/maven/NbMavenProjectImpl.java:
##########
@@ -552,6 +555,53 @@ public RequestProcessor.Task fireProjectReload() {
}
return reloadTask;
}
+
+ private void reloadPossibleBrokenModules(MavenProject preceding, MavenProject p) {
+ // restrict to just poms that were marked as broken/incomplete.
+ if (!(MavenProjectCache.isFallbackproject(preceding) ||
+ preceding.getContextValue("org.netbeans.modules.maven.problems.primingNotDone") != Boolean.TRUE)) {
+ return;
+ }
+ // but do not cascade from projects, which are themselves broken.
+ if (MavenProjectCache.isFallbackproject(p)) {
+ return;
+ }
+ File basePOMFile = p.getFile().getParentFile();
+ for (String modName : p.getModules()) {
+ File modPom = new File(new File(basePOMFile, modName), "pom.xml");
+ if (!modPom.exists() && modPom.isFile()) {
+ LOG.log(Level.FINE, "POM file {0} for module {1} does not exist", new Object[] { modPom, modName });
+ continue;
+ }
+ MavenProject child = MavenProjectCache.getMavenProject(modPom, true, false);
+ if (child == null) {
+ continue;
+ }
+ // the project may have more problems, more subtle, but now repair just total breakage
+ if (!MavenProjectCache.isFallbackproject(child)) {
+ LOG.log(Level.FINE, "Project for module {0} is not a fallback, skipping", modName);
+ }
+ FileObject dir = FileUtil.toFileObject(modPom.getParentFile());
+ if (dir == null) {
+ LOG.log(Level.FINE, "Project directory for {0} is not a FileObject", modName);
+ continue;
+ }
+ Project c;
+ try {
+ c = ProjectManager.getDefault().findProject(dir);
+ if (c == null) {
+ LOG.log(Level.FINE, "Module {0} is not a project", modName);
+ }
+ } catch (IOException ex) {
+ LOG.log(Level.FINE, "Error getting module project {0} is not a project", modName);
+ LOG.log(Level.FINE, "Exception was: ", ex);
+ continue;
+ }
+ LOG.log(Level.INFO, "Recovering module {0}, pomfile {1}", new Object[] { modName, modPom });
Review Comment:
can these three lines be moved into try block so that line
Procejct c;
can be removed?
--
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 #5781: Force refresh of live subprojects when parent recovers from broken.
Posted by "sdedic (via GitHub)" <gi...@apache.org>.
sdedic merged PR #5781:
URL: https://github.com/apache/netbeans/pull/5781
--
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] lbownik commented on a diff in pull request #5781: Force refresh of live subprojects when parent recovers from broken.
Posted by "lbownik (via GitHub)" <gi...@apache.org>.
lbownik commented on code in PR #5781:
URL: https://github.com/apache/netbeans/pull/5781#discussion_r1159566560
##########
java/maven/src/org/netbeans/modules/maven/modelcache/MavenProjectCache.java:
##########
@@ -112,6 +118,9 @@ public MavenProject run() {
return mp;
}
}
+ if (doNotLoadReturnNull) {
Review Comment:
this is evil ;)
wouldnt two seperate methods with descriptive names be better: one which loads project and another which tries to load it or somethig?
--
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 #5781: Force refresh of live subprojects when parent recovers from broken.
Posted by "sdedic (via GitHub)" <gi...@apache.org>.
sdedic commented on code in PR #5781:
URL: https://github.com/apache/netbeans/pull/5781#discussion_r1159781729
##########
java/maven/src/org/netbeans/modules/maven/NbMavenProjectImpl.java:
##########
@@ -552,6 +555,53 @@ public RequestProcessor.Task fireProjectReload() {
}
return reloadTask;
}
+
+ private void reloadPossibleBrokenModules(MavenProject preceding, MavenProject p) {
+ // restrict to just poms that were marked as broken/incomplete.
+ if (!(MavenProjectCache.isFallbackproject(preceding) ||
+ preceding.getContextValue("org.netbeans.modules.maven.problems.primingNotDone") != Boolean.TRUE)) {
+ return;
+ }
+ // but do not cascade from projects, which are themselves broken.
+ if (MavenProjectCache.isFallbackproject(p)) {
+ return;
+ }
+ File basePOMFile = p.getFile().getParentFile();
+ for (String modName : p.getModules()) {
+ File modPom = new File(new File(basePOMFile, modName), "pom.xml");
+ if (!modPom.exists() && modPom.isFile()) {
+ LOG.log(Level.FINE, "POM file {0} for module {1} does not exist", new Object[] { modPom, modName });
+ continue;
+ }
+ MavenProject child = MavenProjectCache.getMavenProject(modPom, true, false);
+ if (child == null) {
+ continue;
+ }
+ // the project may have more problems, more subtle, but now repair just total breakage
+ if (!MavenProjectCache.isFallbackproject(child)) {
+ LOG.log(Level.FINE, "Project for module {0} is not a fallback, skipping", modName);
+ }
+ FileObject dir = FileUtil.toFileObject(modPom.getParentFile());
Review Comment:
in theory, `FileUtil.toFileObject` could refuse to convert a File. Shouldn't be the case if `modPom.exists()`, but still.
--
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] lbownik commented on a diff in pull request #5781: Force refresh of live subprojects when parent recovers from broken.
Posted by "lbownik (via GitHub)" <gi...@apache.org>.
lbownik commented on code in PR #5781:
URL: https://github.com/apache/netbeans/pull/5781#discussion_r1159570808
##########
java/maven/src/org/netbeans/modules/maven/NbMavenProjectImpl.java:
##########
@@ -552,6 +555,53 @@ public RequestProcessor.Task fireProjectReload() {
}
return reloadTask;
}
+
+ private void reloadPossibleBrokenModules(MavenProject preceding, MavenProject p) {
+ // restrict to just poms that were marked as broken/incomplete.
+ if (!(MavenProjectCache.isFallbackproject(preceding) ||
+ preceding.getContextValue("org.netbeans.modules.maven.problems.primingNotDone") != Boolean.TRUE)) {
+ return;
+ }
+ // but do not cascade from projects, which are themselves broken.
+ if (MavenProjectCache.isFallbackproject(p)) {
+ return;
+ }
+ File basePOMFile = p.getFile().getParentFile();
+ for (String modName : p.getModules()) {
+ File modPom = new File(new File(basePOMFile, modName), "pom.xml");
+ if (!modPom.exists() && modPom.isFile()) {
Review Comment:
if file does NOT exist AND it IS a file ???????
--
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] lbownik commented on a diff in pull request #5781: Force refresh of live subprojects when parent recovers from broken.
Posted by "lbownik (via GitHub)" <gi...@apache.org>.
lbownik commented on code in PR #5781:
URL: https://github.com/apache/netbeans/pull/5781#discussion_r1159776544
##########
java/maven/src/org/netbeans/modules/maven/modelcache/MavenProjectCache.java:
##########
@@ -350,6 +359,44 @@ private static boolean isLifecycleParticipatnIgnored(AbstractMavenLifecycleParti
}
return newproject;
}
+
+ private static final String CONTEXT_PARTIAL_PROJECT = "org.netbeans.modules.maven.partialProject"; // NOI18N
+ private static final String CONTEXT_FALLBACK_PROJECT = "org.netbeans.modules.maven.fallbackProject"; // NOI18N
+
+ /**
+ * Create a fallback project, but patch the incomplete project from the building result into it.
+ * The method will eventually start to return the partial project but still flagged as a fallback - see {@link #isFallbackproject(org.apache.maven.project.MavenProject)}.
+ *
+ * @param result the maven execution / project building result.
+ * @param projectFile the project file.
+ * @return fallback project
+ * @throws AssertionError
+ */
+ public static MavenProject getFallbackProject(MavenExecutionResult result, File projectFile) throws AssertionError {
+ MavenProject toReturn = getFallbackProject(projectFile);
+ if (result == null) {
+ return toReturn;
+ }
+ MavenProject partial = null;
+
+ for (Throwable t : result.getExceptions()) {
Review Comment:
oh . sorry .. haven't noticed that - sure, you're right
--
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] lbownik commented on a diff in pull request #5781: Force refresh of live subprojects when parent recovers from broken.
Posted by "lbownik (via GitHub)" <gi...@apache.org>.
lbownik commented on code in PR #5781:
URL: https://github.com/apache/netbeans/pull/5781#discussion_r1159784026
##########
java/maven/src/org/netbeans/modules/maven/modelcache/MavenProjectCache.java:
##########
@@ -350,6 +359,44 @@ private static boolean isLifecycleParticipatnIgnored(AbstractMavenLifecycleParti
}
return newproject;
}
+
+ private static final String CONTEXT_PARTIAL_PROJECT = "org.netbeans.modules.maven.partialProject"; // NOI18N
+ private static final String CONTEXT_FALLBACK_PROJECT = "org.netbeans.modules.maven.fallbackProject"; // NOI18N
+
+ /**
+ * Create a fallback project, but patch the incomplete project from the building result into it.
+ * The method will eventually start to return the partial project but still flagged as a fallback - see {@link #isFallbackproject(org.apache.maven.project.MavenProject)}.
+ *
+ * @param result the maven execution / project building result.
+ * @param projectFile the project file.
+ * @return fallback project
+ * @throws AssertionError
+ */
+ public static MavenProject getFallbackProject(MavenExecutionResult result, File projectFile) throws AssertionError {
+ MavenProject toReturn = getFallbackProject(projectFile);
+ if (result == null) {
+ return toReturn;
+ }
+ MavenProject partial = null;
+
+ for (Throwable t : result.getExceptions()) {
Review Comment:
by the way, I whish Java had extention methods like C#.
It would be possible to write more elegant code.
--
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] lbownik commented on a diff in pull request #5781: Force refresh of live subprojects when parent recovers from broken.
Posted by "lbownik (via GitHub)" <gi...@apache.org>.
lbownik commented on code in PR #5781:
URL: https://github.com/apache/netbeans/pull/5781#discussion_r1159560282
##########
java/maven/src/org/netbeans/modules/maven/NbMavenProjectImpl.java:
##########
@@ -552,6 +555,53 @@ public RequestProcessor.Task fireProjectReload() {
}
return reloadTask;
}
+
+ private void reloadPossibleBrokenModules(MavenProject preceding, MavenProject p) {
+ // restrict to just poms that were marked as broken/incomplete.
+ if (!(MavenProjectCache.isFallbackproject(preceding) ||
+ preceding.getContextValue("org.netbeans.modules.maven.problems.primingNotDone") != Boolean.TRUE)) {
+ return;
+ }
+ // but do not cascade from projects, which are themselves broken.
+ if (MavenProjectCache.isFallbackproject(p)) {
+ return;
+ }
+ File basePOMFile = p.getFile().getParentFile();
+ for (String modName : p.getModules()) {
+ File modPom = new File(new File(basePOMFile, modName), "pom.xml");
+ if (!modPom.exists() && modPom.isFile()) {
+ LOG.log(Level.FINE, "POM file {0} for module {1} does not exist", new Object[] { modPom, modName });
+ continue;
+ }
+ MavenProject child = MavenProjectCache.getMavenProject(modPom, true, false);
+ if (child == null) {
+ continue;
+ }
+ // the project may have more problems, more subtle, but now repair just total breakage
+ if (!MavenProjectCache.isFallbackproject(child)) {
+ LOG.log(Level.FINE, "Project for module {0} is not a fallback, skipping", modName);
Review Comment:
kind of exceffive loggin from here onwards? can't it be unit tested to make sure it works so thet log statements become redundant?
--
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] lbownik commented on a diff in pull request #5781: Force refresh of live subprojects when parent recovers from broken.
Posted by "lbownik (via GitHub)" <gi...@apache.org>.
lbownik commented on code in PR #5781:
URL: https://github.com/apache/netbeans/pull/5781#discussion_r1159576746
##########
java/maven/src/org/netbeans/modules/maven/NbMavenProjectImpl.java:
##########
@@ -552,6 +555,53 @@ public RequestProcessor.Task fireProjectReload() {
}
return reloadTask;
}
+
+ private void reloadPossibleBrokenModules(MavenProject preceding, MavenProject p) {
+ // restrict to just poms that were marked as broken/incomplete.
+ if (!(MavenProjectCache.isFallbackproject(preceding) ||
+ preceding.getContextValue("org.netbeans.modules.maven.problems.primingNotDone") != Boolean.TRUE)) {
+ return;
+ }
+ // but do not cascade from projects, which are themselves broken.
+ if (MavenProjectCache.isFallbackproject(p)) {
+ return;
+ }
+ File basePOMFile = p.getFile().getParentFile();
+ for (String modName : p.getModules()) {
+ File modPom = new File(new File(basePOMFile, modName), "pom.xml");
+ if (!modPom.exists() && modPom.isFile()) {
+ LOG.log(Level.FINE, "POM file {0} for module {1} does not exist", new Object[] { modPom, modName });
+ continue;
+ }
+ MavenProject child = MavenProjectCache.getMavenProject(modPom, true, false);
+ if (child == null) {
+ continue;
+ }
+ // the project may have more problems, more subtle, but now repair just total breakage
+ if (!MavenProjectCache.isFallbackproject(child)) {
+ LOG.log(Level.FINE, "Project for module {0} is not a fallback, skipping", modName);
+ }
+ FileObject dir = FileUtil.toFileObject(modPom.getParentFile());
Review Comment:
dir seems unused except checking for null, can't this decition be made based on result of modPom.getParentFile() ??
--
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 #5781: Force refresh of live subprojects when parent recovers from broken.
Posted by "sdedic (via GitHub)" <gi...@apache.org>.
sdedic commented on code in PR #5781:
URL: https://github.com/apache/netbeans/pull/5781#discussion_r1159785743
##########
java/maven/src/org/netbeans/modules/maven/NbMavenProjectImpl.java:
##########
@@ -552,6 +555,53 @@ public RequestProcessor.Task fireProjectReload() {
}
return reloadTask;
}
+
+ private void reloadPossibleBrokenModules(MavenProject preceding, MavenProject p) {
+ // restrict to just poms that were marked as broken/incomplete.
+ if (!(MavenProjectCache.isFallbackproject(preceding) ||
+ preceding.getContextValue("org.netbeans.modules.maven.problems.primingNotDone") != Boolean.TRUE)) {
+ return;
+ }
+ // but do not cascade from projects, which are themselves broken.
+ if (MavenProjectCache.isFallbackproject(p)) {
+ return;
+ }
+ File basePOMFile = p.getFile().getParentFile();
+ for (String modName : p.getModules()) {
+ File modPom = new File(new File(basePOMFile, modName), "pom.xml");
+ if (!modPom.exists() && modPom.isFile()) {
+ LOG.log(Level.FINE, "POM file {0} for module {1} does not exist", new Object[] { modPom, modName });
+ continue;
+ }
+ MavenProject child = MavenProjectCache.getMavenProject(modPom, true, false);
+ if (child == null) {
+ continue;
+ }
+ // the project may have more problems, more subtle, but now repair just total breakage
+ if (!MavenProjectCache.isFallbackproject(child)) {
+ LOG.log(Level.FINE, "Project for module {0} is not a fallback, skipping", modName);
+ }
+ FileObject dir = FileUtil.toFileObject(modPom.getParentFile());
+ if (dir == null) {
+ LOG.log(Level.FINE, "Project directory for {0} is not a FileObject", modName);
+ continue;
+ }
+ Project c;
+ try {
+ c = ProjectManager.getDefault().findProject(dir);
+ if (c == null) {
+ LOG.log(Level.FINE, "Module {0} is not a project", modName);
+ }
+ } catch (IOException ex) {
+ LOG.log(Level.FINE, "Error getting module project {0} is not a project", modName);
+ LOG.log(Level.FINE, "Exception was: ", ex);
+ continue;
+ }
+ LOG.log(Level.INFO, "Recovering module {0}, pomfile {1}", new Object[] { modName, modPom });
Review Comment:
addressed in 826d27d313cc
##########
java/maven/src/org/netbeans/modules/maven/NbMavenProjectImpl.java:
##########
@@ -552,6 +555,53 @@ public RequestProcessor.Task fireProjectReload() {
}
return reloadTask;
}
+
+ private void reloadPossibleBrokenModules(MavenProject preceding, MavenProject p) {
+ // restrict to just poms that were marked as broken/incomplete.
+ if (!(MavenProjectCache.isFallbackproject(preceding) ||
+ preceding.getContextValue("org.netbeans.modules.maven.problems.primingNotDone") != Boolean.TRUE)) {
+ return;
+ }
+ // but do not cascade from projects, which are themselves broken.
+ if (MavenProjectCache.isFallbackproject(p)) {
+ return;
+ }
+ File basePOMFile = p.getFile().getParentFile();
+ for (String modName : p.getModules()) {
+ File modPom = new File(new File(basePOMFile, modName), "pom.xml");
+ if (!modPom.exists() && modPom.isFile()) {
Review Comment:
addressed in 826d27d313cc
--
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] lbownik commented on a diff in pull request #5781: Force refresh of live subprojects when parent recovers from broken.
Posted by "lbownik (via GitHub)" <gi...@apache.org>.
lbownik commented on code in PR #5781:
URL: https://github.com/apache/netbeans/pull/5781#discussion_r1159567673
##########
java/maven/src/org/netbeans/modules/maven/modelcache/MavenProjectCache.java:
##########
@@ -364,11 +411,16 @@ public static MavenProject getFallbackProject(File projectFile) throws Assertion
newproject.setName(Bundle.LBL_Incomplete_Project_Name());
newproject.setDescription(Bundle.LBL_Incomplete_Project_Desc());
newproject.setFile(projectFile);
+ newproject.setContextValue(CONTEXT_FALLBACK_PROJECT, true);
return newproject;
}
public static boolean isFallbackproject(MavenProject prj) {
- return "error".equals(prj.getGroupId()) && "error".equals(prj.getArtifactId()) && Bundle.LBL_Incomplete_Project_Name().equals(prj.getName());
+ if ("error".equals(prj.getGroupId()) && "error".equals(prj.getArtifactId()) && Bundle.LBL_Incomplete_Project_Name().equals(prj.getName())) {
Review Comment:
whouldn't this method fit better into MavenProject class?
--
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 #5781: Force refresh of live subprojects when parent recovers from broken.
Posted by "sdedic (via GitHub)" <gi...@apache.org>.
sdedic commented on code in PR #5781:
URL: https://github.com/apache/netbeans/pull/5781#discussion_r1159768572
##########
java/maven/src/org/netbeans/modules/maven/modelcache/MavenProjectCache.java:
##########
@@ -350,6 +359,44 @@ private static boolean isLifecycleParticipatnIgnored(AbstractMavenLifecycleParti
}
return newproject;
}
+
+ private static final String CONTEXT_PARTIAL_PROJECT = "org.netbeans.modules.maven.partialProject"; // NOI18N
+ private static final String CONTEXT_FALLBACK_PROJECT = "org.netbeans.modules.maven.fallbackProject"; // NOI18N
+
+ /**
+ * Create a fallback project, but patch the incomplete project from the building result into it.
+ * The method will eventually start to return the partial project but still flagged as a fallback - see {@link #isFallbackproject(org.apache.maven.project.MavenProject)}.
+ *
+ * @param result the maven execution / project building result.
+ * @param projectFile the project file.
+ * @return fallback project
+ * @throws AssertionError
+ */
+ public static MavenProject getFallbackProject(MavenExecutionResult result, File projectFile) throws AssertionError {
+ MavenProject toReturn = getFallbackProject(projectFile);
+ if (result == null) {
+ return toReturn;
+ }
+ MavenProject partial = null;
+
+ for (Throwable t : result.getExceptions()) {
Review Comment:
I wonder how should I change a library class. You're free to make a PR against Maven project.
--
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] lbownik commented on a diff in pull request #5781: Force refresh of live subprojects when parent recovers from broken.
Posted by "lbownik (via GitHub)" <gi...@apache.org>.
lbownik commented on code in PR #5781:
URL: https://github.com/apache/netbeans/pull/5781#discussion_r1159579300
##########
java/maven/src/org/netbeans/modules/maven/NbMavenProjectImpl.java:
##########
@@ -552,6 +555,53 @@ public RequestProcessor.Task fireProjectReload() {
}
return reloadTask;
}
+
+ private void reloadPossibleBrokenModules(MavenProject preceding, MavenProject p) {
+ // restrict to just poms that were marked as broken/incomplete.
+ if (!(MavenProjectCache.isFallbackproject(preceding) ||
+ preceding.getContextValue("org.netbeans.modules.maven.problems.primingNotDone") != Boolean.TRUE)) {
+ return;
+ }
+ // but do not cascade from projects, which are themselves broken.
+ if (MavenProjectCache.isFallbackproject(p)) {
+ return;
+ }
+ File basePOMFile = p.getFile().getParentFile();
+ for (String modName : p.getModules()) {
+ File modPom = new File(new File(basePOMFile, modName), "pom.xml");
+ if (!modPom.exists() && modPom.isFile()) {
+ LOG.log(Level.FINE, "POM file {0} for module {1} does not exist", new Object[] { modPom, modName });
+ continue;
+ }
+ MavenProject child = MavenProjectCache.getMavenProject(modPom, true, false);
+ if (child == null) {
+ continue;
+ }
+ // the project may have more problems, more subtle, but now repair just total breakage
+ if (!MavenProjectCache.isFallbackproject(child)) {
+ LOG.log(Level.FINE, "Project for module {0} is not a fallback, skipping", modName);
+ }
+ FileObject dir = FileUtil.toFileObject(modPom.getParentFile());
+ if (dir == null) {
+ LOG.log(Level.FINE, "Project directory for {0} is not a FileObject", modName);
+ continue;
+ }
+ Project c;
+ try {
+ c = ProjectManager.getDefault().findProject(dir);
+ if (c == null) {
+ LOG.log(Level.FINE, "Module {0} is not a project", modName);
+ }
+ } catch (IOException ex) {
+ LOG.log(Level.FINE, "Error getting module project {0} is not a project", modName);
+ LOG.log(Level.FINE, "Exception was: ", ex);
+ continue;
+ }
+ LOG.log(Level.INFO, "Recovering module {0}, pomfile {1}", new Object[] { modName, modPom });
Review Comment:
can these three lines be moved into try block so that line
589: Procejct c;
can be removed?
then line
598: continue; can be removed as well
--
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] lbownik commented on a diff in pull request #5781: Force refresh of live subprojects when parent recovers from broken.
Posted by "lbownik (via GitHub)" <gi...@apache.org>.
lbownik commented on code in PR #5781:
URL: https://github.com/apache/netbeans/pull/5781#discussion_r1159780584
##########
java/maven/src/org/netbeans/modules/maven/NbMavenProjectImpl.java:
##########
@@ -552,6 +555,53 @@ public RequestProcessor.Task fireProjectReload() {
}
return reloadTask;
}
+
+ private void reloadPossibleBrokenModules(MavenProject preceding, MavenProject p) {
+ // restrict to just poms that were marked as broken/incomplete.
+ if (!(MavenProjectCache.isFallbackproject(preceding) ||
+ preceding.getContextValue("org.netbeans.modules.maven.problems.primingNotDone") != Boolean.TRUE)) {
+ return;
+ }
+ // but do not cascade from projects, which are themselves broken.
+ if (MavenProjectCache.isFallbackproject(p)) {
+ return;
+ }
+ File basePOMFile = p.getFile().getParentFile();
+ for (String modName : p.getModules()) {
+ File modPom = new File(new File(basePOMFile, modName), "pom.xml");
+ if (!modPom.exists() && modPom.isFile()) {
+ LOG.log(Level.FINE, "POM file {0} for module {1} does not exist", new Object[] { modPom, modName });
+ continue;
+ }
+ MavenProject child = MavenProjectCache.getMavenProject(modPom, true, false);
+ if (child == null) {
+ continue;
+ }
+ // the project may have more problems, more subtle, but now repair just total breakage
+ if (!MavenProjectCache.isFallbackproject(child)) {
+ LOG.log(Level.FINE, "Project for module {0} is not a fallback, skipping", modName);
+ }
+ FileObject dir = FileUtil.toFileObject(modPom.getParentFile());
+ if (dir == null) {
+ LOG.log(Level.FINE, "Project directory for {0} is not a FileObject", modName);
+ continue;
+ }
+ Project c;
+ try {
+ c = ProjectManager.getDefault().findProject(dir);
+ if (c == null) {
+ LOG.log(Level.FINE, "Module {0} is not a project", modName);
+ }
+ } catch (IOException ex) {
+ LOG.log(Level.FINE, "Error getting module project {0} is not a project", modName);
+ LOG.log(Level.FINE, "Exception was: ", ex);
+ continue;
+ }
+ LOG.log(Level.INFO, "Recovering module {0}, pomfile {1}", new Object[] { modName, modPom });
Review Comment:
you're right - there isn't
--
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] lbownik commented on a diff in pull request #5781: Force refresh of live subprojects when parent recovers from broken.
Posted by "lbownik (via GitHub)" <gi...@apache.org>.
lbownik commented on code in PR #5781:
URL: https://github.com/apache/netbeans/pull/5781#discussion_r1159777246
##########
java/maven/src/org/netbeans/modules/maven/modelcache/MavenProjectCache.java:
##########
@@ -364,11 +411,16 @@ public static MavenProject getFallbackProject(File projectFile) throws Assertion
newproject.setName(Bundle.LBL_Incomplete_Project_Name());
newproject.setDescription(Bundle.LBL_Incomplete_Project_Desc());
newproject.setFile(projectFile);
+ newproject.setContextValue(CONTEXT_FALLBACK_PROJECT, true);
return newproject;
}
public static boolean isFallbackproject(MavenProject prj) {
- return "error".equals(prj.getGroupId()) && "error".equals(prj.getArtifactId()) && Bundle.LBL_Incomplete_Project_Name().equals(prj.getName());
+ if ("error".equals(prj.getGroupId()) && "error".equals(prj.getArtifactId()) && Bundle.LBL_Incomplete_Project_Name().equals(prj.getName())) {
Review Comment:
sorry ... haven't noticed that - you're right
--
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] lbownik commented on a diff in pull request #5781: Force refresh of live subprojects when parent recovers from broken.
Posted by "lbownik (via GitHub)" <gi...@apache.org>.
lbownik commented on code in PR #5781:
URL: https://github.com/apache/netbeans/pull/5781#discussion_r1159581789
##########
java/maven/src/org/netbeans/modules/maven/NbMavenProjectImpl.java:
##########
@@ -552,6 +555,53 @@ public RequestProcessor.Task fireProjectReload() {
}
return reloadTask;
}
+
+ private void reloadPossibleBrokenModules(MavenProject preceding, MavenProject p) {
+ // restrict to just poms that were marked as broken/incomplete.
+ if (!(MavenProjectCache.isFallbackproject(preceding) ||
+ preceding.getContextValue("org.netbeans.modules.maven.problems.primingNotDone") != Boolean.TRUE)) {
+ return;
+ }
+ // but do not cascade from projects, which are themselves broken.
+ if (MavenProjectCache.isFallbackproject(p)) {
+ return;
+ }
+ File basePOMFile = p.getFile().getParentFile();
+ for (String modName : p.getModules()) {
+ File modPom = new File(new File(basePOMFile, modName), "pom.xml");
+ if (!modPom.exists() && modPom.isFile()) {
+ LOG.log(Level.FINE, "POM file {0} for module {1} does not exist", new Object[] { modPom, modName });
+ continue;
+ }
+ MavenProject child = MavenProjectCache.getMavenProject(modPom, true, false);
+ if (child == null) {
+ continue;
+ }
+ // the project may have more problems, more subtle, but now repair just total breakage
+ if (!MavenProjectCache.isFallbackproject(child)) {
+ LOG.log(Level.FINE, "Project for module {0} is not a fallback, skipping", modName);
+ }
+ FileObject dir = FileUtil.toFileObject(modPom.getParentFile());
+ if (dir == null) {
+ LOG.log(Level.FINE, "Project directory for {0} is not a FileObject", modName);
+ continue;
+ }
+ Project c;
+ try {
+ c = ProjectManager.getDefault().findProject(dir);
+ if (c == null) {
+ LOG.log(Level.FINE, "Module {0} is not a project", modName);
+ }
+ } catch (IOException ex) {
+ LOG.log(Level.FINE, "Error getting module project {0} is not a project", modName);
+ LOG.log(Level.FINE, "Exception was: ", ex);
+ continue;
+ }
+ LOG.log(Level.INFO, "Recovering module {0}, pomfile {1}", new Object[] { modName, modPom });
Review Comment:
wouldn't
LOG.log(Level.INFO, "Recovering module {0}, pomfile {1}", modName, modPom );
be more readable?
--
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] lbownik commented on a diff in pull request #5781: Force refresh of live subprojects when parent recovers from broken.
Posted by "lbownik (via GitHub)" <gi...@apache.org>.
lbownik commented on code in PR #5781:
URL: https://github.com/apache/netbeans/pull/5781#discussion_r1159566560
##########
java/maven/src/org/netbeans/modules/maven/modelcache/MavenProjectCache.java:
##########
@@ -112,6 +118,9 @@ public MavenProject run() {
return mp;
}
}
+ if (doNotLoadReturnNull) {
Review Comment:
whi is evil ;)
wouldnt two seperate methods with descriptive names be better: one which loads project and another which tries to load it or somethig?
--
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