Any way to undo some maven annotations?

I wonder if there is a way to remove some annotations when " maven build "?

For convenience, I annotate annotation Parties, the Parties in their POJO, for example javax.persistence.*, org.hibernate.annotations.*, org.apache.lucene.analysis.*... blah ... blah.

This works well when I put them together and deploy them on a JavaEE / Spring server / container.

But when developing Android, I want to make the most of my / POJO code . I want to import foobar.core.User directly instead of creating another foobar.android.User without third-party annotations. That is, I do not want the jar to depend on other spring / hibernate artifacts.

So, is there a way to remove some annotations when running 'maven build'? I just need to remove the “some” third-party annotations and save the custom annotations of the main code.

So, I can build foobar-core.jarboth foobar-core-stripped.jar accordingly or simultaneously .

+3
source share
3 answers

Trying to do the same. I found an ant task that can flush annotations from compiled classes.

http://sourceforge.net/projects/purgeannorefs/

The maven ant plugin can then be used to invoke the ant task as part of your maven build.

I know this is a bit of a workaround. But better than having 2 copies of pojo objects.

+1
source

non-maven, , maven. Mmake Android.

0

You can use maven-antrun-plugin to search and replace in all annotations ... I did this in the following answer to comment on all @XmlAttribute annotations:

fooobar.com/questions/1812592 / ...

Kind of hacks, but it worked for me.

0
source

All Articles