How to declare @AnyMetaDef when @Any is in another jar

Hi,
The model is probably incorrect, but the abstract class ROLE is in a dependency.
But his attribute “actor” is of type @ANY, so I have to pass his @AnyMetaDef to him.
In my example, if I put it in ecore.jar @AnyMetaDef it does not know the implementations and if I put it in efluid.jar, when loading the persistent.xml in ecore, it will tell me that it cannot find any @AnyMetaDef with the name “ACTEUR”.

An idea ?

2021-06-09 17_47_21-PlantUML Web Server

@Entity
@Table(name = "TROLE")
@Inheritance(strategy = SINGLE_TABLE)
@DiscriminatorColumn(name="ROLE", length = 80)
public abstract class Role  {

  @Any(metaDef = "ACTEUR", metaColumn = @Column(name = "ACTEUR_ROLE", length = 80), fetch = LAZY)
  @JoinColumn(name = "ACTEUR_ID", columnDefinition = "varchar2(80 char)")
  private ActeurEcore acteur;
...
}

package-info.java in efluid.jar

  @AnyMetaDef(
      name = "ACTEUR",
      idType = "string",
      metaType = "string",
      metaValues = {
        @MetaValue(value = "com.hermes.ref.acteur.businessobject.Acteur", targetEntity = Acteur.class),
        @MetaValue(value = "com.hermes.ref.acteur.businessobject.ActeurGenerique", targetEntity = ActeurGenerique.class),
        @MetaValue(value = "com.hermes.ref.acteur.businessobject.ActeurInterne", targetEntity = ActeurInterne.class),
        @MetaValue(value = "com.hermes.ref.acteur.businessobject.AgenceBancaire", targetEntity = AgenceBancaire.class),
        @MetaValue(value = "com.hermes.ref.acteur.businessobject.Agent", targetEntity = Agent.class)
}

Basically instead of throwing an exception if an @AnyMetaDef already exists with the same name, perform a merge

InFlightMetadataCollectorImpl.java

	@Override
	public void addAnyMetaDef(AnyMetaDef defAnn) {
		if ( anyMetaDefs == null ) {
			anyMetaDefs = new HashMap<>();
		}
		else {
			if ( anyMetaDefs.containsKey( defAnn.name() ) ) {
				throw new AnnotationException( "Two @AnyMetaDef with the same name defined: " + defAnn.name() );
			}
		}

		anyMetaDefs.put( defAnn.name(), defAnn );
	}

I implemented a solution which I am not sure of its effectiveness.

I created a package-info.java with the @AnyMetaDef annotation in ecore jar and the same in the same package in efluid.jar but this time with all possible implementations.

So I end up with 2 package-info.java in the same package but not in the same jar.

It always gets me the one from efluid.jar, but it’s probably related to the order of the classpath …