Skip to content

Commit

Permalink
apacheGH-40843: [Java] Cleanup protobuf-maven-plugin usage (apache#40844
Browse files Browse the repository at this point in the history
)

### Rationale for this change

`protobuf-maven-plugin` usage in Arrow codebase does not follow plugins best practices like sharing the same output directory for different execution or not using test goals for generating test classes

### What changes are included in this PR?

* Add protobuf-maven-plugin plugin to top level pom.xml under pluginManagement to define version and common configuration for all modules
* Remove unnecessary executions of test-compile goal when no test protobufs are present
* Remove use of outputDirectory and clearOutputDirectory and let the plugin choose it for each execution (the default output directory is based on the phase (main vs test) and the language/plugin-id)
* Replace use of compile/compile-custom goals with test-compile/test-compile-custom when generating test protobufs

### Are these changes tested?

As those changes are in the build system, they are covered by the build framework and tests run as part of the build

### Are there any user-facing changes?
None
* GitHub Issue: apache#40843

Authored-by: Laurent Goujon <[email protected]>
Signed-off-by: David Li <[email protected]>
  • Loading branch information
laurentgo authored and rok committed May 8, 2024
1 parent b6a220d commit bc559dd
Show file tree
Hide file tree
Showing 5 changed files with 614 additions and 97 deletions.
31 changes: 24 additions & 7 deletions java/dataset/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -197,13 +197,30 @@
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine combine.self="override">--add-reads=org.apache.arrow.dataset=com.fasterxml.jackson.databind --add-opens=java.base/java.nio=org.apache.arrow.memory.core,ALL-UNNAMED</argLine>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<enableAssertions>false</enableAssertions>
<systemPropertyVariables>
<arrow.test.dataRoot>${project.basedir}/../../testing/data</arrow.test.dataRoot>
</systemPropertyVariables>
</configuration>
</plugin>
<plugin>
<groupId>org.xolstice.maven.plugins</groupId>
<artifactId>protobuf-maven-plugin</artifactId>
<executions>
<execution>
<id>src</id>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<protoSourceRoot>../../cpp/src/jni/dataset/proto</protoSourceRoot>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
Expand Down
3 changes: 3 additions & 0 deletions java/flight/flight-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,9 @@
<executions>
<execution>
<id>src</id>
<configuration>
<protoSourceRoot>${basedir}/../../../format/</protoSourceRoot>
</configuration>
<goals>
<goal>compile</goal>
<goal>compile-custom</goal>
Expand Down
24 changes: 12 additions & 12 deletions java/flight/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,16 @@
<module>flight-integration-tests</module>
</modules>

<profiles>
<profile>
<id>pin-mockito-jdk8</id>
<activation>
<jdk>1.8</jdk>
</activation>
<properties>
<mockito.core.version>4.11.0</mockito.core.version>
<mockito.inline.version>5.2.0</mockito.inline.version>
</properties>
</profile>
</profiles>
<profiles>
<profile>
<id>pin-mockito-jdk8</id>
<activation>
<jdk>1.8</jdk>
</activation>
<properties>
<mockito.core.version>4.11.0</mockito.core.version>
<mockito.inline.version>5.2.0</mockito.inline.version>
</properties>
</profile>
</profiles>
</project>
52 changes: 15 additions & 37 deletions java/gandiva/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -93,43 +93,21 @@
<id>release</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<executions>
<execution>
<id>sign-artifacts</id>
<goals>
<goal>sign</goal>
</goals>
<phase>verify</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.xolstice.maven.plugins</groupId>
<artifactId>protobuf-maven-plugin</artifactId>
<executions>
<execution>
<id>src</id>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<protoSourceRoot>proto</protoSourceRoot>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
Expand Down
Loading

0 comments on commit bc559dd

Please sign in to comment.