[ https://issues.apache.org/jira/browse/MPIR-456?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17817353#comment-17817353 ]
Ingo Karkat edited comment on MPIR-456 at 2/14/24 1:22 PM: ----------------------------------------------------------- The problem is triggered when the regular build and the site build is combined in a single Maven invocation, and online updates happen ({{mvn -U}}), i.e. {{mvn -U verify site:site site:stage}} First, the build downloads the pinned snapshot version, compiles and runs the tests, as expected: {quote}[INFO] Downloading from ✻✻✻✻-Mirror: https://✻✻✻✻.com/repository/default/io/papermc/paper/paper-api/1.20.4-R0.1-SNAPSHOT/paper-api-1.20.4-R0.1-20240205.114523-90.jar [...] [INFO] — compiler:3.12.1:compile (default-compile) @ ✻✻✻✻ — [INFO] Compiling 37 source files with javac [debug release 17] to target/classes [INFO] — compiler:3.12.1:testCompile (default-testCompile) @ ✻✻✻✻ — [INFO] Compiling 17 source files with javac [debug release 17] to target/test-classes {quote} Then, quality checks run, and as part of the PMD check, the build now suddenly re-downloads the latest snapshot version of that artifact: {quote}[INFO] — editorconfig:0.1.3:check (check) @ ✻✻✻✻ — [...] [INFO] >>> pmd:3.21.2:check (check) > :pmd @ ✻✻✻✻ >>> [INFO] Downloading from ✻✻✻✻-Mirror: https://✻✻✻✻.com/repository/default/io/papermc/paper/paper-api/1.20.4-R0.1-SNAPSHOT/maven-metadata.xml [INFO] Downloaded from ✻✻✻✻-Mirror: https://✻✻✻✻.com/repository/default/io/papermc/paper/paper-api/1.20.4-R0.1-SNAPSHOT/maven-metadata.xml (1.4 kB at 9.2 kB/s) [INFO] Downloading from ✻✻✻✻-Mirror: https://✻✻✻✻.com/repository/default/io/papermc/paper/paper-api/1.20.4-R0.1-SNAPSHOT/paper-api-1.20.4-R0.1-20240211.213908-104.pom [INFO] Downloaded from ✻✻✻✻-Mirror: https://✻✻✻✻.com/repository/default/io/papermc/paper/paper-api/1.20.4-R0.1-SNAPSHOT/paper-api-1.20.4-R0.1-20240211.213908-104.pom (4.7 kB at 36 kB/s) [INFO] Downloading from ✻✻✻✻-Mirror: https://✻✻✻✻.com/repository/default/org/geysermc/geyser/api/2.2.2-SNAPSHOT/maven-metadata.xml [INFO] Downloaded from ✻✻✻✻-Mirror: https://✻✻✻✻.com/repository/default/org/geysermc/geyser/api/2.2.2-SNAPSHOT/maven-metadata.xml (1.6 kB at 12 kB/s) [INFO] Downloading from ✻✻✻✻-Mirror: https://✻✻✻✻.com/repository/default/io/papermc/paper/paper-api/1.20.4-R0.1-SNAPSHOT/paper-api-1.20.4-R0.1-20240211.213908-104.jar [INFO] Downloaded from ✻✻✻✻-Mirror: https://✻✻✻✻.com/repository/default/io/papermc/paper/paper-api/1.20.4-R0.1-SNAPSHOT/paper-api-1.20.4-R0.1-20240211.213908-104.jar (2.0 MB at 2.0 MB/s) {quote} The build then continues with the site build, covers several other goals as well. {quote}[INFO] — site:4.0.0-M13:site (default-cli) @ ✻✻✻✻ — [INFO] — enforcer:3.4.1:enforce (enforce-maven) @ ✻✻✻✻ — [INFO] — resources:3.3.1:resources (default-resources) @ ✻✻✻✻ — [INFO] — flatten:1.5.0:flatten (flatten) @ ✻✻✻✻ — {quote} But then the compiler plugin realizes that the dependency has changed, recompiles the module, which now fails because the latest snapshot has a breaking change that affects our unit tests: {quote}[INFO] — compiler:3.12.1:compile (default-compile) @ ✻✻✻✻ — [INFO] Recompiling the module because of changed dependency. [INFO] Compiling 37 source files with javac [debug release 17] to target/classes [INFO] — compiler:3.12.1:testCompile (default-testCompile) @ ✻✻✻✻ — [INFO] Recompiling the module because of changed dependency. [INFO] Compiling 17 source files with javac [debug release 17] to target/test-classes [INFO] ------------------------------------------------------------- Error: COMPILATION ERROR : [INFO] ------------------------------------------------------------- {quote} So the source code is compiled twice, once with the pinned snapshot version, and once again with the latest snapshot version. The unexpected version update is triggered by the site goal. Disabling incremental compilation in the maven-compiler-plugin prevents the problem; the compiler then doesn't pick up the unexpected changes. Splitting the build into two separate Maven invocations ({{{}mvn verify && mvn site:site site:stage{}}}) also avoids the problem. was (Author: inkarkat): The problem is triggered when the regular build and the site build is combined in a single Maven invocation (i.e. {{{}mvn verify site:site site:stage{}}}). First, the build downloads the pinned snapshot version, compiles and runs the tests, as expected: {quote}[INFO] Downloading from ✻✻✻✻-Mirror: https://✻✻✻✻.com/repository/default/io/papermc/paper/paper-api/1.20.4-R0.1-SNAPSHOT/paper-api-1.20.4-R0.1-20240205.114523-90.jar [...] [INFO] — compiler:3.12.1:compile (default-compile) @ ✻✻✻✻ — [INFO] Compiling 37 source files with javac [debug release 17] to target/classes [INFO] — compiler:3.12.1:testCompile (default-testCompile) @ ✻✻✻✻ — [INFO] Compiling 17 source files with javac [debug release 17] to target/test-classes {quote} Then, quality checks run, and as part of the PMD check, the build now suddenly re-downloads the latest snapshot version of that artifact: {quote}[INFO] — editorconfig:0.1.3:check (check) @ ✻✻✻✻ — [...] [INFO] >>> pmd:3.21.2:check (check) > :pmd @ ✻✻✻✻ >>> [INFO] Downloading from ✻✻✻✻-Mirror: https://✻✻✻✻.com/repository/default/io/papermc/paper/paper-api/1.20.4-R0.1-SNAPSHOT/maven-metadata.xml [INFO] Downloaded from ✻✻✻✻-Mirror: https://✻✻✻✻.com/repository/default/io/papermc/paper/paper-api/1.20.4-R0.1-SNAPSHOT/maven-metadata.xml (1.4 kB at 9.2 kB/s) [INFO] Downloading from ✻✻✻✻-Mirror: https://✻✻✻✻.com/repository/default/io/papermc/paper/paper-api/1.20.4-R0.1-SNAPSHOT/paper-api-1.20.4-R0.1-20240211.213908-104.pom [INFO] Downloaded from ✻✻✻✻-Mirror: https://✻✻✻✻.com/repository/default/io/papermc/paper/paper-api/1.20.4-R0.1-SNAPSHOT/paper-api-1.20.4-R0.1-20240211.213908-104.pom (4.7 kB at 36 kB/s) [INFO] Downloading from ✻✻✻✻-Mirror: https://✻✻✻✻.com/repository/default/org/geysermc/geyser/api/2.2.2-SNAPSHOT/maven-metadata.xml [INFO] Downloaded from ✻✻✻✻-Mirror: https://✻✻✻✻.com/repository/default/org/geysermc/geyser/api/2.2.2-SNAPSHOT/maven-metadata.xml (1.6 kB at 12 kB/s) [INFO] Downloading from ✻✻✻✻-Mirror: https://✻✻✻✻.com/repository/default/io/papermc/paper/paper-api/1.20.4-R0.1-SNAPSHOT/paper-api-1.20.4-R0.1-20240211.213908-104.jar [INFO] Downloaded from ✻✻✻✻-Mirror: https://✻✻✻✻.com/repository/default/io/papermc/paper/paper-api/1.20.4-R0.1-SNAPSHOT/paper-api-1.20.4-R0.1-20240211.213908-104.jar (2.0 MB at 2.0 MB/s) {quote} The build then continues with the site build, covers several other goals as well. {quote}[INFO] — site:4.0.0-M13:site (default-cli) @ ✻✻✻✻ — [INFO] — enforcer:3.4.1:enforce (enforce-maven) @ ✻✻✻✻ — [INFO] — resources:3.3.1:resources (default-resources) @ ✻✻✻✻ — [INFO] — flatten:1.5.0:flatten (flatten) @ ✻✻✻✻ — {quote} But then the compiler plugin realizes that the dependency has changed, recompiles the module, which now fails because the latest snapshot has a breaking change that affects our unit tests: {quote}[INFO] — compiler:3.12.1:compile (default-compile) @ ✻✻✻✻ — [INFO] Recompiling the module because of changed dependency. [INFO] Compiling 37 source files with javac [debug release 17] to target/classes [INFO] — compiler:3.12.1:testCompile (default-testCompile) @ ✻✻✻✻ — [INFO] Recompiling the module because of changed dependency. [INFO] Compiling 17 source files with javac [debug release 17] to target/test-classes [INFO] ------------------------------------------------------------- Error: COMPILATION ERROR : [INFO] ------------------------------------------------------------- {quote} So the source code is compiled twice, once with the pinned snapshot version, and once again with the latest snapshot version. The unexpected version update is triggered by the site goal. Disabling incremental compilation in the maven-compiler-plugin prevents the problem; the compiler then doesn't pick up the unexpected changes. Splitting the build into two separate Maven invocations ({{{}mvn verify && mvn site:site site:stage{}}}) also avoids the problem. > fixed snapshot versions are ignored and latest snapshot is used instead > ----------------------------------------------------------------------- > > Key: MPIR-456 > URL: https://issues.apache.org/jira/browse/MPIR-456 > Project: Maven Project Info Reports Plugin > Issue Type: Bug > Components: dependencies > Affects Versions: 3.5.0 > Reporter: Gabriel Wolf > Priority: Critical > > We use fixed versions of snapshots in your pom, so for example we use > '1.20.4-R0.1-20240205.114523-90' instead of '1.20.4-R0.1-SNAPSHOT'. Normally > this is not an issue when executing for example 'mvn verify' but when we run > 'mvn site' instead of the explicit used snapshot version the latest snapshot > version is downloaded and used. > Normally this do not cause big issues, but currently we have an API breaking > change in the snapshot version and we want to stick to the old version. -- This message was sent by Atlassian Jira (v8.20.10#820010)