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

Olivier Lamy commented on MBUILDCACHE-76:
-----------------------------------------

`So this will happen for a single module project as well (multi-module is a 
distraction). `
nah the problem here is because of the multi module and so projects are part of 
the reactor build. 
External dependencies checksum calculation is using version because there is 
not access to projects inputs (sources, resources etc..).
But here in the case of a multimodule, the reactor give access to the module 
buillds inputs (sources, resources etc..) simply because they are part of the 
build.
Inter module dependencies (e.g modules part of the same reactor build) doesn't 
care (usually) of version change.
project (version 1.0-SNAPSHOT)
  - module A (version 1.0-SNAPSHOT)
  - module B (version 1.0-SNAPSHOT) using module A (version 1.0-SNAPSHOT)

When building module B the build cache extension can calculate real checksum of 
module A because it has direct access to sources, resources etc... 
In this case version number doesn't have any impact because the extension can 
calculate if something has really change (version number is not real change of 
nothing else has changed :) )
BUT in the case of the build need this version as part of the checksum build 
input calculation which is the case of m-plugin-p:descriptor goal which use to 
generate plugin metadata, we have a problem :) 
if you move all the tests modules using your plugin as invoker tests within the 
plugin code itself you may not have issues as those tests will not run when 
cache detects no changes.
The other workaround now  is to disable the cache for the maven plugin
<properties>
....
<maven.build.cache.enabled>false</maven.build.cache.enabled>
....
</properties>
or clean local cache entries:  rm -rf ~/.m2/build-cache/v1/

Other than that we need to find a solution for maven-plugin type (when it's 
part of reactor build) project but something generic.
A solution I tried was to force m-plugin-p to always run 

    <executionControl>
        <runAlways>
            <goalsLists>
                .....
                <goalsList artifactId="maven-plugin-plugin">
                    <goals>
                        <goal>descriptor</goal>
                    </goals>
                </goalsList>
                ....
            </goalsLists>
        </runAlways>

but nah doesn't work as mvn clean install means deleted target/classes and so 
no way to scan for annotations.
the solution could be a new feature to force restore output of a module.
 




 

> pom project version change not detected
> ---------------------------------------
>
>                 Key: MBUILDCACHE-76
>                 URL: https://issues.apache.org/jira/browse/MBUILDCACHE-76
>             Project: Maven Build Cache Extension
>          Issue Type: Bug
>    Affects Versions: 1.1.0
>            Reporter: Dave Moten
>            Priority: Minor
>
> When I run `mvn versions:set -DnewVersion=BLAH`, the build cache extension 
> does not detect this and skips all modules in a multimodule project (and 
> fails when it encounters a module that depends on one of the other modules (a 
> maven plugin)).
> What should happen is that every module gets rebuilt.
> To duplicate
> ```
> git clone [https://github.com/davidmoten/openapi-codegen.git]
> cd openapi-codegen
> mvn clean install
> mvn versions:set -DnewVersion=1.2.3.4-SNAPSHOT
> mvn clean install
> ```
> Output:
> ```
> [ERROR] Invalid plugin descriptor for 
> com.github.davidmoten:openapi-codegen-maven-plugin:1.2.3.4-SNAPSHOT 
> (/home/dave/.m2/build-cache/v1/com.github.davidmoten/openapi-codegen-maven-plugin/ad4e1e854d87f274/local/openapi-codegen-maven-plugin.jar),
>  Plugin's descriptor contains the wrong version: 0.1.15-SNAPSHOT -> [Help 1]
> ```
> Here is my maven-build-cache-config.xml:
> ```
> <cache xmlns="http://maven.apache.org/BUILD-CACHE-CONFIG/1.0.0"; 
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>        xsi:schemaLocation="http://maven.apache.org/BUILD-CACHE-CONFIG/1.0.0 
> [https://maven.apache.org/xsd/build-cache-config-1.0.0.xsd]";>
>     <configuration>
>         <enabled>true</enabled>
>         <!-- activated via cli -->
>         <!-- to disable it just use -Dmaven.build.cache.enabled=false -->
>     </configuration>
>     <input>
>         <global>
>             <glob>{{*}.java,{*}.xml,{*}.properties,{*}.mod,*.adoc}</glob>
>             <excludes>
>                 <exclude>{*}Jenkinsfile{*}</exclude>
>                 <exclude>./idea/*</exclude>
>             </excludes>
>         </global>
>         <plugins>
>             <plugin groupId="org.apache.maven.plugins" 
> artifactId="maven-surefire-plugin">
>                 <effectivePom>
>                     <excludeProperties>
>                         
> <excludeProperty>systemPropertyVariables</excludeProperty>
>                     </excludeProperties>
>                 </effectivePom>
>             </plugin>
>         </plugins>
>     </input>
>     <executionControl>
>         <runAlways>
>             <goalsLists>
>                 <goalsList artifactId="maven-install-plugin">
>                     <goals>
>                         <goal>install</goal>
>                     </goals>
>                 </goalsList>
>                 <goalsList artifactId="maven-deploy-plugin">
>                     <goals>
>                         <goal>deploy</goal>
>                     </goals>
>                 </goalsList>
>             </goalsLists>
>         </runAlways>
>         <reconcile>
>             <plugins>
>                 <!-- workaround for 
> https://issues.apache.org/jira/browse/MBUILDCACHE-56 -->
>                 <plugin artifactId="maven-enforcer-plugin" goal="enforce">
>                     <nologs>
>                         <nolog propertyName="commandLineRules"/>
>                     </nologs>
>                 </plugin>
>                 <plugin artifactId="maven-surefire-plugin" goal="test">
>                     <reconciles>
>                         <reconcile propertyName="skip" skipValue="true"/>
>                         <reconcile propertyName="skipExec" skipValue="true"/>
>                         <reconcile propertyName="skipTests" skipValue="true"/>
>                         <reconcile propertyName="testFailureIgnore" 
> skipValue="true"/>
>                     </reconciles>
>                     <nologs>
>                         <nolog propertyName="systemPropertyVariables"/>
>                     </nologs>
>                 </plugin>
>             </plugins>
>         </reconcile>
>     </executionControl>
> </cache>
> ```
>     



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

Reply via email to