apache / apache/maven-invoker-plugin

invoker:install behaves different, depending on the lifecycle phase

Open
#679 1 comment 0 reactions 0 assignees View on GitHub
bug question
Dominant language
Java
Stars
22
Forks
35
Avg merge
2d 17h
Merged PRs (30d)
7

Description

### Affected version

3.9.11

### Bug description

When executing `invoker:install` as part of a larger, build, it will install the artifacts of the current project in the local repository. E.g. when executed as part of a build (compile, test etc.), this subproject installs its main artifact and the attached artifacts (project name is 'jdbi3-caffeine-cache'):

```
[INFO] --- invoker:3.9.2-SNAPSHOT:install (basepom.invoker-integration-testing.default) @ jdbi3-caffeine-cache ---
[INFO] Installing /Users/henning/code/jdbi/cache/caffeine-cache/target/jdbi3-caffeine-cache-3.50.0-SNAPSHOT.jar to /Users/henning/code/jdbi/cache/caffeine-cache/target/local-repo/org/jdbi/jdbi3-caffeine-cache/3.50.0-SNAPSHOT/jdbi3-caffeine-cache-3.50.0-SNAPSHOT.jar
[INFO] Installing /Users/henning/code/jdbi/cache/caffeine-cache/target/jdbi3-caffeine-cache-3.50.0-SNAPSHOT-tests.jar to /Users/henning/code/jdbi/cache/caffeine-cache/target/local-repo/org/jdbi/jdbi3-caffeine-cache/3.50.0-SNAPSHOT/jdbi3-caffeine-cache-3.50.0-SNAPSHOT-tests.jar
[INFO] Installing /Users/henning/code/jdbi/cache/caffeine-cache/target/jdbi3-caffeine-cache-3.50.0-SNAPSHOT-sources.jar to /Users/henning/code/jdbi/cache/caffeine-cache/target/local-repo/org/jdbi/jdbi3-caffeine-cache/3.50.0-SNAPSHOT/jdbi3-caffeine-cache-3.50.0-SNAPSHOT-sources.jar
[INFO] Installing /Users/henning/code/jdbi/cache/caffeine-cache/target/jdbi3-caffeine-cache-3.50.0-SNAPSHOT-test-sources.jar to /Users/henning/code/jdbi/cache/caffeine-cache/target/local-repo/org/jdbi/jdbi3-caffeine-cache/3.50.0-SNAPSHOT/jdbi3-caffeine-cache-3.50.0-SNAPSHOT-test-sources.jar
[INFO] Installing /Users/henning/code/jdbi/cache/caffeine-cache/pom.xml to /Users/henning/code/jdbi/cache/caffeine-cache/target/local-repo/org/jdbi/jdbi3-caffeine-cache/3.50.0-SNAPSHOT/jdbi3-caffeine-cache-3.50.0-SNAPSHOT.pom
```

running the same command standalone for the project (only invoke `mvn invoker:install`), results in this:

```
[INFO] --- invoker:3.9.2-SNAPSHOT:install (default-cli) @ jdbi3-caffeine-cache ---
[INFO] Installing /Users/henning/code/jdbi/cache/caffeine-cache/pom.xml to /Users/henning/code/jdbi/cache/caffeine-cache/target/local-repo/org/jdbi/jdbi3-caffeine-cache/3.50.0-SNAPSHOT/jdbi3-caffeine-cache-3.50.0-SNAPSHOT.pom
```

So the artifacts are missing.

I understand *why* that happens (the various artifacts are attached as part of the build cycle (e.g. compile attaches the main jar, test attaches the test jar, sources attaches the sources etc.). Is it possible to "emulate" this behavior (e.g. inspect the current project folder and attach the artifacts directly? ChatGPT suggested writing a plugin that does exactly that, but that seems overkill.

(Maven 3.9.11, invoker plugin 3.9.1 or "HEAD" (3.9.2-SNAPSHOT)).

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at the invoker:install goal and compare its execution after lifecycle phases with standalone mvn invoker:install execution. Reproduce both cases with Maven 3.9.11, then inspect how attached artifacts are discovered; done means both paths consistently install the main and attached artifacts.

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
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.