Re: [maven] 01/01: [MNG-6213] Validate scope in dependencyManagement

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: [maven] 01/01: [MNG-6213] Validate scope in dependencyManagement

Enrico Olivelli
Il sab 29 dic 2018, 00:36 Michael Osipov <[hidden email]> ha scritto:

> Am 2018-12-29 um 00:20 schrieb Enrico Olivelli:
> > Il ven 28 dic 2018, 23:40 <[hidden email]> ha scritto:
> >
> >> This is an automated email from the ASF dual-hosted git repository.
> >>
> >> michaelo pushed a commit to branch MNG-6213
> >> in repository https://gitbox.apache.org/repos/asf/maven.git
> >>
> >> commit 859e344f4d5f7bfa00caf7343ea6554138e9dcf7
> >> Author: Michael Warnecke <[hidden email]>
> >> AuthorDate: Sat Sep 23 18:37:09 2017 +0200
> >>
> >>      [MNG-6213] Validate scope in dependencyManagement
> >>
> >>      This closes #131
> >> ---
> >>   .../model/validation/DefaultModelValidator.java    | 10 ++-
> >>   .../validation/DefaultModelValidatorTest.java      | 10 +++
> >>   .../validation/bad-dependency-management-scope.xml | 72
> >> ++++++++++++++++++++++
> >>   3 files changed, 90 insertions(+), 2 deletions(-)
> >>
> >> 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 1c84776..f58d03a 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
> >> @@ -105,13 +105,13 @@ public class DefaultModelValidator
> >>                                     + ", the parent element cannot have
> the
> >> same groupId:artifactId as the project.",
> >>                                 parent );
> >>               }
> >> -
> >> +
> >>               if ( equals( "LATEST", parent.getVersion() ) || equals(
> >> "RELEASE", parent.getVersion() ) )
> >>               {
> >>                   addViolation( problems, Severity.WARNING,
> Version.BASE,
> >> "parent.version", null,
> >>                                 "is either LATEST or RELEASE (both of
> them
> >> are being deprecated)", parent );
> >>               }
> >> -
> >> +
> >>           }
> >>
> >>           if ( request.getValidationLevel() >=
> >> ModelBuildingRequest.VALIDATION_LEVEL_MAVEN_2_0 )
> >> @@ -598,6 +598,12 @@ public class DefaultModelValidator
> >>
> >>                       validateEffectiveModelAgainstDependency( prefix,
> >> problems, m, d, request );
> >>                   }
> >> +                else
> >> +                {
> >> +                    validateEnum( prefix + "scope", problems,
> >> Severity.WARNING, Version.V20, d.getScope(),
> >> +                                  d.getManagementKey(), d, "provided",
> >> "compile", "runtime", "test", "system",
> >> +                                  "import" );
> >>
> >
> > Don't we have a constant for the list of available scopes?
>
> None which I am aware of. Watch carefully because regular deps don't
> have "import" scope.
>

Oh I see,
Thanks for your advice

Enrico

> --


-- Enrico Olivelli