[ https://issues.apache.org/jira/browse/MBUILDCACHE-25?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17682136#comment-17682136 ]
ASF GitHub Bot commented on MBUILDCACHE-25: ------------------------------------------- gnodet commented on code in PR #34: URL: https://github.com/apache/maven-build-cache-extension/pull/34#discussion_r1090750483 ########## src/main/java/org/apache/maven/buildcache/xml/CacheConfigImpl.java: ########## @@ -594,7 +595,7 @@ public String getId() public String getUrl() { checkInitializedState(); - return getRemote().getUrl(); + return getProperty( REMOTE_URL_PROPERTY_NAME, getRemote().getUrl() ); Review Comment: Can we split that in a different commit if that's unrelated ? > Project processed multiple time in presence of forked executions > ---------------------------------------------------------------- > > Key: MBUILDCACHE-25 > URL: https://issues.apache.org/jira/browse/MBUILDCACHE-25 > Project: Maven Build Cache Extension > Issue Type: Bug > Reporter: Alexander Ashitkin > Priority: Minor > Labels: pull-request-available > > In forked executions present in build, project goes through full lifecycle > multiple times - one time for project itself + 1 time for each forked > execution (could be 5, 10 - depends on configuration): > * checksum will be calculated multiple times > * artifacts uploaded multiple times > The issue is manifested by multiple cache calculation log records for the > same project: > {noformat} > LOGGER.info( "Going to calculate checksum for project [groupId=" + > project.getGroupId() > + ", artifactId=" + project.getArtifactId() + "]" );{noformat} > The issue initially observed with PMD and Spotbugs plugins > h3. Impact > No functional impact observed, just unnecessary performance penalty on cache > h3. Cause > For every forked execution MojoExecutor clones project per forked execution. > Each forked project goes through full cache lifecycle: > {code:java} > // public List<MavenProject> executeForkedExecutions( MojoExecution > mojoExecution, MavenSession session, > ProjectIndex projectIndex ) > throws LifecycleExecutionException > { > ... > Map<String, List<MojoExecution>> forkedExecutions = > mojoExecution.getForkedExecutions(); > if ( !forkedExecutions.isEmpty() ) > { > ... > try > { > for ( Map.Entry<String, List<MojoExecution>> fork : > forkedExecutions.entrySet() ) > { > MavenProject executedProject = forkedProject.clone(); > forkedProject.setExecutionProject( executedProject ); > List<MojoExecution> mojoExecutions = fork.getValue(); > ... > try > { > ... > // here cloned project enters cache as a standalone > project > execute( session, mojoExecutions, projectIndex );{code} > Additional notes: the cloning doesn't affect effective pome, so checksum is > stable and the same in all calculations > Proposed solution: reuse calculated inputs from cache > -- This message was sent by Atlassian Jira (v8.20.10#820010)