Blog Summary: (AI Summaries by Summarizes)
  • Working with complex and multi-module Maven projects can be challenging.
  • To list all modules in a project, run the command `mvn help:all-profiles`.
  • The output will show the project's reactor build order and list all profiles for each module.
  • The command can be helpful for navigating and understanding the structure of a multi-module project.
  • The post lists various Profile Ids for different projects in Apache Beam.

Working with complex and multi-module Maven projects can be a handful.

These are a few tips to make that easier. I’m going to use Apache Beam as an example of a multi-module Maven project.

The first helpful command is to list all of the modules. To do this run mvn help:all-profiles and that will output:

Choosing a Module

From there, you can choose which module you want to start working with. In my case, I wanted to work with beam-sdks-java-core. From here, we can run a Maven command to start working with that module mvn verify -pl org.apache.beam:beam-sdks-java-core.

Unit Testing

For some of the unit tests in Beam, there are categories. These categories need a runner. In Beam, these are marked with @Category(NeedsRunner.class).

When running unit tests in IntelliJ, you’ll need to make a configuration change. Go to Run->Edit Configurations. Change Use classpath of module to beam-runners-direct-java. This will make the unit test run with the direct runner for the test. The image below shows what it should look like:

screen-shot-2016-12-29-at-9-59-32-am

To run a specific unit test from the command line run:

Using an IDE is by far the easiest way to run individual unit tests.

(Update for improved searching for the error) If you’re getting an error that looks like this:

The fix is to add the -pl or change the classpath as shown above.

Thanks to Dan Halperin for his help.

Related Posts

Gemini Batch API for Java

Blog Summary: (AI Summaries by Summarizes)The Batch API for Gemini lacks comprehensive documentation, making implementation challenging.Creating examples for the Batch API is time-consuming due to

Data Teams Survey 2020-2024 Analysis

Blog Summary: (AI Summaries by Summarizes)**Total Value Creation**:**Gradual Decrease in Value Creation**:**Team Makeup and Descriptions**:**Methodologies**:**Advice**:Frequently Asked Questions (AI FAQ by Summarizes)