apache / apache/maven

[MNG-7120] Packaged artifacts from modules in the same reactor are not available anymore

Open
#8,326 0 comments 0 reactions 0 assignees View on GitHub
bug priority:major
Dominant language
Java
Stars
5.3k
Forks
3.1k
Avg merge
20h 42m
Merged PRs (30d)
297

Description

**[Guillaume Nodet](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=gnt)** opened **[MNG-7120](https://issues.apache.org/jira/browse/MNG-7120?redirect=false)** and commented

With the current maven 4 branch, some projects fail when they are not built from the top of the reactor. This happens when unpacking an artifact using the maven-dependency-plugin. This is definitely a regression which I suspect is caused by the changes in the reactor. I'll provide a PR with an IT soon.

```
[INFO] --- maven-dependency-plugin:3.1.2:unpack (process-sources) @ camel-spring-xml ---
[INFO] Configured Artifact: org.apache.camel:camel-api:sources:3.9.0-SNAPSHOT:jar
[INFO] Configured Artifact: org.apache.camel:camel-core-model:sources:3.9.0-SNAPSHOT:jar
[INFO] Configured Artifact: org.apache.camel:camel-core-xml:sources:3.9.0-SNAPSHOT:jar
[INFO] Configured Artifact: org.apache.camel:camel-util:sources:3.9.0-SNAPSHOT:jar
[INFO] Unpacking /Users/gnodet/work/git/camel/core/camel-api/target/classes to /Users/gnodet/work/git/camel/components/camel-spring-xml/target/sources/camel-api with includes "**/*" and excludes ""
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.010 s (Wall Clock)
[INFO] Finished at: 2021-03-16T14:40:51+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:3.1.2:unpack (process-sources) on project camel-spring-xml: Artifact has not been packaged yet. When used on reactor artifact, unpack should be executed after packaging: see MDEP-98. -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:3.1.2:unpack (process-sources) on project camel-spring-xml: Artifact has not been packaged yet. When used on reactor artifact, unpack should be executed after packaging: see MDEP-98.
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:218)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:159)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:151)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:115)
at org.mvndaemon.mvnd.builder.SmartBuilderImpl.buildProject(SmartBuilderImpl.java:178)
at org.mvndaemon.mvnd.builder.SmartBuilderImpl$ProjectBuildTask.run(SmartBuilderImpl.java:198)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: org.apache.maven.plugin.MojoExecutionException: Artifact has not been packaged yet. When used on reactor artifact, unpack should be executed after packaging: see MDEP-98.
at org.apache.maven.plugins.dependency.AbstractDependencyMojo.unpack(AbstractDependencyMojo.java:257)
at org.apache.maven.plugins.dependency.fromConfiguration.UnpackMojo.unpackArtifact(UnpackMojo.java:137)
at org.apache.maven.plugins.dependency.fromConfiguration.UnpackMojo.doExecute(UnpackMojo.java:116)
at org.apache.maven.plugins.dependency.AbstractDependencyMojo.execute(AbstractDependencyMojo.java:144)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:136)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)
... 10 common frames omitted
```

---

**Affects:** 3.0-alpha-1

Contributor guide

Open the contributing guide

Research direction

Start with the Maven 4 reactor changes and the maven-dependency-plugin path shown in the trace, especially AbstractDependencyMojo.unpack and UnpackMojo. Reproduce the failure when a project is not built from the top of the reactor, then add the integration test mentioned in the issue. Done means reactor module artifacts can be unpacked without the “Artifact has not been packaged yet” failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.