Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pom refactoring #253

Merged
merged 1 commit into from
Sep 29, 2023
Merged

Pom refactoring #253

merged 1 commit into from
Sep 29, 2023

Conversation

honnix
Copy link
Member

@honnix honnix commented Sep 28, 2023

TL;DR

pom.xml files refactoring

Type

  • Bug Fix
  • Feature
  • Plugin

Are all requirements met?

  • Code completed
  • Smoke tested
  • Unit tests added
  • Code documentation added
  • Any pending items have an associated Issue

Complete description

It's a bit hard to list what is being done so I tried adding comments in the PR where applicable.

Note that in this PR we are not trying to upgrade any deps or plugin versions unless necessary.

A further upgrade and cleanup can be applied later, with the possibility introducing maven-dependency analyse.

Tracking Issue

_NA

Follow-up issue

NA


@Testcontainers
public class S3FileSystemIT {

@Container
public final LocalStackContainer localStack = new LocalStackContainer().withServices(S3);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deprecation.

@@ -98,10 +98,8 @@
<!-- also remember to bump the version in flytekit-bom module -->
<spotless.version>2.21.0</spotless.version>
<spotbugs.excludeFilterFile>spotbugs-exclude.xml</spotbugs.excludeFilterFile>
<error_prone.version>2.19.1</error_prone.version>
<!-- Using the error-prone-javac is required when running on JDK 8 -->
<error_prone.javac.version>9+181-r4173-1</error_prone.javac.version>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not used anymore and we are no longer on Java 8.

@@ -111,6 +109,9 @@
<maven.compiler.source>${maven.compiler.release}</maven.compiler.source>
<maven.compiler.target>${maven.compiler.release}</maven.compiler.target>
<mockito.version>3.3.3</mockito.version>
<scala212.version>2.12.17</scala212.version>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Manage these in parent so it is clearer to see what versions we are using.

pom.xml Outdated
@@ -388,23 +459,6 @@
<!-- see https://stackoverflow.com/a/57004351 -->
<arg>-Xpkginfo:always</arg>
</compilerArgs>
<annotationProcessorPaths>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had tons of troubles with errorprone in IntelliJ when using annotationProcessorPaths.

pom.xml Outdated
<dependency>
<groupId>com.google.errorprone</groupId>
<artifactId>error_prone_core</artifactId>
<scope>provided</scope>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is effectively the same as using annotationProcessorPaths.

<executions>
<execution>
<goals>
<goal>apply</goal>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When compiling locally, we apply.

<executions>
<execution>
<goals>
<goal>check</goal>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When building in CI, we check.

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.testcontainers</groupId>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now managed centrally in parent.

</plugins>
</build>
<profiles>
<profile>
<id>it</id>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IT can be very slow when running on Apple silicon, we can disable that by mvn clean verify -P \!it.

@@ -33,24 +33,6 @@
<enforcer.skip>true</enforcer.skip>
</properties>

<dependencyManagement>
<dependencies>
<dependency>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now managed centrally in parent.

@@ -185,6 +185,7 @@ public void testStructWorkflow() {
assertEquals(expectedOutput, outputs.get("outputStructData"));
}*/

@SuppressWarnings("LockOnNonEnclosingClassLiteral")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New errorprone rule.

@@ -24,23 +24,47 @@
<version>0.4.25-SNAPSHOT</version>
</parent>

<artifactId>flytekit-examples-scala</artifactId>
<artifactId>flytekit-examples-scala_2.13</artifactId>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed to reflect Scala version, as best practice.

@@ -70,53 +69,11 @@
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is already configured by parent.

<configuration>
<protocArtifact>com.google.protobuf:protoc:3.21.1:exe:${os.detected.classifier}</protocArtifact>
<protocArtifact>com.google.protobuf:protoc:${protobuf.version}:exe:${os.detected.classifier}</protocArtifact>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the version defined by parent.

@@ -38,7 +38,7 @@ jobs:

- name: Verify with Maven
if: ${{ github.ref != 'refs/heads/master' }}
run: mvn --batch-mode verify
run: mvn --batch-mode verify -Pci
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Enable this profile for spotless check.

env:
CI: true
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Set this to true so spotless:apply will not be done during CI.

</configuration>
</plugin>
<plugin>
Copy link
Member Author

@honnix honnix Sep 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This plugin is now globally enabled in parent.

@@ -44,6 +44,7 @@
<dependency>
<groupId>com.google.errorprone</groupId>
<artifactId>error_prone_annotations</artifactId>
<scope>provided</scope>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not necessary but following other places.

@@ -100,9 +101,6 @@
</execution>
</executions>
</plugin>
<plugin>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This plugin is globally enabled in the parent.

</executions>
</plugin>
<!-- Disabling the default javadoc plugin - we use scala-maven-plugin instead -->
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have been doing this for another scala module, so we should follow.

</plugin>
</plugins>
<sourceDirectory>../flytekit-scala_2.13/src/main/scala</sourceDirectory>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is unnecessary.

@@ -74,7 +87,8 @@
<artifactId>scala-maven-plugin</artifactId>
<configuration>
<sourceDir>../flytekit-scala_2.13/src/main/scala</sourceDir>
<scalaVersion>${scala.version}</scalaVersion>
<testSourceDir>../flytekit-scala_2.13/src/test/scala</testSourceDir>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not needed now but might save us some headache later when needed.

</plugin>
<plugin>
<artifactId>maven-source-plugin</artifactId>
<groupId>org.apache.maven.plugins</groupId>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

<dependency>
<groupId>org.flyte</groupId>
<artifactId>flytekit-examples</artifactId>
<scope>test</scope>
</dependency>
<dependency>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are currently not using scala examples for IT.

<dependency>
<groupId>org.flyte</groupId>
<artifactId>jflyte</artifactId>
<scope>test</scope>
<optional>true</optional>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not exactly sure why it is here. test scope plus optional doesn't make much sense.

@@ -47,20 +47,6 @@
<groupId>org.flyte</groupId>
<artifactId>jflyte-api</artifactId>
</dependency>
<dependency>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minior cleanup because this is not needed by jflyte-util.

@@ -90,13 +76,6 @@
<artifactId>netty-tcnative-boringssl-static</artifactId>
</dependency>

<!-- runtime -->
<dependency>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

@@ -171,20 +171,10 @@
<artifactId>memoryfilesystem</artifactId>
<scope>test</scope>
</dependency>
<!-- ensure there is at least one slf4j implementation in test classpath so that we can test
org/slf4j/impl/StaticLoggerBinder.class is only discovered in child class loader -->
<dependency>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is only needed by jflyte-utils.

@@ -366,7 +442,7 @@
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3.8.1 is very old.

@@ -52,9 +52,8 @@
<plugin>
<groupId>org.xolstice.maven.plugins</groupId>
<artifactId>protobuf-maven-plugin</artifactId>
<version>0.6.1</version>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now managed by parent.

@@ -788,23 +897,6 @@
</execution>
</executions>
</plugin>
<plugin>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't seem to be needed to reconfigure this plugin for release profile.

module that uses @AutoService, otherwise we get warning like "The following options were not recognized by any processor: '[verify]'",
which again will fail the build because we have failOnWarning.
-->
<auto-service.version>1.0.2</auto-service.version>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the most recently version that has compatible guava deps with auto-value and error-prone. For some reason, maven could pick up a more recently guava for java compiler to use, but when building in IntelliJ we get errors that is clearly due to incompatible guava version.

Signed-off-by: Hongxin Liang <honnix@users.noreply.github.com>
@honnix honnix marked this pull request as ready for review September 29, 2023 10:03
@andresgomezfrr andresgomezfrr merged commit c925d99 into master Sep 29, 2023
4 checks passed
@andresgomezfrr andresgomezfrr deleted the pom-refactoring branch September 29, 2023 10:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants