Skip to content

Commit

Permalink
Replace fmpp-maven-plugin with fmpp Ant Task to avoid pulling the vul…
Browse files Browse the repository at this point in the history
…nerable log4j jars
  • Loading branch information
chrajeshbabu committed Oct 16, 2024
1 parent b556b37 commit 5858f43
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 15 deletions.
27 changes: 17 additions & 10 deletions pinot-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
<goal>javacc</goal>
</goals>
<configuration>
<sourceDirectory>${project.build.directory}/generated-sources/fmpp/javacc</sourceDirectory>
<sourceDirectory>${project.build.directory}/generated-sources/javacc/</sourceDirectory>
<includes>
<include>Parser.jj</include>
</includes>
Expand Down Expand Up @@ -269,6 +269,10 @@
<artifactId>equalsverifier</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.sourceforge.fmpp</groupId>
<artifactId>fmpp</artifactId>
</dependency>
</dependencies>
<profiles>
<profile>
Expand Down Expand Up @@ -347,11 +351,11 @@
</properties>
</profile>
<profile>
<!-- The fmpp-maven-plugin doesn't care about unchanged (re)sources and will always generate.
<!-- The Ant task doesn't care about unchanged (re)sources and will always generate.
This causes the maven-compiler-plugin to detect changes and always recompile the Java sources.
If there are changes in src/main/codegen, either enforcer activation of this profile by using -Psqlparser or by
removing the generated-sources/fmpp directory
removing the generated-sources/javacc directory
NOTICE: In Maven the profile activation is decided BEFORE plugin execution.
When running clean+verify, the profile will not be activated (because the file still exists),
Expand All @@ -361,27 +365,30 @@
<id>sqlparser</id>
<activation>
<file>
<missing>target/generated-sources/fmpp/javacc/Parser.jj</missing>
<missing>${project.build.directory}/generated-sources/javacc/Parser.jj</missing>
</file>
</activation>
<build>
<plugins>
<!-- "Plugs in" the Calcite's Parser.jj with the variables present in config.fmpp. These contain the custom rules
as well as the class to which the custom implementation will get generated -->
<plugin>
<groupId>com.googlecode.fmpp-maven-plugin</groupId>
<artifactId>fmpp-maven-plugin</artifactId>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>generate-fmpp-sources</id>
<phase>generate-sources</phase>
<goals>
<goal>generate</goal>
<goal>run</goal>
</goals>
<configuration>
<cfgFile>src/main/codegen/config.fmpp</cfgFile>
<templateDirectory>src/main/codegen/templates</templateDirectory>
<outputDirectory>${project.build.directory}/generated-sources/fmpp</outputDirectory>
<target name="generate-code">
<taskdef name="fmpp" classname="fmpp.tools.AntTask" classpathref="maven.compile.classpath"/>
<fmpp configuration="src/main/codegen/config.fmpp"
sourceRoot="src/main/codegen/templates"
outputRoot="${project.build.directory}/generated-sources/"/>
</target>
</configuration>
</execution>
</executions>
Expand Down
11 changes: 6 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@
<h2.version>2.3.232</h2.version>
<jnr-posix.version>3.1.20</jnr-posix.version>
<scalatest.version>3.2.19</scalatest.version>
<fmpp.version>0.9.16</fmpp.version>
</properties>

<profiles>
Expand Down Expand Up @@ -2025,6 +2026,11 @@
<version>${scalatest.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.sourceforge.fmpp</groupId>
<artifactId>fmpp</artifactId>
<version>${fmpp.version}</version>
</dependency>
</dependencies>
</dependencyManagement>

Expand Down Expand Up @@ -2301,11 +2307,6 @@
</annotationProcessorPaths>
</configuration>
</plugin>
<plugin>
<groupId>com.googlecode.fmpp-maven-plugin</groupId>
<artifactId>fmpp-maven-plugin</artifactId>
<version>1.0</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>javacc-maven-plugin</artifactId>
Expand Down

0 comments on commit 5858f43

Please sign in to comment.