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

More lenient handling of empty Maven modules #103

Merged
merged 3 commits into from
Nov 13, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/main/java/io/sentry/UploadSourceBundleMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,10 @@ private void bundleSources(

final @NotNull List<String> bundleSourcesCommand = new ArrayList<>();
final @NotNull List<String> sourceRoots = mavenProject.getCompileSourceRoots();
final @Nullable String sourceRoot =
sourceRoots != null && !sourceRoots.isEmpty() ? sourceRoots.get(0) : null;

if (sourceRoots != null && sourceRoots.size() > 0) {
final @Nullable String sourceRoot = sourceRoots.get(0);
if (sourceRoot != null && new File(sourceRoot).exists()) {
if (sourceRoots.size() > 1) {
logger.warn("There's more than one source root, using {}", sourceRoot);
}
Expand Down Expand Up @@ -148,7 +149,7 @@ private void bundleSources(

cliRunner.runSentryCli(String.join(" ", bundleSourcesCommand), true);
} else {
throw new MojoExecutionException("Unable to find source root");
logger.info("Skipping module, as it doesn't have any source roots");
}
} catch (Throwable t) {
SentryTelemetryService.getInstance().captureError(t, "bundleSources");
Expand Down
Loading