From 77f8021b8a8aeef7b1256958fb8624cce98898bd Mon Sep 17 00:00:00 2001
From: vharseko <vharseko@3a-systems.ru>
Date: Tue, 21 Mar 2023 13:38:17 +0000
Subject: [PATCH] FIX add-source for generate-sources (#275)

---
 opendj-server-legacy/pom.xml    |   30 ++++++---
 opendj-grizzly/pom.xml          |   18 +++++
 opendj-ldap-toolkit/pom.xml     |   19 ++++++
 opendj-config/pom.xml           |   18 ++++++
 opendj-rest2ldap/pom.xml        |   18 +++++
 pom.xml                         |    6 +-
 opendj-core/pom.xml             |   18 +++++
 opendj-doc-maven-plugin/pom.xml |   17 +++++
 opendj-cli/pom.xml              |   18 +++++
 9 files changed, 143 insertions(+), 19 deletions(-)

diff --git a/opendj-cli/pom.xml b/opendj-cli/pom.xml
index 769c866..74b4b72 100644
--- a/opendj-cli/pom.xml
+++ b/opendj-cli/pom.xml
@@ -88,7 +88,23 @@
                     </execution>
                 </executions>
             </plugin>
-
+			<plugin>
+	            <groupId>org.codehaus.mojo</groupId>
+	            <artifactId>build-helper-maven-plugin</artifactId>
+	            <executions>
+	              <execution>
+	                <phase>process-sources</phase>
+	                <goals>
+	                  <goal>add-source</goal>
+	                </goals>
+	                <configuration>
+	                  <sources>
+	                    <source>target/generated-sources/messages</source>
+	                  </sources>
+	                </configuration>
+	              </execution>
+	            </executions>
+	        </plugin>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-surefire-plugin</artifactId>
diff --git a/opendj-config/pom.xml b/opendj-config/pom.xml
index 5c4be67..6c6a75c 100644
--- a/opendj-config/pom.xml
+++ b/opendj-config/pom.xml
@@ -140,6 +140,24 @@
           </execution>
         </executions>
       </plugin>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>build-helper-maven-plugin</artifactId>
+        <executions>
+          <execution>
+            <phase>process-sources</phase>
+            <goals>
+              <goal>add-source</goal>
+            </goals>
+            <configuration>
+              <sources>
+                <source>target/generated-sources/config</source>
+                <source>target/generated-sources/messages</source>
+              </sources>
+            </configuration>
+          </execution>
+         </executions>
+      </plugin>
       <!-- Validate core components XML definition files and generate the components. -->
       <plugin>
         <groupId>org.openidentityplatform.opendj</groupId>
diff --git a/opendj-core/pom.xml b/opendj-core/pom.xml
index ebc2036..5546c8d 100644
--- a/opendj-core/pom.xml
+++ b/opendj-core/pom.xml
@@ -143,7 +143,23 @@
                     </execution>
                 </executions>
             </plugin>
-
+		      <plugin>
+		        <groupId>org.codehaus.mojo</groupId>
+		        <artifactId>build-helper-maven-plugin</artifactId>
+		        <executions>
+		          <execution>
+		            <phase>process-sources</phase>
+		            <goals>
+		              <goal>add-source</goal>
+		            </goals>
+		            <configuration>
+		              <sources>
+		                <source>target/generated-sources/messages</source>
+		              </sources>
+		            </configuration>
+		          </execution>
+		         </executions>
+		      </plugin>
             <!-- Retrieve the SCM revision number and store it into the ${buildRevision} property -->
             <plugin>
                 <groupId>org.codehaus.mojo</groupId>
diff --git a/opendj-doc-maven-plugin/pom.xml b/opendj-doc-maven-plugin/pom.xml
index 568ccc4..b5c231b 100644
--- a/opendj-doc-maven-plugin/pom.xml
+++ b/opendj-doc-maven-plugin/pom.xml
@@ -91,6 +91,23 @@
                     </execution>
                 </executions>
             </plugin>
+            <plugin>
+	            <groupId>org.codehaus.mojo</groupId>
+	            <artifactId>build-helper-maven-plugin</artifactId>
+	            <executions>
+	              <execution>
+	                <phase>process-sources</phase>
+	                <goals>
+	                  <goal>add-source</goal>
+	                </goals>
+	                <configuration>
+	                  <sources>
+	                    <source>target/generated-sources/messages</source>
+	                  </sources>
+	                </configuration>
+	              </execution>
+	            </executions>
+	        </plugin>
         </plugins>
     </build>
 </project>
diff --git a/opendj-grizzly/pom.xml b/opendj-grizzly/pom.xml
index c40bb89..e69455f 100644
--- a/opendj-grizzly/pom.xml
+++ b/opendj-grizzly/pom.xml
@@ -102,7 +102,23 @@
                     </execution>
                 </executions>
             </plugin>
-
+			<plugin>
+	            <groupId>org.codehaus.mojo</groupId>
+	            <artifactId>build-helper-maven-plugin</artifactId>
+	            <executions>
+	              <execution>
+	                <phase>process-sources</phase>
+	                <goals>
+	                  <goal>add-source</goal>
+	                </goals>
+	                <configuration>
+	                  <sources>
+	                    <source>target/generated-sources/messages</source>
+	                  </sources>
+	                </configuration>
+	              </execution>
+	            </executions>
+            </plugin>
             <plugin>
                 <groupId>org.apache.felix</groupId>
                 <artifactId>maven-bundle-plugin</artifactId>
diff --git a/opendj-ldap-toolkit/pom.xml b/opendj-ldap-toolkit/pom.xml
index ae0246a..c04ba6b 100644
--- a/opendj-ldap-toolkit/pom.xml
+++ b/opendj-ldap-toolkit/pom.xml
@@ -100,7 +100,23 @@
                     </execution>
                 </executions>
             </plugin>
-
+			<plugin>
+	            <groupId>org.codehaus.mojo</groupId>
+	            <artifactId>build-helper-maven-plugin</artifactId>
+	            <executions>
+	              <execution>
+	                <phase>process-sources</phase>
+	                <goals>
+	                  <goal>add-source</goal>
+	                </goals>
+	                <configuration>
+	                  <sources>
+	                    <source>target/generated-sources/messages</source>
+	                  </sources>
+	                </configuration>
+	              </execution>
+	            </executions>
+	          </plugin>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-jar-plugin</artifactId>
@@ -116,6 +132,7 @@
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-surefire-plugin</artifactId>
+                <version>3.0.0-M4</version>
             </plugin>
 
             <plugin>
diff --git a/opendj-rest2ldap/pom.xml b/opendj-rest2ldap/pom.xml
index 3905f54..2758a10 100644
--- a/opendj-rest2ldap/pom.xml
+++ b/opendj-rest2ldap/pom.xml
@@ -106,7 +106,23 @@
                     </execution>
                 </executions>
             </plugin>
-
+			<plugin>
+		        <groupId>org.codehaus.mojo</groupId>
+		        <artifactId>build-helper-maven-plugin</artifactId>
+		        <executions>
+		          <execution>
+		            <phase>process-sources</phase>
+		            <goals>
+		              <goal>add-source</goal>
+		            </goals>
+		            <configuration>
+		              <sources>
+		                <source>target/generated-sources/messages</source>
+		              </sources>
+		            </configuration>
+		          </execution>
+		         </executions>
+		      </plugin>
             <plugin>
                 <groupId>org.apache.felix</groupId>
                 <artifactId>maven-bundle-plugin</artifactId>
diff --git a/opendj-server-legacy/pom.xml b/opendj-server-legacy/pom.xml
index 18b7b00..2769c97 100644
--- a/opendj-server-legacy/pom.xml
+++ b/opendj-server-legacy/pom.xml
@@ -70,11 +70,6 @@
   </properties>
 
   <dependencies>
-    <!-- ForgeRock libraries -->
-    <dependency>
-      <groupId>org.openidentityplatform.opendj</groupId>
-      <artifactId>opendj-cli</artifactId>
-    </dependency>
 
     <dependency>
       <groupId>org.openidentityplatform.opendj</groupId>
@@ -90,6 +85,16 @@
       <groupId>org.openidentityplatform.opendj</groupId>
       <artifactId>opendj-config</artifactId>
     </dependency>
+    
+    <dependency>
+      <groupId>org.openidentityplatform.opendj</groupId>
+      <artifactId>opendj-cli</artifactId>
+    </dependency>
+    
+     <dependency>
+      <groupId>org.openidentityplatform.opendj</groupId>
+      <artifactId>opendj-legacy</artifactId>
+    </dependency>
 
     <dependency>
       <groupId>org.openidentityplatform.opendj</groupId>
@@ -525,7 +530,7 @@
           <!-- Take into account several sources directories for the build -->
           <execution>
             <id>main-java-sources</id>
-            <phase>generate-sources</phase>
+            <phase>process-sources</phase>
             <goals>
               <goal>add-source</goal>
             </goals>
@@ -535,7 +540,7 @@
                 <source>src/messages/src</source>
                 <source>src/build-tools</source>
                 <source>${project.build.directory}/java-stubs</source>
-                <source>../opendj-legacy/src/main/java</source>
+<!--                <source>../opendj-legacy/src/main/java</source>-->
               </sources>
             </configuration>
           </execution>
@@ -1211,8 +1216,8 @@
                     <org.opends.test.copyClassesToTestPackage>false</org.opends.test.copyClassesToTestPackage>
                   </systemPropertyVariables>
                   <argLine>-server -Xmx2048M -XX:MaxPermSize=256m</argLine>
-	        	  <parallel>methods</parallel>
-	          	  <threadCount>1</threadCount>
+<!--	        	  <parallel>methods</parallel>-->
+<!--	          	  <threadCount>10</threadCount>-->
                 </configuration>
               </execution>
             </executions>
@@ -1269,16 +1274,19 @@
               <!-- Add snmp source directory and snmp generated directory as sources -->
               <execution>
                 <id>snmp-java-sources</id>
-                <phase>generate-sources</phase>
+               <phase>process-sources</phase>
                 <goals>
                   <goal>add-source</goal>
                 </goals>
                 <configuration>
                   <sources>
-                    <source>src/snmp</source>
+                    <source>src/snmp/generated</source>
+                    <source>src/snmp/src</source>
+                     <source>src/snmp/resource</source>
                   </sources>
                 </configuration>
               </execution>
+             
             </executions>
           </plugin>
 
diff --git a/pom.xml b/pom.xml
index 561b4d9..924add6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -386,7 +386,7 @@
                 <plugin>
                     <groupId>org.apache.maven.plugins</groupId>
                     <artifactId>maven-jar-plugin</artifactId>
-                    <version>3.2.0</version>
+                    <version>3.3.0</version>
                 </plugin>
                 
                 <plugin>
@@ -448,7 +448,7 @@
                     <artifactId>maven-surefire-plugin</artifactId>
                     <version>3.0.0-M4</version> <!-- M6 DecodeException but got java.nio.BufferOverflowException -->
                     <configuration>
-                        <properties>
+						<properties>
                             <property>
                                 <name>usedefaultlisteners</name>
                                 <value>false</value>
@@ -616,7 +616,7 @@
                 <plugin>
                     <groupId>org.codehaus.mojo</groupId>
                     <artifactId>build-helper-maven-plugin</artifactId>
-                    <version>1.8</version>
+                    <version>3.3.0</version>
                     <executions>
                         <!-- Parse version to generate properties (major.version, minor.version, ...) -->
                         <execution>

--
Gitblit v1.10.0