[ 
https://issues.apache.org/jira/browse/SUREFIRE-1383?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16040005#comment-16040005
 ] 

Owen Farrell commented on SUREFIRE-1383:
----------------------------------------

The maven-compiler-plugin seems to handle this issue just fine when building a 
list of classpathEntries.

I'm not a Maven API SME by any means, so the below is a bit of a guess in terms 
of approach:
* AbstractSurefireMojo.scanDependencies needs to inspect projects on the 
MavenSession
* For each scanned dependency that is found in the session
** Translate the dependency in to a MavenProject instance (by leveraging the 
session?)
** Get the build output directory for the project
** Create new directory scanner that wraps the build output directory of the 
project


> dependenciesToScan Does Not Leverage Classpath Elements 
> --------------------------------------------------------
>
>                 Key: SUREFIRE-1383
>                 URL: https://issues.apache.org/jira/browse/SUREFIRE-1383
>             Project: Maven Surefire
>          Issue Type: Bug
>          Components: Maven Surefire Plugin
>    Affects Versions: 2.20
>            Reporter: Owen Farrell
>             Fix For: 3.0, 2.20.1
>
>         Attachments: scanned-dependencies-sample.zip
>
>
> The <dependenciesToScan> configuration attribute relies solely on installed 
> artifacts. This is an issue when the targeted dependencies were built as part 
> of the current session. The net result is that stale artifacts are used (i.e. 
> if the dependency has changed since it was last installed) or the tests are 
> not executed at all (if the dependency has not been previously installed.
> Attached is a sample project that illustrates this issue:
> Given I have a multi-module project
>    And the first module built includes test classes as part of the project 
> artifact
>    And subsequent modules scan the first for unit tests to execute
> When I execute the _*test*_ goal (prior to any install)
> Then the build should succeed
>    And tests should be executed with each module



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to