- 
                Notifications
    You must be signed in to change notification settings 
- Fork 3
Add Resources API with Path-based methods #104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Co-authored-by: laeubi <[email protected]>
Co-authored-by: laeubi <[email protected]>
| // This default implementation resolves paths relative to the current working directory. | ||
| // Custom implementations (e.g., IDE integrations) should override this method | ||
| // to resolve against the actual build context basedir. | ||
| return java.nio.file.Paths.get(relpath); | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should use LegacySupport here to get the current maven project and return the basedir then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated to use LegacySupport to get the current Maven project and resolve paths against the project basedir. Falls back to current working directory if project is not available. See commit 495f4ad.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot see comment we likely need to add a new dependency for org.apache.maven.plugin.LegacySupport (scope provided)
Also the readme needs to be updated to mention the new API
… and update README Co-authored-by: laeubi <[email protected]>
| 
 The maven-core dependency (scope provided) already exists in the POM, which includes LegacySupport. Updated DefaultResources to inject and use LegacySupport for basedir resolution. Also updated the README with documentation for the new Resources API. See commit 495f4ad. | 
Provide a new Resources API
This PR implements a new Resources API as requested in issue #76, following the same pattern as the Messages and Progress APIs.
Summary of Changes:
✅ New
org.codehaus.plexus.build.resourcespackage with:ResourcesInterface - Modern Path-based API with the following methods:hasDelta(Path file)- Check if file has changes (documented as "best effort" hint)refresh(Path file)- Mark file as modified during buildnewOutputStream(Path file)- Get output stream with change detection optimizationnewOutputStream(Path file, boolean derived)- Output stream with optional derived markerisUptodate(Path target, Path source)- Check if target is up-to-date with source (recommended over hasDelta for input/output scenarios)getPath(String relpath)- Convert relative path to Path (now uses Maven project basedir via LegacySupport)markDerived(Path file)- Mark file as generated/derived (IDE integration support)copy(Path source, Path target)- Convenience method to copy only when neededDefaultResourcesImplementation - Delegates to BuildContext for compatibility✅ Deprecated resource-related methods in BuildContext:
hasDelta(String),hasDelta(File),hasDelta(List<String>)refresh(File)newFileOutputStream(File)isUptodate(File, File)✅ Updated README with documentation for the new Resources API
✅ Key Design Decisions:
✅ Build Status: All builds passing with expected deprecation warnings
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.