add legal files to built artifacts (#22714)

Signed-off-by: Lukas Jungmann <lukas.jungmann@oracle.com>
diff --git a/nucleus/parent/pom.xml b/nucleus/parent/pom.xml
index cf30f0e..3b74256 100644
--- a/nucleus/parent/pom.xml
+++ b/nucleus/parent/pom.xml
@@ -378,6 +378,16 @@
                 <version>3.0.0</version>
                 <executions>
                     <execution>
+                        <id>find-root</id>
+                        <phase>validate</phase>
+                        <goals>
+                            <goal>rootlocation</goal>
+                        </goals>
+                        <configuration>
+                            <rootLocationProperty>legal.doc.source</rootLocationProperty>
+                        </configuration>
+                    </execution>
+                    <execution>
                         <id>add-resource</id>
                         <phase>generate-resources</phase>
                         <goals>
@@ -391,6 +401,25 @@
                             </resources>
                         </configuration>
                     </execution>
+                    <execution>
+                        <id>add-legal-resource</id>
+                        <phase>generate-resources</phase>
+                        <goals>
+                            <goal>add-resource</goal>
+                        </goals>
+                        <configuration>
+                            <resources>
+                                <resource>
+                                    <directory>${legal.doc.source}</directory>
+                                    <includes>
+                                        <include>NOTICE.md</include>
+                                        <include>LICENSE.md</include>
+                                    </includes>
+                                    <targetPath>META-INF</targetPath>
+                                </resource>
+                            </resources>
+                        </configuration>
+                    </execution>
                 </executions>
             </plugin>