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

Herve Boutemy commented on MARTIFACT-57:
----------------------------------------

guessing environment is not that hard, without requiring buildinfo storage
see 
https://github.com/jvm-repo-rebuild/reproducible-central/blob/master/bin/wip.sh 
and 
https://github.com/jvm-repo-rebuild/reproducible-central/blob/master/bin/add-new-release.sh

> Combining artifact:buildinfo and artifact:compare fails
> -------------------------------------------------------
>
>                 Key: MARTIFACT-57
>                 URL: https://issues.apache.org/jira/browse/MARTIFACT-57
>             Project: Maven Artifact Plugin
>          Issue Type: Bug
>          Components: artifact:compare
>    Affects Versions: 3.5.0
>            Reporter: Marcono1234
>            Priority: Major
>
> h2. The issue
> When you combine the goals {{artifact:buildinfo}} and {{artifact:compare}}, 
> then {{compare}} fails, claiming the {{.buildinfo}} file differs.
> For my build the {{artifact:buildinfo}} goal is configured in the {{build}} 
> section of the {{pom.xml}} so that it always creates the {{.buildinfo}} file.
> I haven't investigated this in detail, but to me it seems the underlying 
> issue is this:
> When running {{mvn clean verify artifact:compare}} (as suggested by the 
> [Maven 
> guide|https://maven.apache.org/guides/mini/guide-reproducible-builds.html#how-to-test-my-maven-build-reproducibility]):
> # It implicitly runs the {{artifact:buildinfo}} goal during the {{verify}} 
> phase and attaches the {{.buildinfo}} artifact.
> # {{artifact:compare}} itself seems to also generate a {{.buildinfo}} file 
> which is supposed to include all artifacts, but this (erroneously?) includes 
> the {{.buildinfo}} file from {{artifact:buildinfo}}.
> And also, because it is currently in the process of overwriting that file, it 
> seems to report {{length=0}} (\?).
> h2. Reproduction steps
> # Create a {{pom.xml}} with the following content:
> {code:xml}
> <project xmlns="http://maven.apache.org/POM/4.0.0";
>   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
> http://maven.apache.org/xsd/maven-4.0.0.xsd";>
>   <modelVersion>4.0.0</modelVersion>
>   <groupId>com.mycompany.app</groupId>
>   <artifactId>my-app</artifactId>
>   <version>1.0-SNAPSHOT</version>
>   <properties>
>     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
>     
> <project.build.outputTimestamp>2023-01-01T00:00:00Z</project.build.outputTimestamp>
>   </properties>
>   <build>
>     <plugins>
>       <plugin>
>         <groupId>org.apache.maven.plugins</groupId>
>         <artifactId>maven-artifact-plugin</artifactId>
>         <version>3.5.0</version>
>         <executions>
>           <execution>
>             <goals>
>               <goal>buildinfo</goal>
>             </goals>
>           </execution>
>         </executions>
>       </plugin>
>     </plugins>
>   </build>
> </project>
> {code}
> # Run
> {code}
> mvn clean install
> {code}
> # Run
> {code}
> mvn clean verify artifact:compare
> {code}
> (x) Bug: It fails, claiming the {{.buildinfo}} files differ
> # Inspect the {{target/my-app-1.0-SNAPSHOT.buildinfo}} file
> (x) Bug: It contains the following bogus entry
> {code}
> outputs.2.groupId=com.mycompany.app
> outputs.2.filename=my-app-1.0-SNAPSHOT.buildinfo
> outputs.2.length=0
> outputs.2.checksums.sha512=cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e
> {code}
> *Important:* Remember to delete the 
> {{<user-home>/.m2/repository/com/mycompany}} directory from your local Maven 
> repository afterwards.
> h2. Workaround
> Run {{artifact:compare}} in combination with {{-Dbuildinfo.attach=false}}:
> {code}
> mvn clean verify artifact:compare -Dbuildinfo.attach=false
> {code}



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

Reply via email to