|
I agree, this would be extremely helpful. I have been using and popularizing Maven since many yeras. This week I am on some kind vacations so I decided to spend a day coding and contribute a little bit. I wanted to implement a "wildcard dependency exclusions feature" (MNG-3832). I have never browsed the Maven source code before, but after getting acquinted with the project structure, running and debugging it from eclipse I found the potential class to change. It was ExcludesArtifactFilter in the maven-artifact project. I wanted the modification to be self-contained thus I have only changed the ExcludesArtifactFilter class. I have also created a test case (ExcludesArtifactFilterTest) encompassing 21 unit tests which proves the correctnes of the implemented approach. I have extended the requested functionality a little bit. Right now, filter constructs literal java regular expression for every pattern which is contained by the list passed to the filter constructor. Include method matches given artifact against all patterns. Since it is an exlcusion filter - if artifact is matched at least once it will not be included. Filter defines "*" (star) as a wild-card character - a character that may be substituted for any other character(s). It is implemented in such a way, that every occurrence of a "*" (star) in the exclusion pattern is replaced with the ".*" expression during the construction of the literal java regex. Exclusion pattern can contain wild-card character zero or more times in any place in the groupId or artifactId; Patch file is included as an external file to this issue. Examples: DEFINITION: <exclusion> <groupId>*</groupId> </exclusion> SEMANTICS: All artifacts are excluded. LITERAL_JAVA_REGEX: .*:.* (optimized by excludeAll flag) DEFINITION: <exclusion> <artifactId>*</artifactId> </exclusion> SEMANTICS: All artifacts are excluded. LITERAL_JAVA_REGEX: .*:.* (optimized by excludeAll flag) DEFINITION: <exclusion> <groupId>*</groupId> <artifactId>*</artifactId> </exclusion> SEMANTICS: All artifacts are excluded. LITERAL_JAVA_REGEX: .*:.* (optimized by excludeAll flag) DEFINITION: <exclusion> <groupId>*</groupId> <artifactId>commons-lang</artifactId> </exclusion> SEMANTICS: Artifacts with any groupId and with the artifactId equal to "commons-lang" will be excluded. LITERAL_JAVA_REGEX: .*:commons-lang DEFINITION: <exclusion> <groupId>org.springframework</groupId> <artifactId>*</artifactId> </exclusion> SEMANTICS: Artifacts with groupId "org.springframework" will be excluded. LITERAL_JAVA_REGEX: org\.springframework:.* MATCHING_ARTIFACT_EXAMPLES: org.springframework:spring-ws NOT_MATCHING_ARTIFACT_EXAMPLES: org.springframework.snapshot:spring-ws DEFINITION: <exclusion> <groupId>org.springframework.*</groupId> <artifactId>*</artifactId> </exclusion> SEMANTICS: Artifacts with groupId beginning with "org.springframework." will be excluded. LITERAL_JAVA_REGEX: org\.springframework\..*:.* MATCHING_ARTIFACT_EXAMPLES: org.springframework.snapshot:spring-ws NOT_MATCHING_ARTIFACT_EXAMPLES: org.springframeworksnapshot:spring-ws DEFINITION: <exclusion> <groupId>org.springframework*</groupId> <artifactId>*</artifactId> </exclusion> SEMANTICS: Artifacts with groupId beginning with "org.springframework" will be excluded. LITERAL_JAVA_REGEX: org\.springframework.*:.* MATCHING_ARTIFACT_EXAMPLES: org.springframework.snapshot:spring-ws, org.springframeworksnapshot:spring-ws NOT_MATCHING_ARTIFACT_EXAMPLES: org.spring.snapshot:spring-ws DEFINITION: <exclusion> <groupId>org.*.test</groupId> <artifactId>*</artifactId> </exclusion> SEMANTICS: Artifacts with groupId beginning with "org." and ending with ".test" will be excluded. LITERAL_JAVA_REGEX: org\..*\.test*:.* MATCHING_ARTIFACT_EXAMPLES: org.apache.test:test-library, org.apache.snapshot.test:test-library NOT_MATCHING_ARTIFACT_EXAMPLES: orgapachetest:test-library Patch which solves MNG-3832 issue (also including test case) Was this patch helpful to you? Or maybe you are not interested in such contribution? I was delighted to implement this feature and right now I am little bit dissapointed that there is no activity in this subject. The solution I have implemented could be easily included to 2.2.2 version. Many people urgently require this feature (There are 16 votes here and 74 in MNG-2315) Is the approach that I implemented inline with the Maven2 architecture? I can implement it once more or correct the patch in order to have this ticket resolved in 2.2.2 version. I think you'll get more attention if you post to the dev list and describe what you've done. JIRA produces a LOT of mail and many people filter it out. This is an issue with quite a few votes and watchers, so hopefully you'll catch the interest of a committer who can help. there's a few exclusions issues in the 3.1 bucket we can pull together |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
I would like to see this as well, any news on this topic?