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

ASF GitHub Bot commented on SUREFIRE-1383:
------------------------------------------

Github user owenfarrell commented on the issue:

    https://github.com/apache/maven-surefire/pull/157
  
    I've put together an integration test that can validate the execution of 
[SUREFIRE-1383](https://issues.apache.org/jira/browse/SUREFIRE-1383). And all 
is good on that front.
    
    While I was poking around the other ITs, I tripped on the IT for 
[SUREFIRE-569](https://issues.apache.org/jira/browse/SUREFIRE-569). As written, 
the IT passes just fine. But the changes that I'm proposing make that test case 
moot - it uses the same packaging structure of 2 projects built within a single 
session.
    
    I updated that test case to better reflect the original ask of scanning 
**_JAR_** dependencies, but that means splitting the test case execution in to 
2 separate lifecycles. When I split the single lifecycle in to 2, I'm running 
in to a dependency resolution issue. For whatever reason, the second execution 
is unable to locate artifacts installed in the IT repo as part of the first 
lifecycle.
    
    In looking around at the other ITs, it looks like this is the only test 
case that runs an install goal and **_is then dependent on the result of that 
install_**.
    
    Thoughts?
    ```
    mvn 
-Dit.test=**/Surefire569RunTestFromDependencyJarsIT.java,**/Surefire1383ScanSessionDependenciesIT.java
 clean integration-test`
    ...
    [DEBUG] Using local repository at 
/..../maven-surefire/surefire-integration-tests/../surefire-setup-integration-tests/target/it-repo
    ...
    [ERROR] Failed to execute goal on project surefire-569-module1: Could not 
resolve dependencies for project 
org.apache.maven.surefire:surefire-569-module1:jar:1.0: Failed to collect 
dependencies at org.apache.maven.surefire:surefire-569-testjar:jar:tests:1.0: 
Failed to read artifact descriptor for 
org.apache.maven.surefire:surefire-569-testjar:jar:tests:1.0: Failure to find 
org.apache.maven.surefire:it-parent:pom:1.0 in 
https://repo.maven.apache.org/maven2 was cached in the local repository, 
resolution will not be reattempted until the update interval of central has 
elapsed or updates are forced -> [Help 1]
    org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute 
goal on project surefire-569-module1: Could not resolve dependencies for 
project org.apache.maven.surefire:surefire-569-module1:jar:1.0: Failed to 
collect dependencies at 
org.apache.maven.surefire:surefire-569-testjar:jar:tests:1.0
    ```


> 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: Backlog
>
>         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.4.14#64029)

Reply via email to