This supports classifiers

project.getTestArtifacts()

If you find the one Artifact in this collection then you can simply ignore
it in

session.getSortedProjects()

If it basically opposite what you have done in your code with the removal.
So the old code says to take test dependencies match them with
dependenciesToScan. This is ok and after this we put more those which are
not in dependencies section but appear in depedenciesToScan as project
artifacts.


On Tue, Aug 29, 2017 at 2:48 PM, owenfarrell <g...@git.apache.org> wrote:

> Github user owenfarrell commented on a diff in the pull request:
>
>     https://github.com/apache/maven-surefire/pull/157#
> discussion_r135778722
>
>     --- Diff: maven-surefire-common/src/main/java/org/apache/maven/
> plugin/surefire/AbstractSurefireMojo.java ---
>     @@ -847,12 +847,31 @@ private DefaultScanResult scanDependencies()
>              {
>                  try
>                  {
>     +                DefaultScanResult scanResult = new DefaultScanResult(
> Collections.EMPTY_LIST );
>     +
>     +                List<String> dependenciesToScan = new ArrayList();
>     +                Collections.addAll( dependenciesToScan,
> getDependenciesToScan() );
>     +                TestListResolver includedAndExcludedTests =
> getIncludedAndExcludedTests();
>     +
>     +                for ( MavenProject mavenProject :
> session.getSortedProjects() )
>     +                {
>     +                    String groupArtifactId =
> mavenProject.getGroupId() + ":" + mavenProject.getArtifactId();
>     +                    if ( dependenciesToScan.removeAll(
> Collections.singleton( groupArtifactId ) ) )
>     +                    {
>     +                        File outputDirectoryFile = new File(
> mavenProject.getBuild().getOutputDirectory() );
>     +                        DirectoryScanner scanner =
>     +                                new DirectoryScanner(
> outputDirectoryFile, includedAndExcludedTests );
>     +                        scanResult = scanResult.append(
> scanner.scan() );
>     +                    }
>     +                }
>     +
>                      // @TODO noinspection unchecked, check MavenProject
> 3.x for Generics in surefire:3.0
>                      @SuppressWarnings( "unchecked" )
>     -                List<File> dependenciesToScan =
>     -                    DependencyScanner.filter(
> project.getTestArtifacts(), Arrays.asList( getDependenciesToScan() ) );
>     -                DependencyScanner scanner = new DependencyScanner(
> dependenciesToScan, getIncludedAndExcludedTests() );
>     -                return scanner.scan();
>     +                List<File> dependenciesToScanFile =
>     +                        DependencyScanner.filter(
> project.getTestArtifacts(), dependenciesToScan );
>     --- End diff --
>
>     Locally staged updates to reflect your generics comments. But I don't
> follow what you're asking for here.
>
>     [Per the documentation](https://maven.apache.org/surefire/maven-
> surefire-plugin/test-mojo.html#dependenciesToScan), the
> dependenciesToScan property doesn't support classifiers - just group ID and
> artifact ID. So I didn't add any logic around classifier resolution. Is
> that what you were expecting?
>
>
> ---
> If your project is set up for it, you can reply to this email and have your
> reply appear on GitHub as well. If your project does not have this feature
> enabled and wishes so, or if the feature is enabled but not working, please
> contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
> with INFRA.
> ---
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
> For additional commands, e-mail: dev-h...@maven.apache.org
>
>


-- 
Cheers
Tibor

Reply via email to