[ https://issues.apache.org/jira/browse/SUREFIRE-1585?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16664883#comment-16664883 ]
ASF GitHub Bot commented on SUREFIRE-1585: ------------------------------------------ sormuras commented on a change in pull request #196: [SUREFIRE-1585] [WIP] Resolve missing artifact URL: https://github.com/apache/maven-surefire/pull/196#discussion_r228444705 ########## File path: maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java ########## @@ -2995,6 +2996,36 @@ private void resolveJUnitVintageEngine( Set<Artifact> providerArtifacts ) Set<Artifact> resolvedArtifacts = resolveArtifact( null, junitVintageEngine ).getArtifacts(); providerArtifacts.addAll( resolvedArtifacts ); } + + private void alignJUnitPlatformLauncher( Set<Artifact> providerArtifacts ) + { + Map<String, Artifact> providerArtifactMap = new HashMap<String, Artifact>(); + for ( Artifact artifact : providerArtifacts ) + { + String key = artifact.getGroupId() + ":" + artifact.getArtifactId(); + providerArtifactMap.put( key, artifact ); + } + Artifact defaultLauncher = providerArtifactMap.get( "org.junit.platform:junit-platform-launcher" ); + Artifact junitPlatformCommons = getProjectArtifactMap().get( "org.junit.platform:junit-platform-commons" ); + + if ( junitPlatformCommons.getVersion().equals( defaultLauncher.getVersion() ) ) + { + return; Review comment: - Handle trivial and special cases up-front. - Afert that the actual work code is free of nested/complicated `if/else` clauses. - Keep indentation level low. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Auto-resolve "missing" artifacts > -------------------------------- > > Key: SUREFIRE-1585 > URL: https://issues.apache.org/jira/browse/SUREFIRE-1585 > Project: Maven Surefire > Issue Type: Improvement > Components: JUnit 5.x support > Affects Versions: 2.22.1 > Reporter: Christian Stein > Assignee: Christian Stein > Priority: Minor > Labels: features > > Providers should be able to enhance the test runtime by injecting "missing" > artifacts before executing tests. > > For example, the JUnit Platform Provider should add "missing" Test Engine > artifacts for when users only depend on the API of a test framework. > * User test depends on *`junit-jupiter-api`* only? Provide > *`junit-jupiter-engine`* at test runtime -- automatically or via plugin deps. > * User test depends on *`junit-jupiter-params`* only? That pulls in > *`junit-jupiter-api`* transitively. Provide *`junit-jupiter-engine`* at test > runtime -- automatically or via plugin deps. > * User test depends on *`junit:junit:4.12`* only *AND* the JUnit Platform > Provider is forced? Provide *`junit-vintage-engine`* at test runtime -- > automatically or via plugin deps. -- This message was sent by Atlassian JIRA (v7.6.3#76005)