-
Notifications
You must be signed in to change notification settings - Fork 82
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
Fixes Issue #64 #70
Fixes Issue #64 #70
Conversation
Remove metadata when deleting a single artifact from local cache.
@khmarbaise any chance of getting this looked at? |
static void modifyMetadataFile( MavenProject mavenProject, File metadataFile ) throws MojoFailureException { | ||
if ( metadataFile.exists() ) { | ||
try { | ||
Reader reader = ReaderFactory.newXmlReader( metadataFile ); |
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.
Resource leak ... readers and writers should be closed: see https://programming.guide/java/try-with-resources.html for an example.
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.
I could fix this, but there does not seem to be any activity for merging PRs here. I have already forgotten my personal usecase here.
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.
@@ -89,6 +97,9 @@ public void execute() | |||
if ( removeAll ) | |||
{ | |||
localArtifactDirectory = localArtifactDirectory.getParentFile(); | |||
} else { | |||
File metadataFile = new File( localArtifactDirectory, "maven-metadata-local.xml" ); |
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.
The "local" should be probably configurable ... but it can be done also in some future PR if someone would need it.
https://maven.apache.org/ref/3.2.5/maven-repository-metadata/index.html
This PR is stale because it has been open 365 days with no activity. Remove stale label or comment or this will be closed in 30 days. |
This PR is stale because it has been open 365 days with no activity. Remove stale label or comment or this will be closed in 30 days. |
Fixes issue #64.
Removes metadata when deleting a single artifact from local cache.
The solution assumes that the file is named maven-metadata-local.xml but does not crash if it does not exist. Not totally sure if this works for all repository layouts, since Maven core libraries handled metadata in multiple different ways.