@@ -18,8 +18,9 @@ To include the plugin, use the following dependency:
18
18
</dependency>
19
19
----
20
20
21
- [NOTE]
22
- ====
21
+ [[model-resolution]]
22
+ == Model Resolution in the Maven Plugin
23
+
23
24
The current implementation of the `esmf-aspect-model-maven-plugin` uses the
24
25
`FileSystemStrategy` or the `GitHubStrategy`, or combination of both, to resolve Aspect Models. See
25
26
xref:java-aspect-tooling.adoc#understanding-model-resolution[Understanding Model Resolution] for
@@ -55,7 +56,9 @@ Settings] should contain a corresonding `<server>` entry:
55
56
</servers>
56
57
</settings>
57
58
----
58
- ====
59
+
60
+ It is possible to provide a custom model resolution strategy to the
61
+ `esmf-aspect-model-maven-plugin`. See section <<custom-model-resolution>> for more information.
59
62
60
63
== Validating an Aspect Model
61
64
@@ -880,3 +883,68 @@ Configuration Properties:
880
883
| `includes` | A list of AAS files to convert. | `String` | none | {ok}
881
884
| `outputDirectory` | The path to the directory where the generated Aspect Models will be written to. | `String` | none | {ok}
882
885
|===
886
+
887
+ [[custom-model-resolution]]
888
+ == Custom Model Resolution
889
+
890
+ It is possible to provide a custom model resolution strategy implementation to the
891
+ `esmf-aspect-model-maven-plugin` that is used instead of the
892
+ xref:maven-plugin.adoc#model-resolution[built-in resolution strategies]. This is done using the Java
893
+ https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/util/ServiceLoader.html[ServiceLoader].
894
+ To provide your own resolution strategy, you need to:
895
+
896
+ . Create a class that implements `org.eclipse.esmf.aspectmodel.resolver.ResolutionStrategy`.
897
+ . Register the class as a service: create a file
898
+ `META-INF/services/org.eclipse.esmf.aspectmodel.resolver.ResolutionStrategy` that contains one line
899
+ with the fully qualified name of your resolver class.
900
+ . Bundle your class as a Maven artifact. In order to use your custom resolver with the
901
+ `esmf-aspect-model-maven-plugin`, declare your artifact as a plugin dependency:
902
+ +
903
+ [source,xml,subs=attributes+]
904
+ ----
905
+ <build>
906
+ <plugins>
907
+ <plugin>
908
+ <artifactId>esmf-aspect-model-maven-plugin</artifactId>
909
+ <dependencies>
910
+ <dependency>
911
+ <groupId>your.resolver.group.id</groupId>
912
+ <artifactId>your.resolver.artifact.id</artifactId>
913
+ <version>1.0.0</version>
914
+ </dependency>
915
+ </dependencies>
916
+ <configuration>
917
+ <!-- ... -->
918
+ </configuration>
919
+ </plugin>
920
+ </plugins>
921
+ </build>
922
+ ----
923
+
924
+ In order to enable users of your custom resolver to pass arguments to your resolver implementation,
925
+ they can use a block called `<resolutionConfiguration>` in the plugin `<configuration>`:
926
+
927
+ [source,xml,subs=attributes+]
928
+ ----
929
+ <build>
930
+ <plugins>
931
+ <plugin>
932
+ <artifactId>esmf-aspect-model-maven-plugin</artifactId>
933
+ <!-- ... -->
934
+ <configuration>
935
+ <resolutionConfiguration>
936
+ <my.custom.property>...</my.custom.property>
937
+ </resolutionConfiguration>
938
+ </configuration>
939
+ </plugin>
940
+ </plugins>
941
+ </build>
942
+ ----
943
+
944
+ The ResolutionStrategy implementation can access these properties using `System.getProperty()`,
945
+ e.g.:
946
+
947
+ [source,java,subs=attributes+]
948
+ ----
949
+ String myCustomProperty = System.getProperty("my.custom.property");
950
+ ----
0 commit comments