Maven build issue with Maven 3.8.2 fix (#1244)

Signed-off-by: Radek Felcman <radek.felcman@oracle.com>
diff --git a/bundles/eclipselink/pom.xml b/bundles/eclipselink/pom.xml
index 8e30726..5320168 100644
--- a/bundles/eclipselink/pom.xml
+++ b/bundles/eclipselink/pom.xml
@@ -187,6 +187,14 @@
         <!-- included artifacts -->
         <dependency>
             <groupId>org.eclipse.persistence</groupId>
+            <artifactId>org.eclipse.persistence.parent</artifactId>
+            <version>${project.version}</version>
+            <type>zip</type>
+            <classifier>common-license</classifier>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.eclipse.persistence</groupId>
             <artifactId>org.eclipse.persistence.asm</artifactId>
             <scope>provided</scope>
         </dependency>
diff --git a/bundles/eclipselink/src/main/assembly/eclipselink.zip.xml b/bundles/eclipselink/src/main/assembly/eclipselink.zip.xml
index 6bea3bf..a1469b1 100644
--- a/bundles/eclipselink/src/main/assembly/eclipselink.zip.xml
+++ b/bundles/eclipselink/src/main/assembly/eclipselink.zip.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
 
-    Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.
+    Copyright (c) 2019, 2021 Oracle and/or its affiliates. All rights reserved.
 
     This program and the accompanying materials are made available under the
     terms of the Eclipse Public License v. 2.0 which is available at
@@ -22,6 +22,21 @@
     </formats>
     <includeBaseDirectory>false</includeBaseDirectory>
     <dependencySets>
+        <!--License files-->
+        <dependencySet>
+            <useProjectArtifact>false</useProjectArtifact>
+            <scope>provided</scope>
+            <outputDirectory>eclipselink/</outputDirectory>
+            <includes>
+                <include>${project.groupId}:org.eclipse.persistence.parent:zip:common-license</include>
+            </includes>
+            <unpack>true</unpack>
+            <unpackOptions>
+                <includes>
+                    <include>*.html</include>
+                </includes>
+            </unpackOptions>
+        </dependencySet>
         <dependencySet>
             <useProjectAttachments>true</useProjectAttachments>
             <outputDirectory>eclipselink/jlib/</outputDirectory>
@@ -113,16 +128,6 @@
         </dependencySet>
     </dependencySets>
     <fileSets>
-        <!--License files-->
-        <fileSet>
-            <directory>${project.root.location}</directory>
-            <outputDirectory>eclipselink/</outputDirectory>
-            <includes>
-                <include>about.html</include>
-                <include>license.html</include>
-                <include>readme.html</include>
-            </includes>
-        </fileSet>
         <!--Scripts to bin directory-->
         <fileSet>
             <directory>${project.build.scriptSourceDirectory}</directory>
diff --git a/bundles/moxy-standalone/pom.xml b/bundles/moxy-standalone/pom.xml
index 1017e5c..968332f 100644
--- a/bundles/moxy-standalone/pom.xml
+++ b/bundles/moxy-standalone/pom.xml
@@ -37,6 +37,14 @@
     <dependencies>
         <dependency>
             <groupId>org.eclipse.persistence</groupId>
+            <artifactId>org.eclipse.persistence.parent</artifactId>
+            <version>${project.version}</version>
+            <type>zip</type>
+            <classifier>common-license</classifier>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.eclipse.persistence</groupId>
             <artifactId>org.eclipse.persistence.moxy</artifactId>
         </dependency>
         <dependency>
diff --git a/bundles/moxy-standalone/src/main/assembly/moxy.xml b/bundles/moxy-standalone/src/main/assembly/moxy.xml
index ecc1893..67768b1 100644
--- a/bundles/moxy-standalone/src/main/assembly/moxy.xml
+++ b/bundles/moxy-standalone/src/main/assembly/moxy.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
 
-    Copyright (c) 2020 Oracle and/or its affiliates. All rights reserved.
+    Copyright (c) 2020, 2021 Oracle and/or its affiliates. All rights reserved.
 
     This program and the accompanying materials are made available under the
     terms of the Eclipse Public License v. 2.0 which is available at
@@ -22,6 +22,21 @@
     </formats>
     <includeBaseDirectory>false</includeBaseDirectory>
     <dependencySets>
+        <!--License files-->
+        <dependencySet>
+            <useProjectArtifact>false</useProjectArtifact>
+            <scope>provided</scope>
+            <outputDirectory>moxy</outputDirectory>
+            <includes>
+                <include>${project.groupId}:org.eclipse.persistence.parent:zip:common-license</include>
+            </includes>
+            <unpack>true</unpack>
+            <unpackOptions>
+                <includes>
+                    <include>*.html</include>
+                </includes>
+            </unpackOptions>
+        </dependencySet>
         <dependencySet>
             <useProjectArtifact>false</useProjectArtifact>
             <outputDirectory>moxy/jlib/</outputDirectory>
@@ -29,16 +44,6 @@
         </dependencySet>
     </dependencySets>
     <fileSets>
-        <!--License files-->
-        <fileSet>
-            <directory>${project.root.location}</directory>
-            <outputDirectory>moxy/</outputDirectory>
-            <includes>
-                <include>about.html</include>
-                <include>license.html</include>
-                <include>readme.html</include>
-            </includes>
-        </fileSet>
         <!--Scripts to bin directory-->
         <fileSet>
             <directory>${generated.res.dir}/xsds</directory>
diff --git a/bundles/others/pom.xml b/bundles/others/pom.xml
index 9cfafc8..a27aead 100644
--- a/bundles/others/pom.xml
+++ b/bundles/others/pom.xml
@@ -52,6 +52,14 @@
         <!--Other modules-->
         <dependency>
             <groupId>org.eclipse.persistence</groupId>
+            <artifactId>org.eclipse.persistence.parent</artifactId>
+            <version>${project.version}</version>
+            <type>zip</type>
+            <classifier>common-license</classifier>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.eclipse.persistence</groupId>
             <artifactId>eclipselink</artifactId>
         </dependency>
         <dependency>
diff --git a/bundles/others/src/main/assembly/common-license.xml b/bundles/others/src/main/assembly/common-license.xml
deleted file mode 100644
index 7fafd61..0000000
--- a/bundles/others/src/main/assembly/common-license.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
-    Copyright (c) 2019 Oracle and/or its affiliates. All rights reserved.
-
-    This program and the accompanying materials are made available under the
-    terms of the Eclipse Public License v. 2.0 which is available at
-    http://www.eclipse.org/legal/epl-2.0,
-    or the Eclipse Distribution License v. 1.0 which is available at
-    http://www.eclipse.org/org/documents/edl-v10.php.
-
-    SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
-
--->
-
-<component xmlns="http://maven.apache.org/ASSEMBLY-COMPONENT/2.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-           xsi:schemaLocation="http://maven.apache.org/ASSEMBLY-COMPONENT/2.0.0 http://maven.apache.org/xsd/assembly-component-2.0.0.xsd">
-    <fileSets>
-        <fileSet>
-            <directory>${project.root.location}</directory>
-            <outputDirectory>.</outputDirectory>
-            <includes>
-                <include>about.html</include>
-                <include>license.html</include>
-                <include>readme.html</include>
-            </includes>
-        </fileSet>
-    </fileSets>
-</component>
\ No newline at end of file
diff --git a/bundles/others/src/main/assembly/eclipselink-plugins-nosql.zip.xml b/bundles/others/src/main/assembly/eclipselink-plugins-nosql.zip.xml
index d6e1ee2..34946e7 100644
--- a/bundles/others/src/main/assembly/eclipselink-plugins-nosql.zip.xml
+++ b/bundles/others/src/main/assembly/eclipselink-plugins-nosql.zip.xml
@@ -21,10 +21,22 @@
         <format>zip</format>
     </formats>
     <includeBaseDirectory>false</includeBaseDirectory>
-    <componentDescriptors>
-        <componentDescriptor>src/main/assembly/common-license.xml</componentDescriptor>
-    </componentDescriptors>
     <dependencySets>
+        <!--License files-->
+        <dependencySet>
+            <useProjectArtifact>false</useProjectArtifact>
+            <scope>provided</scope>
+            <outputDirectory>.</outputDirectory>
+            <includes>
+                <include>${project.groupId}:org.eclipse.persistence.parent:zip:common-license</include>
+            </includes>
+            <unpack>true</unpack>
+            <unpackOptions>
+                <includes>
+                    <include>*.html</include>
+                </includes>
+            </unpackOptions>
+        </dependencySet>
         <dependencySet>
             <includes>
                 <include>org.eclipse.persistence:org.eclipse.persistence.nosql</include>
diff --git a/bundles/others/src/main/assembly/eclipselink-plugins.zip.xml b/bundles/others/src/main/assembly/eclipselink-plugins.zip.xml
index 0999d05..c0f3f8a 100644
--- a/bundles/others/src/main/assembly/eclipselink-plugins.zip.xml
+++ b/bundles/others/src/main/assembly/eclipselink-plugins.zip.xml
@@ -21,10 +21,22 @@
         <format>zip</format>
     </formats>
     <includeBaseDirectory>false</includeBaseDirectory>
-    <componentDescriptors>
-        <componentDescriptor>src/main/assembly/common-license.xml</componentDescriptor>
-    </componentDescriptors>
     <dependencySets>
+        <!--License files-->
+        <dependencySet>
+            <useProjectArtifact>false</useProjectArtifact>
+            <scope>provided</scope>
+            <outputDirectory>.</outputDirectory>
+            <includes>
+                <include>${project.groupId}:org.eclipse.persistence.parent:zip:common-license</include>
+            </includes>
+            <unpack>true</unpack>
+            <unpackOptions>
+                <includes>
+                    <include>*.html</include>
+                </includes>
+            </unpackOptions>
+        </dependencySet>
         <dependencySet>
             <outputFileNameMapping>${artifact.artifactId}_${release.version}.${build.qualifier}.${artifact.extension}</outputFileNameMapping>
             <includes>
diff --git a/bundles/others/src/main/assembly/eclipselink-test-src.zip.xml b/bundles/others/src/main/assembly/eclipselink-test-src.zip.xml
index c5309d9..fea1889 100644
--- a/bundles/others/src/main/assembly/eclipselink-test-src.zip.xml
+++ b/bundles/others/src/main/assembly/eclipselink-test-src.zip.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
 
-    Copyright (c) 2019 Oracle and/or its affiliates. All rights reserved.
+    Copyright (c) 2019, 2021 Oracle and/or its affiliates. All rights reserved.
 
     This program and the accompanying materials are made available under the
     terms of the Eclipse Public License v. 2.0 which is available at
@@ -21,9 +21,23 @@
         <format>zip</format>
     </formats>
     <includeBaseDirectory>false</includeBaseDirectory>
-    <componentDescriptors>
-        <componentDescriptor>src/main/assembly/common-license.xml</componentDescriptor>
-    </componentDescriptors>
+    <dependencySets>
+        <!--License files-->
+        <dependencySet>
+            <useProjectArtifact>false</useProjectArtifact>
+            <scope>provided</scope>
+            <outputDirectory>.</outputDirectory>
+            <includes>
+                <include>${project.groupId}:org.eclipse.persistence.parent:zip:common-license</include>
+            </includes>
+            <unpack>true</unpack>
+            <unpackOptions>
+                <includes>
+                    <include>*.html</include>
+                </includes>
+            </unpackOptions>
+        </dependencySet>
+    </dependencySets>
     <fileSets>
         <!--Ant build files from resources-->
         <fileSet>
diff --git a/pom.xml b/pom.xml
index bdf17d6..7d9207b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -111,9 +111,8 @@
         <bundle.version>${project.version}.${build.qualifier}</bundle.version>
         <project.build.testReports.subdirectory>test-reports</project.build.testReports.subdirectory>
         <project.build.testReports.summaryFile>test-summary</project.build.testReports.summaryFile>
+        <project.build.licenceResourceDirectory>${project.build.directory}/license</project.build.licenceResourceDirectory>
 
-        <!--Common properties-->
-        <common.licenceFiles>LICENSE.md, NOTICE.md</common.licenceFiles>
         <!--Integration test sources/resources directory. Relative directory to ${project.basedir}
         !!!Can't start with / character!!!-->
         <integration.test.directory>src/it/</integration.test.directory>
@@ -137,7 +136,7 @@
         <!--Default test DB is Derby-->
         <test.properties.file>${user.home}/${test.derby.properties.file}</test.properties.file>
         <test.properties.fileName>${test.derby.properties.file}</test.properties.fileName>
-        <test.properties.default.directory>${project.root.location}/etc</test.properties.default.directory>
+        <test.properties.default.directory>${project.build.directory}/test-default-properties</test.properties.default.directory>
         <test.database>derby</test.database>
         <!--false: to start In-Memory database, true: not start (MySQL, Oracle)-->
         <test.skip.in-memory.db>false</test.skip.in-memory.db>
@@ -1126,11 +1125,6 @@
                     <artifactId>xml-maven-plugin</artifactId>
                     <version>1.0.2</version>
                 </plugin>
-                <plugin>
-                    <groupId>org.commonjava.maven.plugins</groupId>
-                    <artifactId>directory-maven-plugin</artifactId>
-                    <version>0.3.1</version>
-                </plugin>
                 <!--This plugin (g:org.kuali.maven.plugins) is used instead typical org.codehaus.mojo:properties-maven-plugin:1.0.0
                     due bug: "Circular property definition" if expression like this is used in the Maven pom
                     "<server.testrunner.prefix>${modelname}/${modelname}_ejb/</server.testrunner.prefix>"
@@ -1211,17 +1205,77 @@
                 </configuration>
             </plugin>
             <plugin>
-                <groupId>org.commonjava.maven.plugins</groupId>
-                <artifactId>directory-maven-plugin</artifactId>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-assembly-plugin</artifactId>
                 <executions>
                     <execution>
-                        <id>find-project-root</id>
-                        <phase>validate</phase>
+                        <id>common-license</id>
+                        <phase>generate-resources</phase>
                         <goals>
-                            <goal>highest-basedir</goal>
+                            <goal>single</goal>
+                        </goals>
+                        <inherited>false</inherited>
+                        <configuration>
+                            <descriptors>
+                                <descriptor>src/main/assembly/common-license.xml</descriptor>
+                            </descriptors>
+                        </configuration>
+                    </execution>
+                    <execution>
+                        <id>test-defaults</id>
+                        <phase>initialize</phase>
+                        <goals>
+                            <goal>single</goal>
+                        </goals>
+                        <inherited>false</inherited>
+                        <configuration>
+                            <descriptors>
+                                <descriptor>src/main/assembly/test-defaults.xml</descriptor>
+                            </descriptors>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-dependency-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>unpack-legal-resource</id>
+                        <phase>generate-resources</phase>
+                        <goals>
+                            <goal>unpack</goal>
                         </goals>
                         <configuration>
-                            <property>project.root.location</property>
+                            <artifactItems>
+                                <artifactItem>
+                                    <groupId>${project.groupId}</groupId>
+                                    <artifactId>org.eclipse.persistence.parent</artifactId>
+                                    <version>${project.version}</version>
+                                    <classifier>common-license</classifier>
+                                    <type>zip</type>
+                                    <outputDirectory>${project.build.licenceResourceDirectory}</outputDirectory>
+                                </artifactItem>
+                            </artifactItems>
+                        </configuration>
+                    </execution>
+                    <execution>
+                        <id>unpack-test-properties</id>
+                        <phase>initialize</phase>
+                        <goals>
+                            <goal>unpack</goal>
+                        </goals>
+                        <configuration>
+                            <artifactItems>
+                                <artifactItem>
+                                    <groupId>${project.groupId}</groupId>
+                                    <artifactId>org.eclipse.persistence.parent</artifactId>
+                                    <version>${project.version}</version>
+                                    <classifier>test-defaults</classifier>
+                                    <type>zip</type>
+                                    <outputDirectory>${test.properties.default.directory}</outputDirectory>
+                                </artifactItem>
+                            </artifactItems>
                         </configuration>
                     </execution>
                 </executions>
@@ -1278,8 +1332,8 @@
                         <configuration>
                             <resources>
                                 <resource>
-                                    <directory>${project.root.location}</directory>
-                                    <includes>${common.licenceFiles}</includes>
+                                    <directory>${project.build.licenceResourceDirectory}/md</directory>
+                                    <includes>*</includes>
                                     <targetPath>META-INF</targetPath>
                                 </resource>
                             </resources>
diff --git a/src/main/assembly/common-license.xml b/src/main/assembly/common-license.xml
new file mode 100644
index 0000000..8208489
--- /dev/null
+++ b/src/main/assembly/common-license.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved.
+
+    This program and the accompanying materials are made available under the
+    terms of the Eclipse Public License v. 2.0 which is available at
+    http://www.eclipse.org/legal/epl-2.0,
+    or the Eclipse Distribution License v. 1.0 which is available at
+    http://www.eclipse.org/org/documents/edl-v10.php.
+
+    SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
+
+-->
+
+<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.0.0"
+          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+          xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">
+    <id>common-license</id>
+    <formats>
+        <format>zip</format>
+    </formats>
+    <includeBaseDirectory>false</includeBaseDirectory>
+    <fileSets>
+        <fileSet>
+            <directory>${project.basedir}</directory>
+            <outputDirectory>md</outputDirectory>
+            <includes>
+                <include>LICENSE.md</include>
+                <include>NOTICE.md</include>
+            </includes>
+        </fileSet>
+        <fileSet>
+            <directory>${project.basedir}/features</directory>
+            <outputDirectory>.</outputDirectory>
+            <includes>
+                <include>about.html</include>
+                <include>license.html</include>
+                <include>readme.html</include>
+            </includes>
+        </fileSet>
+    </fileSets>
+</assembly>
\ No newline at end of file
diff --git a/src/main/assembly/test-defaults.xml b/src/main/assembly/test-defaults.xml
new file mode 100644
index 0000000..f2af151
--- /dev/null
+++ b/src/main/assembly/test-defaults.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved.
+
+    This program and the accompanying materials are made available under the
+    terms of the Eclipse Public License v. 2.0 which is available at
+    http://www.eclipse.org/legal/epl-2.0,
+    or the Eclipse Distribution License v. 1.0 which is available at
+    http://www.eclipse.org/org/documents/edl-v10.php.
+
+    SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
+
+-->
+
+<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.0.0"
+          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+          xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">
+    <id>test-defaults</id>
+    <formats>
+        <format>zip</format>
+    </formats>
+    <includeBaseDirectory>false</includeBaseDirectory>
+    <fileSets>
+        <fileSet>
+            <directory>${project.basedir}/etc</directory>
+            <outputDirectory>.</outputDirectory>
+            <includes>
+                <include>*.properties</include>
+            </includes>
+        </fileSet>
+    </fileSets>
+</assembly>
\ No newline at end of file