From a972f1f53dbc15653c61344ad60dc5fe43084937 Mon Sep 17 00:00:00 2001 From: Ashley Scopes <73482956+ascopes@users.noreply.github.com> Date: Sat, 31 May 2025 13:14:13 +0100 Subject: [PATCH] GH-687: Add src/main/proto and src/test/proto as directory roots for migration purposes --- pom.xml | 2 +- protobuf-maven-plugin/pom.xml | 2 +- .../invoker.properties | 17 ++++ .../java-main-legacy-source-directory/pom.xml | 74 +++++++++++++++++ .../src/main/proto/helloworld.proto | 27 ++++++ .../org/example/helloworld/ProtobufTest.java | 62 ++++++++++++++ .../test.groovy | 42 ++++++++++ .../invoker.properties | 17 ++++ .../java-test-legacy-source-directory/pom.xml | 82 +++++++++++++++++++ .../org/example/helloworld/ProtobufTest.java | 63 ++++++++++++++ .../src/test/proto/helloworld.proto | 27 ++++++ .../test.groovy | 42 ++++++++++ .../mojo/AbstractGenerateMojo.java | 3 + .../mojo/MainGenerateMojo.java | 14 +++- .../mojo/TestGenerateMojo.java | 14 +++- .../src/site/markdown/basic-usage.md | 12 +++ .../mojo/MainGenerateMojoTest.java | 5 +- .../mojo/TestGenerateMojoTest.java | 5 +- 18 files changed, 494 insertions(+), 16 deletions(-) create mode 100644 protobuf-maven-plugin/src/it/java-main-legacy-source-directory/invoker.properties create mode 100644 protobuf-maven-plugin/src/it/java-main-legacy-source-directory/pom.xml create mode 100644 protobuf-maven-plugin/src/it/java-main-legacy-source-directory/src/main/proto/helloworld.proto create mode 100644 protobuf-maven-plugin/src/it/java-main-legacy-source-directory/src/test/java/org/example/helloworld/ProtobufTest.java create mode 100644 protobuf-maven-plugin/src/it/java-main-legacy-source-directory/test.groovy create mode 100644 protobuf-maven-plugin/src/it/java-test-legacy-source-directory/invoker.properties create mode 100644 protobuf-maven-plugin/src/it/java-test-legacy-source-directory/pom.xml create mode 100644 protobuf-maven-plugin/src/it/java-test-legacy-source-directory/src/test/java/org/example/helloworld/ProtobufTest.java create mode 100644 protobuf-maven-plugin/src/it/java-test-legacy-source-directory/src/test/proto/helloworld.proto create mode 100644 protobuf-maven-plugin/src/it/java-test-legacy-source-directory/test.groovy diff --git a/pom.xml b/pom.xml index 74a9f8c6..e4113f6f 100644 --- a/pom.xml +++ b/pom.xml @@ -21,7 +21,7 @@ io.github.ascopes protobuf-maven-plugin-parent - 3.3.2-SNAPSHOT + 3.4.0-SNAPSHOT Protobuf Maven Plugin Parent Parent POM for the Protobuf Maven Plugin. diff --git a/protobuf-maven-plugin/pom.xml b/protobuf-maven-plugin/pom.xml index 40913067..52f718f6 100644 --- a/protobuf-maven-plugin/pom.xml +++ b/protobuf-maven-plugin/pom.xml @@ -22,7 +22,7 @@ io.github.ascopes protobuf-maven-plugin-parent - 3.3.2-SNAPSHOT + 3.4.0-SNAPSHOT protobuf-maven-plugin diff --git a/protobuf-maven-plugin/src/it/java-main-legacy-source-directory/invoker.properties b/protobuf-maven-plugin/src/it/java-main-legacy-source-directory/invoker.properties new file mode 100644 index 00000000..0cd6971e --- /dev/null +++ b/protobuf-maven-plugin/src/it/java-main-legacy-source-directory/invoker.properties @@ -0,0 +1,17 @@ +# +# Copyright (C) 2023 - 2025, Ashley Scopes. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +invoker.goals = clean package diff --git a/protobuf-maven-plugin/src/it/java-main-legacy-source-directory/pom.xml b/protobuf-maven-plugin/src/it/java-main-legacy-source-directory/pom.xml new file mode 100644 index 00000000..e09ec70e --- /dev/null +++ b/protobuf-maven-plugin/src/it/java-main-legacy-source-directory/pom.xml @@ -0,0 +1,74 @@ + + + + 4.0.0 + + + @project.groupId@.it + integration-test-parent + @project.version@ + ../setup/pom.xml + + + java-main-legacy-source-directory + java-main-legacy-source-directory + + + + com.google.protobuf + protobuf-java + compile + + + + org.junit.jupiter + junit-jupiter + test + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + + org.apache.maven.plugins + maven-surefire-plugin + + + + @project.groupId@ + @project.artifactId@ + + + + + generate + + + + + + + diff --git a/protobuf-maven-plugin/src/it/java-main-legacy-source-directory/src/main/proto/helloworld.proto b/protobuf-maven-plugin/src/it/java-main-legacy-source-directory/src/main/proto/helloworld.proto new file mode 100644 index 00000000..549aa0cf --- /dev/null +++ b/protobuf-maven-plugin/src/it/java-main-legacy-source-directory/src/main/proto/helloworld.proto @@ -0,0 +1,27 @@ +// +// Copyright (C) 2023 - 2025, Ashley Scopes. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +syntax = "proto3"; + +option java_multiple_files = true; +option java_package = "org.example.helloworld"; + +package org.example.helloworld; + +message GreetingRequest { + string name = 1; +} + diff --git a/protobuf-maven-plugin/src/it/java-main-legacy-source-directory/src/test/java/org/example/helloworld/ProtobufTest.java b/protobuf-maven-plugin/src/it/java-main-legacy-source-directory/src/test/java/org/example/helloworld/ProtobufTest.java new file mode 100644 index 00000000..528726f7 --- /dev/null +++ b/protobuf-maven-plugin/src/it/java-main-legacy-source-directory/src/test/java/org/example/helloworld/ProtobufTest.java @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2023 - 2025, Ashley Scopes. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.example.helloworld; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.io.ByteArrayOutputStream; +import java.util.ArrayList; +import org.junit.jupiter.api.Test; + +class ProtobufTest { + @Test + void generatedProtobufSourcesAreFullMessages() throws Throwable { + // When + var superClasses = new ArrayList(); + Class superClass = GreetingRequest.class; + + do { + superClasses.add(superClass.getName()); + superClass = superClass.getSuperclass(); + } while (superClass != null); + + // Then + // GeneratedMessageV3 for protobuf-java 3.25.3 and older. + // GeneratedMessage for protobuf-java 4.26.0 and newer. + assertTrue(superClasses.contains("com.google.protobuf.GeneratedMessage")); + } + + @Test + void generatedProtobufSourcesAreValid() throws Throwable { + // Given + var expectedGreetingRequest = GreetingRequest + .newBuilder() + .setName("Ashley") + .build(); + + // When + var baos = new ByteArrayOutputStream(); + expectedGreetingRequest.writeTo(baos); + var actualGreetingRequest = GreetingRequest.parseFrom(baos.toByteArray()); + + assertNotEquals(0, baos.toByteArray().length); + + // Then + assertEquals(expectedGreetingRequest.getName(), actualGreetingRequest.getName()); + } +} diff --git a/protobuf-maven-plugin/src/it/java-main-legacy-source-directory/test.groovy b/protobuf-maven-plugin/src/it/java-main-legacy-source-directory/test.groovy new file mode 100644 index 00000000..ca863a83 --- /dev/null +++ b/protobuf-maven-plugin/src/it/java-main-legacy-source-directory/test.groovy @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2023 - 2025, Ashley Scopes. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import java.nio.file.Path + +import static org.assertj.core.api.Assertions.assertThat + +Path baseDirectory = basedir.toPath().toAbsolutePath() +Path generatedSourcesDir = baseDirectory.resolve("target/generated-sources/protobuf") +Path classesDir = baseDirectory.resolve("target/classes") +List expectedGeneratedFiles = [ + "org/example/helloworld/Helloworld", + "org/example/helloworld/GreetingRequest", + "org/example/helloworld/GreetingRequestOrBuilder", +] + +assertThat(generatedSourcesDir).isDirectory() + +assertThat(classesDir).isDirectory() + +expectedGeneratedFiles.forEach { + assertThat(generatedSourcesDir.resolve("${it}.java")) + .exists() + .isNotEmptyFile() + assertThat(classesDir.resolve("${it}.class")) + .exists() + .isNotEmptyFile() +} + +return true diff --git a/protobuf-maven-plugin/src/it/java-test-legacy-source-directory/invoker.properties b/protobuf-maven-plugin/src/it/java-test-legacy-source-directory/invoker.properties new file mode 100644 index 00000000..0cd6971e --- /dev/null +++ b/protobuf-maven-plugin/src/it/java-test-legacy-source-directory/invoker.properties @@ -0,0 +1,17 @@ +# +# Copyright (C) 2023 - 2025, Ashley Scopes. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +invoker.goals = clean package diff --git a/protobuf-maven-plugin/src/it/java-test-legacy-source-directory/pom.xml b/protobuf-maven-plugin/src/it/java-test-legacy-source-directory/pom.xml new file mode 100644 index 00000000..260ec767 --- /dev/null +++ b/protobuf-maven-plugin/src/it/java-test-legacy-source-directory/pom.xml @@ -0,0 +1,82 @@ + + + + 4.0.0 + + + @project.groupId@.it + integration-test-parent + @project.version@ + ../setup/pom.xml + + + java-test-legacy-source-directory + java-test-legacy-source-directory + + + + com.google.protobuf + protobuf-java + compile + + + + org.junit.jupiter + junit-jupiter + test + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + + org.apache.maven.plugins + maven-jar-plugin + + true + + + + + org.apache.maven.plugins + maven-surefire-plugin + + + + @project.groupId@ + @project.artifactId@ + + + + + generate-test + + + + + + + diff --git a/protobuf-maven-plugin/src/it/java-test-legacy-source-directory/src/test/java/org/example/helloworld/ProtobufTest.java b/protobuf-maven-plugin/src/it/java-test-legacy-source-directory/src/test/java/org/example/helloworld/ProtobufTest.java new file mode 100644 index 00000000..91b02d67 --- /dev/null +++ b/protobuf-maven-plugin/src/it/java-test-legacy-source-directory/src/test/java/org/example/helloworld/ProtobufTest.java @@ -0,0 +1,63 @@ +/* + * Copyright (C) 2023 - 2025, Ashley Scopes. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.example.helloworld; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.io.ByteArrayOutputStream; +import java.util.ArrayList; +import org.junit.jupiter.api.Test; + +class ProtobufTest { + + @Test + void generatedProtobufSourcesAreFullMessages() throws Throwable { + // When + var superClasses = new ArrayList(); + Class superClass = GreetingRequest.class; + + do { + superClasses.add(superClass.getName()); + superClass = superClass.getSuperclass(); + } while (superClass != null); + + // Then + // GeneratedMessageV3 for protobuf-java 3.25.3 and older. + // GeneratedMessage for protobuf-java 4.26.0 and newer. + assertTrue(superClasses.contains("com.google.protobuf.GeneratedMessage")); + } + + @Test + void generatedProtobufSourcesAreValid() throws Throwable { + // Given + var expectedGreetingRequest = GreetingRequest + .newBuilder() + .setName("Ashley") + .build(); + + // When + var baos = new ByteArrayOutputStream(); + expectedGreetingRequest.writeTo(baos); + var actualGreetingRequest = GreetingRequest.parseFrom(baos.toByteArray()); + + assertNotEquals(0, baos.toByteArray().length); + + // Then + assertEquals(expectedGreetingRequest.getName(), actualGreetingRequest.getName()); + } +} diff --git a/protobuf-maven-plugin/src/it/java-test-legacy-source-directory/src/test/proto/helloworld.proto b/protobuf-maven-plugin/src/it/java-test-legacy-source-directory/src/test/proto/helloworld.proto new file mode 100644 index 00000000..549aa0cf --- /dev/null +++ b/protobuf-maven-plugin/src/it/java-test-legacy-source-directory/src/test/proto/helloworld.proto @@ -0,0 +1,27 @@ +// +// Copyright (C) 2023 - 2025, Ashley Scopes. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +syntax = "proto3"; + +option java_multiple_files = true; +option java_package = "org.example.helloworld"; + +package org.example.helloworld; + +message GreetingRequest { + string name = 1; +} + diff --git a/protobuf-maven-plugin/src/it/java-test-legacy-source-directory/test.groovy b/protobuf-maven-plugin/src/it/java-test-legacy-source-directory/test.groovy new file mode 100644 index 00000000..bfba6074 --- /dev/null +++ b/protobuf-maven-plugin/src/it/java-test-legacy-source-directory/test.groovy @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2023 - 2025, Ashley Scopes. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import java.nio.file.Path + +import static org.assertj.core.api.Assertions.assertThat + +Path baseDirectory = basedir.toPath().toAbsolutePath() +Path generatedSourcesDir = baseDirectory.resolve("target/generated-test-sources/protobuf") +def classesDir = baseDirectory.resolve("target/test-classes") +def expectedGeneratedFiles = [ + "org/example/helloworld/Helloworld", + "org/example/helloworld/GreetingRequest", + "org/example/helloworld/GreetingRequestOrBuilder", +] + +assertThat(generatedSourcesDir).isDirectory() + +assertThat(classesDir).isDirectory() + +expectedGeneratedFiles.forEach { + assertThat(generatedSourcesDir.resolve("${it}.java")) + .exists() + .isNotEmptyFile() + assertThat(classesDir.resolve("${it}.class")) + .exists() + .isNotEmptyFile() +} + +return true diff --git a/protobuf-maven-plugin/src/main/java/io/github/ascopes/protobufmavenplugin/mojo/AbstractGenerateMojo.java b/protobuf-maven-plugin/src/main/java/io/github/ascopes/protobufmavenplugin/mojo/AbstractGenerateMojo.java index 98b3a4c0..35e8722e 100644 --- a/protobuf-maven-plugin/src/main/java/io/github/ascopes/protobufmavenplugin/mojo/AbstractGenerateMojo.java +++ b/protobuf-maven-plugin/src/main/java/io/github/ascopes/protobufmavenplugin/mojo/AbstractGenerateMojo.java @@ -912,6 +912,9 @@ public AbstractGenerateMojo() { * Override the source directories to compile from. * *

Leave unspecified or explicitly null/empty to use the defaults. + * + *

Note that specifying custom directories will override the default + * directories rather than adding to them. * * @since 0.0.1 */ diff --git a/protobuf-maven-plugin/src/main/java/io/github/ascopes/protobufmavenplugin/mojo/MainGenerateMojo.java b/protobuf-maven-plugin/src/main/java/io/github/ascopes/protobufmavenplugin/mojo/MainGenerateMojo.java index 7e13f6c3..aba882cf 100644 --- a/protobuf-maven-plugin/src/main/java/io/github/ascopes/protobufmavenplugin/mojo/MainGenerateMojo.java +++ b/protobuf-maven-plugin/src/main/java/io/github/ascopes/protobufmavenplugin/mojo/MainGenerateMojo.java @@ -35,7 +35,8 @@ *

Any project dependencies using the {@code compile}, {@code provided}, * or {@code system} scopes will be made available to import from protobuf sources. * - *

By default, sources will be read from {@code src/main/protobuf}, + *

By default, sources will be read from {@code src/main/protobuf} ({@code src/main/proto}, + * is also supported to assist in migration off of other unmaintained Maven plugins), * and generated sources will be written to {@code target/generated-sources/protobuf}. * * @author Ashley Scopes @@ -74,9 +75,14 @@ Set defaultDependencyScopes() { Collection defaultSourceDirectories() { var basePath = mavenProject.getBasedir().toPath() .resolve("src") - .resolve("main") - .resolve("protobuf"); - return List.of(basePath); + .resolve("main"); + + return List.of( + basePath.resolve("protobuf"), + // Provided in GH-687 as a transition layer for other plugin users + // migrating onto this Maven plugin. + basePath.resolve("proto") + ); } @Override diff --git a/protobuf-maven-plugin/src/main/java/io/github/ascopes/protobufmavenplugin/mojo/TestGenerateMojo.java b/protobuf-maven-plugin/src/main/java/io/github/ascopes/protobufmavenplugin/mojo/TestGenerateMojo.java index 5a1eb0ff..f8370fa9 100644 --- a/protobuf-maven-plugin/src/main/java/io/github/ascopes/protobufmavenplugin/mojo/TestGenerateMojo.java +++ b/protobuf-maven-plugin/src/main/java/io/github/ascopes/protobufmavenplugin/mojo/TestGenerateMojo.java @@ -35,7 +35,8 @@ *

Any project dependencies using the {@code compile}, {@code provided}, * {@code system}, or {@code test} scopes will be made available to import from protobuf sources. * - *

By default, sources will be read from {@code src/test/protobuf}, + *

By default, sources will be read from {@code src/test/protobuf} ({@code src/test/proto}, + * is also supported to assist in migration off of other unmaintained Maven plugins), * and generated sources will be written to {@code target/generated-test-sources/protobuf}. * *

Generally, you won't need to use this. It can be useful in some more @@ -76,9 +77,14 @@ Set defaultDependencyScopes() { Collection defaultSourceDirectories() { var basePath = mavenProject.getBasedir().toPath() .resolve("src") - .resolve("test") - .resolve("protobuf"); - return List.of(basePath); + .resolve("test"); + + return List.of( + basePath.resolve("protobuf"), + // Provided in GH-687 as a transition layer for other plugin users + // migrating onto this Maven plugin. + basePath.resolve("proto") + ); } @Override diff --git a/protobuf-maven-plugin/src/site/markdown/basic-usage.md b/protobuf-maven-plugin/src/site/markdown/basic-usage.md index f6cd1ce1..10859a47 100644 --- a/protobuf-maven-plugin/src/site/markdown/basic-usage.md +++ b/protobuf-maven-plugin/src/site/markdown/basic-usage.md @@ -91,6 +91,18 @@ generated protobuf classes. --- +## Migration + +[GH-692](https://github.com/ascopes/protobuf-maven-plugin/issues/692) introduced the +fallback source directory of `src/main/proto` and `src/test/proto` to be used to +assist users who are migrating their codebases off of other unmaintained Maven plugins. + +It is recommended that users default to making use of `src/main/protobuf` and +`src/test/protobuf` instead, as this follows the standard naming convention of other +Maven-managed projects which is to use the language name rather than the file extension. + +--- + ## Goals By default, this plugin runs the `generate` goal to generate source code designed diff --git a/protobuf-maven-plugin/src/test/java/io/github/ascopes/protobufmavenplugin/mojo/MainGenerateMojoTest.java b/protobuf-maven-plugin/src/test/java/io/github/ascopes/protobufmavenplugin/mojo/MainGenerateMojoTest.java index 41646bc8..5ad126d5 100644 --- a/protobuf-maven-plugin/src/test/java/io/github/ascopes/protobufmavenplugin/mojo/MainGenerateMojoTest.java +++ b/protobuf-maven-plugin/src/test/java/io/github/ascopes/protobufmavenplugin/mojo/MainGenerateMojoTest.java @@ -39,9 +39,8 @@ SourceRootRegistrar expectedSourceRootRegistrar() { Collection expectedDefaultSourceDirectories() { var basePath = mojo.mavenProject.getBasedir().toPath() .resolve("src") - .resolve("main") - .resolve("protobuf"); - return List.of(basePath); + .resolve("main"); + return List.of(basePath.resolve("protobuf"), basePath.resolve("proto")); } @Override diff --git a/protobuf-maven-plugin/src/test/java/io/github/ascopes/protobufmavenplugin/mojo/TestGenerateMojoTest.java b/protobuf-maven-plugin/src/test/java/io/github/ascopes/protobufmavenplugin/mojo/TestGenerateMojoTest.java index aec40469..b676763c 100644 --- a/protobuf-maven-plugin/src/test/java/io/github/ascopes/protobufmavenplugin/mojo/TestGenerateMojoTest.java +++ b/protobuf-maven-plugin/src/test/java/io/github/ascopes/protobufmavenplugin/mojo/TestGenerateMojoTest.java @@ -39,9 +39,8 @@ SourceRootRegistrar expectedSourceRootRegistrar() { Collection expectedDefaultSourceDirectories() { var basePath = mojo.mavenProject.getBasedir().toPath() .resolve("src") - .resolve("test") - .resolve("protobuf"); - return List.of(basePath); + .resolve("test"); + return List.of(basePath.resolve("protobuf"), basePath.resolve("proto")); } @Override