LoneDev created MBUILDCACHE-54:
----------------------------------

             Summary: Project scoped dependency of a module contributes so the 
hash of the module itself breaking cache logic
                 Key: MBUILDCACHE-54
                 URL: https://issues.apache.org/jira/browse/MBUILDCACHE-54
             Project: Maven Build Cache Extension
          Issue Type: Bug
    Affects Versions: 1.0.0
            Reporter: LoneDev


I have a maven project structured this way:
 * Core
 ** module1
 ** module2
 ** module3

 

Each submodule has Core as dependency, because they need to access some stuff 
in the Core module.

 
{code:java}
<dependency>
<groupId>dev.lone</groupId>
<artifactId>Core</artifactId>
<version>1.0</version>
<scope>provided</scope>
</dependency> {code}
 

 

The issue is that when I edit the Core the hash of the modules changes too 
because their hash is made of their dependencies too.

I found that out by enabling debug using `-X` maven argument and noticed that 
the dependency hash was changing for one of the two dependencies in the log, 
but the others remained the same.

Example:

 
{code:java}
[DEBUG] Hash calculated, item: file, hash: aed7a7726072b1f2
[DEBUG] Hash calculated, item: file, hash: af38807c7b6d4d82
[DEBUG] Hash calculated, item: file, hash: 7b2b9b026b4247b0
[DEBUG] Hash calculated, item: file, hash: 5d3e80058614177e
[DEBUG] Hash calculated, item: file, hash: f656e74567358a0e
[DEBUG] Hash calculated, item: file, hash: 24836dacb4dec612
[DEBUG] Hash calculated, item: dependency, hash: ceaa4062fafc0392
[DEBUG] Hash calculated, item: dependency, hash: 933c5b7ec84b6afa ### <---- 
this {code}
 

 

This is strange since checking your code it should automatically exclude a 
dependency from the module hash if the dependency itself is a module of the 
project, right?

Here the relevant code I found in your repo:

[https://github.com/apache/maven-build-cache-extension/blob/241ebce428e6ee4f9d2c8ad43e65d44d9eaf947e/src/main/java/org/apache/maven/buildcache/checksum/MavenProjectInput.java#L206]

 

[https://github.com/apache/maven-build-cache-extension/blob/241ebce428e6ee4f9d2c8ad43e65d44d9eaf947e/src/main/java/org/apache/maven/buildcache/checksum/MavenProjectInput.java#L211]

 

[https://github.com/apache/maven-build-cache-extension/blob/241ebce428e6ee4f9d2c8ad43e65d44d9eaf947e/src/main/java/org/apache/maven/buildcache/checksum/MavenProjectInput.java#L644]

 

[https://github.com/apache/maven-build-cache-extension/blob/241ebce428e6ee4f9d2c8ad43e65d44d9eaf947e/src/main/java/org/apache/maven/buildcache/DefaultMultiModuleSupport.java#L85]

 

What I'd expect is the project modules not to take part of the hash of a module 
if they are dependencies. This would make the caching system useless in my 
project.

 

Thanks!

 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to