-
Notifications
You must be signed in to change notification settings - Fork 22
Open
Labels
bugSomething isn't workingSomething isn't workingpriority:majorMajor loss of functionMajor loss of function
Description
Marcono1234 opened MARTIFACT-57 and commented
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):
- It implicitly runs the
artifact:buildinfogoal during theverifyphase and attaches the.buildinfoartifact. artifact:compareitself seems to also generate a.buildinfofile which is supposed to include all artifacts, but this (erroneously?) includes the.buildinfofile fromartifact:buildinfo.
And also, because it is currently in the process of overwriting that file, it seems to reportlength=0(?).
Reproduction steps
- Create a
pom.xmlwith the following content:
<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>- Run
mvn clean install
- Run
mvn clean verify artifact:compare
(x) Bug: It fails, claiming the .buildinfo files differ
- Inspect the
target/my-app-1.0-SNAPSHOT.buildinfofile
(x) Bug: It contains the following bogus entry
outputs.2.groupId=com.mycompany.app
outputs.2.filename=my-app-1.0-SNAPSHOT.buildinfo
outputs.2.length=0
outputs.2.checksums.sha512=cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e
Important: Remember to delete the <user-home>/.m2/repository/com/mycompany directory from your local Maven repository afterwards.
Workaround
Run artifact:compare in combination with -Dbuildinfo.attach=false:
mvn clean verify artifact:compare -Dbuildinfo.attach=false
Affects: 3.5.0
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingpriority:majorMajor loss of functionMajor loss of function