Skip to content

enable build with Maven 4#655

Open
hboutemy wants to merge 1 commit into
maven-deploy-plugin-3.xfrom
maven4-enabled
Open

enable build with Maven 4#655
hboutemy wants to merge 1 commit into
maven-deploy-plugin-3.xfrom
maven4-enabled

Conversation

@hboutemy
Copy link
Copy Markdown
Member

build with Maven 4 in CI, to check if maven-deploy-plugin 3.x works with Maven 4

and complete the table on https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=406620656#Maven4.0.0GAchecklist-Maven4API

@Bukama
Copy link
Copy Markdown
Contributor

Bukama commented May 9, 2026

[INFO] -------------------------------------------------
[ERROR] The following builds failed:
[ERROR] *  deploy-attached-sources\pom.xml
[ERROR] *  deploy-default-packaging\pom.xml
[ERROR] *  MDEPLOY-169_deploy-at-end-multithread\pom.xml
[ERROR] *  MDEPLOY-170_deploy-at-end-configperproject\pom.xml
[ERROR] *  MDEPLOY-224_deploy-at-end-only-modules\pom.xml
[ERROR] *  MDEPLOY-225_deploy-at-end-skip-root\pom.xml

edit:

deploy-attached-sources

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:3.1.5-SNAPSHOT:deploy-file (default-cli) on project test: D:\target-.jar not found.

deploy-default-packaging

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:3.1.5-SNAPSHOT:deploy-file (default-cli) on project test: D:\lib\test-1.1.jar not found

MDEPLOY-169_deploy-at-end-multithread

Assertion failed:

assert new File( basedir, "module1/target/repo/org/apache/maven/its/mdeploy-169/module1/1.0/module1-1.0.pom" ).exists()
| | |
| D:\Github\Maven\maven-deploy-plugin\target\it\MDEPLOY-169_deploy-at-end-multithread false
D:\Github\Maven\maven-deploy-plugin\target\it\MDEPLOY-169_deploy-at-end-multithread\module1\target\repo\org\apache\maven\its\mdeploy-169\module1\1.0\module1-1.0.pom

[INFO] Installing D:\Github\Maven\maven-deploy-plugin\target\it\MDEPLOY-169_deploy-at-end-multithread\module1\target\consumer-6293687905353999056.pom to D:\Github\Maven\maven-deploy-plugin\target\local-repo\org\apache\maven\its\mdeploy-169\module1\1.0\module1-1.0.pom

MDEPLOY-170_deploy-at-end-configperproject

Assertion failed:

assert new File( basedir, "module1/target/repo/org/apache/maven/its/mdeploy-170/module1/1.0/module1-1.0.pom" ).exists()
| | |
| D:\Github\Maven\maven-deploy-plugin\target\it\MDEPLOY-170_deploy-at-end-configperproject false
D:\Github\Maven\maven-deploy-plugin\target\it\MDEPLOY-170_deploy-at-end-configperproject\module1\target\repo\org\apache\maven\its\mdeploy-170\module1\1.0\module1-1.0.pom

[INFO] Installing D:\Github\Maven\maven-deploy-plugin\target\it\MDEPLOY-170_deploy-at-end-configperproject\module1\target\consumer-1389750655688884827.pom to D:\Github\Maven\maven-deploy-plugin\target\local-repo\org\apache\maven\its\mdeploy-170\module1\1.0\module1-1.0.pom

MDEPLOY-224_deploy-at-end-only-modules

Assertion failed:

assert new File( basedir, "module1/target/repo/org/apache/maven/its/mdeploy-224/module1/1.0/module1-1.0.pom" ).exists()
| | |
| D:\Github\Maven\maven-deploy-plugin\target\it\MDEPLOY-224_deploy-at-end-only-modules false
D:\Github\Maven\maven-deploy-plugin\target\it\MDEPLOY-224_deploy-at-end-only-modules\module1\target\repo\org\apache\maven\its\mdeploy-224\module1\1.0\module1-1.0.pom

[INFO] Installing D:\Github\Maven\maven-deploy-plugin\target\it\MDEPLOY-224_deploy-at-end-only-modules\module1\target\consumer-10985243690833197708.pom to D:\Github\Maven\maven-deploy-plugin\target\local-repo\org\apache\maven\its\mdeploy-224\module1\1.0\module1-1.0.pom

MDEPLOY-225_deploy-at-end-skip-root

Assertion failed:

assert ! new File( basedir, "target/repo" ).exists()
| | | |
| | | true
| | D:\Github\Maven\maven-deploy-plugin\target\it\MDEPLOY-225_deploy-at-end-skip-root
| D:\Github\Maven\maven-deploy-plugin\target\it\MDEPLOY-225_deploy-at-end-skip-root\target\repo
false

[INFO] Installing D:\Github\Maven\maven-deploy-plugin\target\it\MDEPLOY-225_deploy-at-end-skip-root\pom.xml to D:\Github\Maven\maven-deploy-plugin\target\local-repo\org\apache\maven\its\mdeploy-225\parent\1.0\parent-1.0-build.pom

@Bukama
Copy link
Copy Markdown
Contributor

Bukama commented May 9, 2026

Interesting: The four ITs with JIRA-issueID overwrite deployAtEnd value to true fail. This is the new default in version 4.x of the plugin, but we are testing 3.x so this should not make any difference when choosing the path to deploy.

I still could not figure out why the distributionManagement is ignored for subprojects

<!-- Set in parent of the IT project -->

<distributionManagement>
  <repository>
    <id>it</id>
    <url>file:///${basedir}/target/repo</url>
  </repository>
</distributionManagement>


// All files are deployed there
[INFO] Uploading to it: file:///D:\Github\Maven\maven-deploy-plugin\target\it\MDEPLOY-170_deploy-at-end-configperproject/target/repo/org/apache/maven/its/mdeploy-170/configperproject/1.0/configperproject-1.0-build.pom

// Even subprojects files
[INFO] Uploading to it: file:///D:\Github\Maven\maven-deploy-plugin\target\it\MDEPLOY-170_deploy-at-end-configperproject/target/repo/org/apache/maven/its/mdeploy-170/module1/1.0/module1-1.0.pom

The file exists there (See screenshot below), but the verify script checks the target folder inside each subproject

verify-script:

assert new File( basedir, "target/repo/org/apache/maven/its/mdeploy-170/configperproject/1.0/configperproject-1.0.pom" ).exists()
assert new File( basedir, "module1/target/repo/org/apache/maven/its/mdeploy-170/module1/1.0/module1-1.0.pom" ).exists()
assert !( new File( basedir, "module2/target/repo/org/apache/maven/its/mdeploy-170/module2/1.0/module2-1.0.pom" ).exists() )


Assertion failed:

assert new File( basedir, "module1/target/repo/org/apache/maven/its/mdeploy-170/module1/1.0/module1-1.0.pom" ).exists()
| | |
| D:\Github\Maven\maven-deploy-plugin\target\it\MDEPLOY-170_deploy-at-end-configperproject false
D:\Github\Maven\maven-deploy-plugin\target\it\MDEPLOY-170_deploy-at-end-configperproject\module1\target\repo\org\apache\maven\its\mdeploy-170\module1\1.0\module1-1.0.pom

The file exists, but in the target repository of the parent

D:\Github\Maven\maven-deploy-plugin\target\it\MDEPLOY-170_deploy-at-end-configperproject\target\repo\org\apache\maven\its\mdeploy-170\module1\1.0

image

So what has changed here in Maven 4?

@Bukama
Copy link
Copy Markdown
Contributor

Bukama commented Jun 6, 2026

Looking at deploy-attached-sources and deploy-default-packaging

Logs are from deploy-attached-sources

Packaging is right into local repository

[DEBUG] isUp2date: false (Destination D:\Github\Maven\maven-deploy-plugin\target\it\deploy-attached-sources\target\test-1.0-SNAPSHOT.jar not found.)
[INFO] Building jar: D:\Github\Maven\maven-deploy-plugin\target\it\deploy-attached-sources\target\test-1.0-SNAPSHOT.jar

But deploying does not pick the project path information when using 4.0.0-SNAPSHOT

[INFO] --- deploy:3.1.5-SNAPSHOT:deploy-file (default-cli) @ test ---
[DEBUG] Collector skip mode enabled: versionless (key function GACE)
[DEBUG] Reading file model from org.codehaus.plexus:plexus-xml:3.0.1
[DEBUG] Reading file model from org.codehaus.plexus:plexus-utils:4.0.2
[DEBUG] Reading file model from org.codehaus.plexus:plexus:18
[DEBUG] Reading file model from org.apache.maven.resolver:maven-resolver-util:1.9.27
[DEBUG] Reading file model from org.junit:junit-bom:5.10.2
[DEBUG] Reading file model from org.apache.maven.resolver:maven-resolver:1.9.27
[DEBUG] Reading file model from org.apache.maven.resolver:maven-resolver-api:1.9.27
[DEBUG] Dependency collection stats {ConflictMarker.analyzeTime=332800, ConflictMarker.markTime=56900, ConflictMarker.nodeCount=5, ConflictIdSorter.graphTime=184300, ConflictIdSorter.topsortTime=169300, ConflictIdSorter.conflictIdCount=5, ConflictIdSorter.conflictIdCycleCount=0, ConflictResolver.totalTime=2401000, ConflictResolver.conflictItemCount=5, BfDependencyCollector.collectTime=49614500, BfDependencyCollector.transformTime=5093600}
[DEBUG] org.apache.maven.plugins:maven-deploy-plugin:jar:3.1.5-SNAPSHOT
[DEBUG] +- org.codehaus.plexus:plexus-utils:jar:4.0.2 [compile]
[DEBUG] +- org.codehaus.plexus:plexus-xml:jar:3.0.1 [compile]
[DEBUG] \- org.apache.maven.resolver:maven-resolver-util:jar:1.9.27 [compile]
[DEBUG]    \- org.apache.maven.resolver:maven-resolver-api:jar:1.9.27 [compile]
[DEBUG]   Excluded: org.apache.maven.resolver:maven-resolver-util:jar:1.9.27
[DEBUG]   Excluded: org.apache.maven.resolver:maven-resolver-api:jar:1.9.27
[DEBUG] Created new class realm plugin>org.apache.maven.plugins:maven-deploy-plugin:3.1.5-SNAPSHOT
[DEBUG] Importing foreign packages into class realm plugin>org.apache.maven.plugins:maven-deploy-plugin:3.1.5-SNAPSHOT
[DEBUG]   Imported:  < maven.api
[DEBUG] Populating class realm plugin>org.apache.maven.plugins:maven-deploy-plugin:3.1.5-SNAPSHOT
[DEBUG]   Included: org.apache.maven.plugins:maven-deploy-plugin:jar:3.1.5-SNAPSHOT
[DEBUG]   Included: org.codehaus.plexus:plexus-utils:jar:4.0.2
[DEBUG]   Included: org.codehaus.plexus:plexus-xml:jar:3.0.1
[DEBUG] Loading mojo org.apache.maven.plugins:maven-deploy-plugin:3.1.5-SNAPSHOT:deploy-file from plugin realm ClassRealm[plugin>org.apache.maven.plugins:maven-deploy-plugin:3.1.5-SNAPSHOT, parent: jdk.internal.loader.ClassLoaders$AppClassLoader@5bc2b487]
[DEBUG] Configuring mojo execution 'org.apache.maven.plugins:maven-deploy-plugin:3.1.5-SNAPSHOT:deploy-file:default-cli' with basic configurator -->
[DEBUG]   (f) file = D:\target\-.jar
[DEBUG]   (f) generatePom = true
[DEBUG]   (f) javadoc = D:\target\--javadoc.jar
[DEBUG]   (f) offline = false
[DEBUG]   (f) pomFile = D:\pom.xml
[DEBUG]   (f) repositoryId = remote-repository
[DEBUG]   (f) retryFailedDeploymentCount = 1
[DEBUG]   (f) session = org.apache.maven.execution.MavenSession@526f6427
[DEBUG]   (f) skip = false
[DEBUG]   (f) sources = D:\target\--sources.jar
[DEBUG]   (f) url = file:///target/repo
[DEBUG] -- end configuration --

and therefor fails.

With Maven 3.9.16 the configuration is correct

[INFO] --- deploy:3.1.5-SNAPSHOT:deploy-file (default-cli) @ test ---
[DEBUG] Dependency collection stats {ConflictMarker.analyzeTime=417500, ConflictMarker.markTime=50900, ConflictMarker.nodeCount=5, ConflictIdSorter.graphTime=224200, ConflictIdSorter.topsortTime=237100, ConflictIdSorter.conflictIdCount=5, ConflictIdSorter.conflictIdCycleCount=0, ConflictResolver.totalTime=2037500, ConflictResolver.conflictItemCount=5, DfDependencyCollector.collectTime=54384700, DfDependencyCollector.transformTime=4312800}
[DEBUG] org.apache.maven.plugins:maven-deploy-plugin:jar:3.1.5-SNAPSHOT
[DEBUG]    org.codehaus.plexus:plexus-utils:jar:4.0.2:compile
[DEBUG]    org.codehaus.plexus:plexus-xml:jar:3.0.1:compile
[DEBUG]    org.apache.maven.resolver:maven-resolver-util:jar:1.9.27:compile
[DEBUG]       org.apache.maven.resolver:maven-resolver-api:jar:1.9.27:compile
[DEBUG] Created new class realm plugin>org.apache.maven.plugins:maven-deploy-plugin:3.1.5-SNAPSHOT
[DEBUG] Importing foreign packages into class realm plugin>org.apache.maven.plugins:maven-deploy-plugin:3.1.5-SNAPSHOT
[DEBUG]   Imported:  < maven.api
[DEBUG] Populating class realm plugin>org.apache.maven.plugins:maven-deploy-plugin:3.1.5-SNAPSHOT
[DEBUG]   Included: org.apache.maven.plugins:maven-deploy-plugin:jar:3.1.5-SNAPSHOT
[DEBUG]   Included: org.codehaus.plexus:plexus-utils:jar:4.0.2
[DEBUG]   Included: org.codehaus.plexus:plexus-xml:jar:3.0.1
[DEBUG] Loading mojo org.apache.maven.plugins:maven-deploy-plugin:3.1.5-SNAPSHOT:deploy-file from plugin realm ClassRealm[plugin>org.apache.maven.plugins:maven-deploy-plugin:3.1.5-SNAPSHOT, parent: jdk.internal.loader.ClassLoaders$AppClassLoader@5bc2b487]
[DEBUG] Configuring mojo execution 'org.apache.maven.plugins:maven-deploy-plugin:3.1.5-SNAPSHOT:deploy-file:default-cli' with basic configurator -->
[DEBUG]   (f) file = D:\Github\Maven\maven-deploy-plugin\target\it\deploy-attached-sources\target\test-1.0-SNAPSHOT.jar
[DEBUG]   (f) generatePom = true
[DEBUG]   (f) javadoc = D:\Github\Maven\maven-deploy-plugin\target\it\deploy-attached-sources\target\test-1.0-SNAPSHOT-javadoc.jar
[DEBUG]   (f) offline = false
[DEBUG]   (f) pomFile = D:\Github\Maven\maven-deploy-plugin\target\it\deploy-attached-sources\pom.xml
[DEBUG]   (f) repositoryId = remote-repository
[DEBUG]   (f) retryFailedDeploymentCount = 1
[DEBUG]   (f) session = org.apache.maven.execution.MavenSession@1416cf9f
[DEBUG]   (f) skip = false
[DEBUG]   (f) sources = D:\Github\Maven\maven-deploy-plugin\target\it\deploy-attached-sources\target\test-1.0-SNAPSHOT-sources.jar
[DEBUG]   (f) url = file://D:\Github\Maven\maven-deploy-plugin\target\it\deploy-attached-sources/target/repo

edit:
When you pass a "file" argument to the test, it gets weired

I added -Dfile="D:\Github\Maven\maven-deploy-plugin\target\it\deploy-attached-sources\test-1.0-SNAPSHOT.jar to the invoker.properties of invoker.goals.2 as this is the file to be deployed.

This results in the following configuration

[DEBUG]   (f) file = D:\Github\Maven\maven-deploy-plugin\target\it\deploy-attached-sources\D:GithubMavenmaven-deploy-plugin

@Bukama
Copy link
Copy Markdown
Contributor

Bukama commented Jun 6, 2026

@cstamas Could you please check if those a resolver related?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants