You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Karl Heinz Marbaise <kh...@gmx.de> on 2016/07/30 19:12:35 UTC

Re: maven git commit: [MNG-6074] Maven should print a warning if no model version has been set in a POM file.

Hi,

If I test with this version the build will fail if I don't set the 
modelVersion (empty tag) or remove the entry completely...

~/ws-git/javaee (master *)$ 
~/tools/maven-test/apache-maven-3.4.0-SNAPSHOT/bin/mvn clean package
[INFO] Scanning for projects...
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[WARNING] 'modelVersion' is missing. @ line 3, column 17
[ERROR] 'modelVersion' is missing. @ line 3, column 17
  @
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR]   The project com.soebes.examples.j2ee:parent:1.1.2-SNAPSHOT 
(/Users/kama/ws-git/javaee/pom.xml) has 1 error
[ERROR]     'modelVersion' is missing. @ line 3, column 17
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the 
-e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, 
please read the following articles:
[ERROR] [Help 1] 
http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException

~/ws-git/javaee (master *)$ git di
diff --git a/pom.xml b/pom.xml
index 8b0e0c8..1761fb6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,6 +1,6 @@
  <project xmlns="http://maven.apache.org/POM/4.0.0" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd">

-  <modelVersion>4.0.0</modelVersion>
+  <modelVersion></modelVersion>

    <parent>
      <groupId>com.soebes.smpp</groupId>
~/ws-git/javaee (master *)$


I'm not sure if it would be better to fail the build as it is at the 
moment or only produce WARNING ?


Kind regards
Karl Heinz

On 7/30/16 9:02 PM, schulte@apache.org wrote:
> Repository: maven
> Updated Branches:
>   refs/heads/master 2e255c8e4 -> 45a04204f
>
>
> [MNG-6074] Maven should print a warning if no model version has been set in a POM file.
>
>
> Project: http://git-wip-us.apache.org/repos/asf/maven/repo
> Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/45a04204
> Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/45a04204
> Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/45a04204
>
> Branch: refs/heads/master
> Commit: 45a04204f720c9ed9c70c825fdb7834adb83852c
> Parents: 2e255c8
> Author: Christian Schulte <sc...@apache.org>
> Authored: Sat Jul 30 21:02:03 2016 +0200
> Committer: Christian Schulte <sc...@apache.org>
> Committed: Sat Jul 30 21:02:03 2016 +0200
>
> ----------------------------------------------------------------------
>  .../org/apache/maven/model/validation/DefaultModelValidator.java    | 1 +
>  1 file changed, 1 insertion(+)
> ----------------------------------------------------------------------
>
>
> http://git-wip-us.apache.org/repos/asf/maven/blob/45a04204/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java
> ----------------------------------------------------------------------
> diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java b/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java
> index 1d3a0f6..efe8895 100644
> --- a/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java
> +++ b/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java
> @@ -101,6 +101,7 @@ public class DefaultModelValidator
>          {
>              Severity errOn30 = getSeverity( request, ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_3_0 );
>
> +            validateStringNotEmpty( "modelVersion", problems, Severity.WARNING, Version.V20, m.getModelVersion(), m );
>              validateEnum( "modelVersion", problems, Severity.ERROR, Version.V20, m.getModelVersion(), null, m,
>                            "4.0.0" );
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: maven git commit: [MNG-6074] Maven should print a warning if no model version has been set in a POM file.

Posted by Christian Schulte <cs...@schulte.it>.
Am 07/31/16 um 12:10 schrieb Robert Scholte:
> Hi,
> 
> Really only warn??? Why?

I am all for error myself. I wanted to bump the validation severity
level in the 'maven-3.x-next' branch to
ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_3_1. So in some next 3.x
this would have become an error.

+1 for doing that in 3.4 already.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: maven git commit: [MNG-6074] Maven should print a warning if no model version has been set in a POM file.

Posted by Robert Scholte <rf...@apache.org>.
Hi,

Really only warn??? Why?
You can't assume there's always a namespace to verify. This value of this  
field is very important, especially if we start using a new modelversion.
I've started a patch on modello which relies on this field. It can read a  
pom-file once and detect if all elements match the specified version.

Robert

On Sat, 30 Jul 2016 21:14:11 +0200, Christian Schulte <cs...@schulte.it>  
wrote:

> Am 07/30/16 um 21:12 schrieb Karl Heinz Marbaise:
>> Hi,
>>
>> If I test with this version the build will fail if I don't set the
>> modelVersion (empty tag) or remove the entry completely...
>
> This wasn't intended. Will fix it. It should just warn about it. Thanks.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: maven git commit: [MNG-6074] Maven should print a warning if no model version has been set in a POM file.

Posted by Karl Heinz Marbaise <kh...@gmx.de>.
Hi Christian,

On 7/30/16 9:14 PM, Christian Schulte wrote:
> Am 07/30/16 um 21:12 schrieb Karl Heinz Marbaise:
>> Hi,
>>
>> If I test with this version the build will fail if I don't set the
>> modelVersion (empty tag) or remove the entry completely...
>
> This wasn't intended. Will fix it. It should just warn about it. Thanks.


I have tested with previous Maven versions and they fail as well...so I 
think there is no need to change this behaviour it could stay as it is..


Kind regards
Karl Heinz Marbaise


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: maven git commit: [MNG-6074] Maven should print a warning if no model version has been set in a POM file.

Posted by Christian Schulte <cs...@schulte.it>.
Am 07/30/16 um 21:12 schrieb Karl Heinz Marbaise:
> Hi,
> 
> If I test with this version the build will fail if I don't set the 
> modelVersion (empty tag) or remove the entry completely...

This wasn't intended. Will fix it. It should just warn about it. Thanks.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org