You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2019/11/02 10:22:52 UTC

[GitHub] [maven] wilx commented on a change in pull request #298: [MNG-6797] - Remember if Maven model problems were encountered.

wilx commented on a change in pull request #298: [MNG-6797] - Remember if Maven model problems were encountered.
URL: https://github.com/apache/maven/pull/298#discussion_r341806075
 
 

 ##########
 File path: maven-core/src/main/java/org/apache/maven/execution/MavenSession.java
 ##########
 @@ -262,6 +264,18 @@ public void setParallel( boolean parallel )
         this.parallel = parallel;
     }
 
+    /**
+     * This indicates whether there were any problems detected when building Maven model.
+     * @return true if there were problems, false otherwise
+     */
+    public boolean isProblems() {
 
 Review comment:
   > As fas as I understand you want to memorize state. Can you provide an IT why this is necessary/benefit?
   
   IME as someone who maintains Maven projects, people often introduce issues like that and they do not care to fix them unless their build breaks. Remembering in MavenSession that there were problems with the Maven model will allow me to write Maven Enforcer plugin rule that will read that and will fail the build.
   
   > I also fail to see how problems are detected, you only changed the signature of the method.
   
   See `org.apache.maven.graph.DefaultGraphBuilder#collectProjects`. It prints the collected Maven model problems.
   
   > That really hurts because the plural implies that you have a collection of problem, and not a boolean value. Moreover, third person singular with a plural reads horribly.
   
   I am open to suggestions for better name. I have only propagated the `problems` variable name upwards. One thing, I would like to keep the `isX` or `getX` for the getter as that would allow me, I believe, to use something like this `ReflectionValueExtractor.evaluate("problems", session, false);` to retrieve it in the Enforce rule easily, I hope.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services