michael-o commented on code in PR #1387: URL: https://github.com/apache/maven/pull/1387#discussion_r1459367029
########## api/maven-api-core/src/main/java/org/apache/maven/api/Project.java: ########## @@ -68,12 +68,31 @@ public interface Project { String getPackaging(); /** - * Returns the project artifact, that is the artifact produced by this project build. + * Returns the project POM artifact, that is the artifact of the POM of this project. Every project have POM + * artifact, while the existence of backing POM file is NOT a requirement (i.e. for some transient projects). * * @see org.apache.maven.api.services.ArtifactManager#getPath(Artifact) */ @Nonnull - Artifact getArtifact(); + default Artifact getPomArtifact() { + return getArtifacts().get(0); + } + + /** + * Returns the project artifact, that is the artifact produced by this project build. This artifact MAY be same + * as the one returned by {@link #getPomArtifact()}, if the project is actually not producing any main artifact. + * <p> + * If only non-POM artifacts are needed, better use {@link #getArtifacts()} method: if that method returns list + * having one element, the methods {@link #getPomArtifact()} and this one will return same artifact. + * + * @see #getArtifacts() + * @see org.apache.maven.api.services.ArtifactManager#getPath(Artifact) + */ + @Nonnull + default Artifact getArtifact() { + List<Artifact> artifacts = getArtifacts(); + return artifacts.get(artifacts.size() - 1); Review Comment: Wait a second, if there are other attached artifacts this will not work, will it? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org