We have another team who is going to expose class packages for use to scan and pickup details from. If they should add some new packages or rename old ones I don't want to have to recode a thing. I am trying to get some input on the best way to accomplish that

For the sake of maintainability we only want the code for processing and scanning this dependency done once. When the version from app1 bumps, app2 can bump and if there are new files or even new or renamed packages to scan then app2 simply discovers this and no one has to do any work. Can the packages be published to a properties file I can wire in?

app1 wants to "expose"


but in a newer version a new package is added and the previous 2 are moved:


Ideally, app2 should only have to do this integration once.

I had imagined an alias that gets set in a filtered maven property file. Something like

model.packages =     com.company.org1.model.abc, com.company.org2.mode.def, com.company.model.ghi

Such that, in app2 code we can simply do:

import org.reflections.Reflections;
import org.reflections.scanners.SubTypesScanner;
public class EntityService {

    private String[] packages;

    public Set<Class<?>> getEntityClasses() {
        Reflections reflections = new Reflections(packages, new SubTypesScanner(false));

        Set<Class<?>> subTypesOf = reflections.getSubTypesOf(Object.class);
        return subTypesOf;

I was thinking that basically having a


in each to-be-exposed package might work.


  • 1
    \$\begingroup\$ Have you considered using JAR manifests? \$\endgroup\$ – 200_success Jan 14 '15 at 4:30
  • \$\begingroup\$ I haven't, but that isn't any better than a maven generated property. Infact, I can use maven to generate the manifest. I can tell the team how to implement this. I just need to know how \$\endgroup\$ – Christian Bongiorno Jan 14 '15 at 4:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.