[MNG-5384] Declarative artifacts
- Dominant language
- Java
- Stars
- 5.3k
- Forks
- 3.1k
- Avg merge
- 20h 42m
- Merged PRs (30d)
- 297
Description
**[Tuomas Kiviaho](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=tuomas_kiviaho)** opened **[MNG-5384](https://issues.apache.org/jira/browse/MNG-5384?redirect=false)** and commented
Currently there's no way to know which attachments a project is going to have beforehand. Lack of this feature is currently patched inside Aether where test-jar for instance has a special treatment prior packaging phase so that we can get a file pointer to ${project.target.testOutputDirectory}.
Maven 2 had this hack embedded inside of it, but with Maven 3 the project attachments list doesn't contain test-jar until it is actually added to the project. I had to patch MBUILDHELPER-41 to be able attach this artifact prior packaging phase and remove it at prepare-package so that the actual attachment could be added to the project.
I propose that POM could have a section similar to `build.finalName` where you'd list the attacments that the project is going to introduce. For backwards compatibility this of course would not be required. Plugins such as jar, sources and javadoc could kick in automatically when pom contains the respective declarations (race conditions would arise between maven-bundle-plugin and jar for instance).
---
**Affects:** 3.0.4
**Issue Links:**
- [MNG-5868](https://issues.apache.org/jira/browse/MNG-5868) Adding several times the same artifact via MavenProjectHelper (attachArtifact) keep adding to the List duplicate artifacts
- [MNG-7316](https://issues.apache.org/jira/browse/MNG-7316) REGRESSION: MavenProject.getAttachedArtifacts() is read-only
- [MNG-2596](https://issues.apache.org/jira/browse/MNG-2596) Allow support for multiple classifier for a given artifact
- [MNG-2649](https://issues.apache.org/jira/browse/MNG-2649) Allow support for property list based artifact qualifying (enhanced classifiers)
**Remote Links:**
- [Page
](https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=65875544)
Contributor guide
Research direction
Start by reviewing MavenProject.getAttachedArtifacts(), MavenProjectHelper.attachArtifact, and the linked issues about duplicate and read-only attached artifacts. Define how a declarative POM attachment section should interact with plugin phases and existing projects; done means the proposal is implemented without breaking backwards compatibility and attachment handling is covered.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- build-system
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100