jira-importer opened a new issue, #322:
URL: https://github.com/apache/maven-build-cache-extension/issues/322

   **[Bas van 
Erp](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=JIRAUSER300062)**
 opened 
**[MBUILDCACHE-59](https://issues.apache.org/jira/browse/MBUILDCACHE-59?redirect=false)**
 and commented
   
   I would argue that the Maven Build Cache Extension (MBCE) can provide the 
greatest value for users that utilize large multi-module (mono-)repositories, 
since those projects tend to have large amounts of "stable" code which isn't 
modified frequently.
   
   Speeding up the build of these multi-module projects using the MBCE would be 
totally awesome!
   
   But for my particular project (200K LOC, 400 modules, mono-repo) our initial 
trials with the MBCE have proven somewhat troublesome.
   
   It has to do with our use of https://maven.apache.org/maven-ci-friendly.html
   
   ## Example setup
   
   `repo/.mvn/maven.config`
   
   ```java
   -Drevision=0.0.0-local-SNAPSHOT 
   ```
   
   `repo/pom.xml`
   
   ```java
   <groupId>com.corp</groupId>
   <artifactId>parent</artifactId>
   <version>${revision}</version>
   <packaging>pom</packaging> 
   ```
   
   `repo/moduleX/pom.xml`
   
   ```java
   <parent>
       <groupId>com.corp</groupId>
       <artifactId>parent</artifactId>
       <version>${revision}</version>
       <relativePath>../pom.xml</relativePath>
   </parent>
   
   <artifactId>moduleX</artifactId>
   <packaging>jar</packaging>
   ```
   
   `repo/moduleY/pom.xml`
   
   ```java
   <parent>
       <groupId>com.corp</groupId>
       <artifactId>parent</artifactId>
       <version>${revision}</version>
       <relativePath>../pom.xml</relativePath>
   </parent>
   
   <artifactId>moduleY</artifactId>
   <packaging>jar</packaging>
   
   <dependencies>
       <dependency>
           <groupId>com.corp</groupId>
           <artifactId>moduleX</artifactId>
           <version>${revision}</version>
       </dependency>
   </dependencies>
   ```
   
   `repo/Jenkinsfile`
   
   ```java
   mvn clean deploy -Drevision=$(git describe)
   ```
   
   ## Effect
   
   This setup effectively means that while all our 150 developers might 
theoretically get decent cache hit % since they are all always using version 
`0.0.0-local-SNAPSHOT` for every single POM for every single build, our CI 
pipelines are out of luck.
   
   Since the effective-POMs will change radically with each new Git commit, the 
hashes will virtually never collide.
   
   ## Solution?
   
   I'm very new to the MBCE so I might be way off the mark, but I think 
accommodating this setup will not be trivial to implement. It would probably 
require parsing the effective-POM for every module picked-up by the reactor and 
then removing all \<version> clauses of the module, the parent, and each 
dependency and plugin which are part of the reactor build.
   
   Doesn't sound easy to me. But perhaps I'm missing something.
   
    
   
   p.s. Congrats on the v1.0.0 release :). I'm enjoying experimenting with it. 
But the documentation could use some love. It's pretty hard to read. Some 
paragraphs are confusing, terse or lacking in detail, are clearly written by 
non-English-native writers (like myself), or even stop mid-sentence.
   
   
   ---
   
   **Affects:** 1.0.0
   
   1 votes, 4 watchers
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to