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

Respect filter on library merge #114

Merged
merged 2 commits into from
Aug 24, 2020
Merged

Respect filter on library merge #114

merged 2 commits into from
Aug 24, 2020

Conversation

nicymike
Copy link
Contributor

@nicymike nicymike commented Aug 22, 2020

I need to add jackson to my project but I there are some files I don't want to be included in the final jar. This pull request addresses the fact that filter is beeing ignored on libraries.

I tested the code and verified that the filter is now working.

Example pom:

<inclusion>
  <groupId>com.fasterxml.jackson.core</groupId>
  <artifactId>jackson-databind</artifactId>
  <!-- Some files should not be included in jar -->
  <filter>!META-INF/maven/**,!META-INF/LICENSE,!META-INF/MANIFEST.MF,!META-INF/NOTICE</filter>
  <library>true</library>
</inclusion>

}
}

jarArchiver.addArchivedFileSet(file,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is not deprecated yet and also not in newest maven-archiver version 3.5.0 which includes plexus-archiver 2.4.
I can change my code to use the new method if you want.

Btw. maven-archiver used in this plugin is more than ten years old:
https://search.maven.org/artifact/org.apache.maven/maven-archiver

Copy link
Collaborator

Choose a reason for hiding this comment

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

addArchivedFileSet(File archiveFile, String[] includes, String[] excludes)
is deprecated in that link, but
addArchivedFileSet(ArchivedFileSet fileSet)
is not.

Not sure since which version that is though, probably the newest. (4.2.2?)
Anyway, not necessary to change that since the new method might not even exist in the version we use.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are right, the link points to 4.2.2 where the method mentioned is deprecated.
Regarding to my IDE the used version in proguard-maven-plugin is much older.
image

I did a quick test by changing the dependency of maven-archiver to 3.5.0 but this leads to compile errors and more deprecated code.

@lasselindqvist
Copy link
Collaborator

Did you test this with an empty filter and no filter parameter as well?

@nicymike
Copy link
Contributor Author

Yes, tested without filter and with empty filter, which will be also set to null. I do not add includes/excludes on null.

@lasselindqvist lasselindqvist merged commit db24890 into wvengen:master Aug 24, 2020
@nicymike
Copy link
Contributor Author

nicymike commented Aug 24, 2020

Thank you for merging. When do you plan to do the next release? I need this change for one of my projects.
Also release 2.3.0 is not visible on GitHub.

@lasselindqvist
Copy link
Collaborator

Planning to release this week with #115

I'll add both releases to Github as well. Not sure if people use those for anything though, maybe Ant users?

@nicymike
Copy link
Contributor Author

I'm using GitHub release notifications on some projects to be informed about new versions. This is really useful as I don't need to check versions manually.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants