apache / apache/maven-jar-plugin

[MJAR-138] jar:test-jar is skipped when maven.test.skip=true

Open
#308 15 comments 2 reactions 0 assignees View on GitHub
enhancement help wanted Stale
Dominant language
Java
Stars
92
Forks
84
Avg merge
19h 45m
Merged PRs (30d)
6

Description

**[Andrew Hughes](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=ahhughes)** opened **[MJAR-138](https://issues.apache.org/jira/browse/MJAR-138?redirect=false)** and commented

Not sure if this is a bug or improvement...

Example:
* ./pom.xml
* ./moduleA/pom.xml
* ./moduleB/pom.xml

Situation:
* moduleA produces moduleA-1.2.3-test.jar with the jar:test-jar goal
* moduleB consumes moduleA-1.2.3-test.jar as a \...\test\\

Problem:
* When -Dmaven.test.skip=true the moduleA-1.2.3-test.jar is never built.
* Then when moduleB tries to build, it's moduleA-1.2.3-test.jar dependency is unresolved. FAIL! Even with -Dmaven.test.skip=true this will fail.

You might argue that this is a bug with dependency resolution with -Dmaven.test.skip=true - should a missing dependency @ test scope really fail the build??? It probably should - which is why the bug is submitted here :)

I've no idea what could be done to fix this either?

p.s. for anyone with this bug the only workaround I can suggest is running another module...

./moduleA-test/pom.xml

and have \...\moduleA-test\...\test\\

---

**Affects:** 2.3.1

**Attachments:**
- [MJAR-138-maven-jar-plugin.patch](https://issues.apache.org/jira/secure/attachment/12716779/MJAR-138-maven-jar-plugin.patch) (_1.06 kB_)

**Issue Links:**
- [MJAR-90](https://issues.apache.org/jira/browse/MJAR-90) when maven.test.Skip is set, the test-jar artifact is empty

18 votes, 25 watchers

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reviewing the attached maven-jar-plugin.patch and the jar:test-jar goal, then reproduce the multi-module example with moduleA and moduleB using -Dmaven.test.skip=true. Check how the test-jar artifact is handled when tests are skipped, and use the existing issue context and MJAR-90 link to define the expected behavior. Done means the documented dependency scenario no longer fails unexpectedly.

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
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.