elharo opened a new pull request, #382:
URL: https://github.com/apache/maven-antrun-plugin/pull/382
Fixes #375
## Summary
`AttachArtifactTask` cast the reference resolved from `mavenProjectRefId` to
`MavenAntRunProject` unconditionally. When the attribute pointed at a plain
`MavenProject` reference (e.g. `maven.project`, which `AntRunMojo` also
registers), the task threw a raw `ClassCastException`.
## Changes
- `AttachArtifactTask.java`: resolve the Maven project by type. A
`MavenAntRunProject` reference is unwrapped, a `MavenProject` reference is used
directly, and any other type is rejected with a clear `BuildException` instead
of a `ClassCastException`.
- New unit test `AttachArtifactTaskTest` covering:
- `mavenProjectRefId` pointing at a plain `MavenProject` (previously
`ClassCastException`),
- the default `MavenAntRunProject` wrapper keeps working,
- an incompatible reference type is rejected with a `BuildException`.
## Verification
- New tests fail on master (`ClassCastException`) and pass with the fix.
- `mvn verify` (rat, checkstyle, spotless, unit tests, javadoc) passes.
- `mvn verify -Prun-its` passes: all 29 integration tests succeed.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]