Skip to content
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

Closed
wants to merge 1 commit into from
Closed

Conversation

lasselindqvist
Copy link

@lasselindqvist lasselindqvist commented Oct 25, 2018

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.

Remove metadata when deleting a single artifact from local cache.
@lasselindqvist
Copy link
Author

@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 );
Copy link
Member

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.

Copy link
Author

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.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you could ping me, @olamy or @hboutemy.
Best approach is to post to the mailing list (google groups).

@@ -89,6 +97,9 @@ public void execute()
if ( removeAll )
{
localArtifactDirectory = localArtifactDirectory.getParentFile();
} else {
File metadataFile = new File( localArtifactDirectory, "maven-metadata-local.xml" );
Copy link
Member

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

@github-actions
Copy link

github-actions bot commented Jul 7, 2022

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.

@github-actions github-actions bot added the Stale label Jul 7, 2022
@slachiewicz slachiewicz removed the Stale label Jul 7, 2022
@github-actions
Copy link

github-actions bot commented Jul 8, 2023

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.

@github-actions github-actions bot added the Stale label Jul 8, 2023
@github-actions github-actions bot closed this Aug 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants