vy commented on code in PR #2407:
URL: https://github.com/apache/logging-log4j2/pull/2407#discussion_r1538142217


##########
log4j-parent/pom.xml:
##########
@@ -1028,6 +1031,118 @@
         </plugins>
       </build>
     </profile>
+
+    <profile>
+
+      <id>plugin-processing</id>
+
+      <!-- Profile gets activated using a file instead of, say, a property 
defined by the child `pom.xml`.
+           Since a Maven property lookup requires model interpolation and that 
happens after the profile activation phase.
+           See: https://maven.apache.org/ref/3.9.6/maven-model-builder -->
+      <activation>
+        <file>
+          <exists>.log4j-plugin-processing-activator</exists>
+        </file>
+      </activation>
+
+      <properties>
+        
<log4j.docgen.pluginDescriptorsDir.effective>${log4j.docgen.pluginDescriptorsDir.phase2}</log4j.docgen.pluginDescriptorsDir.effective>
+      </properties>
+
+      <build>
+        <plugins>
+
+          <!-- Generate a random target package for `Log4jPlugins.java` -->
+          <plugin>
+            <groupId>org.codehaus.mojo</groupId>
+            <artifactId>build-helper-maven-plugin</artifactId>
+            <executions>
+              <execution>
+                <id>generate-plugin-package-for-tests</id>
+                <goals>
+                  <goal>bsh-property</goal>
+                </goals>

Review Comment:
   AFAIC, this is necessary, see the following block deleted from 
`log4j-core-test/pom.xml`:
   
   ```
                 <compilerArgs combine.children="append">
                   <!-- Disable automatic package discovery, which overwrites 
`log4j-core` plugins. -->
                   
<arg>-ApluginPackage=org.apache.logging.log4j.core.test2</arg>
                 </compilerArgs>
   ```
   
   I would prefer to ensure a unique package path rather than hardcoding it to 
a constant. The latter approach is prone to causing difficult to reason about 
compilation failures in case of a package conflict.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to