You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a parent POM file which is used in multiple projects, some of which are mixed Java/Kotlin, others which are Kotlin only and others which have multiple root sources. The parent POM uses org.codehaus.mojo:build-helper-maven-plugin to add the src/main/kotlin directory to the list of directories which might contain sources which should be compiled. Typically the compile sources roots will contain both src/main/java and src/main/kotlin, but can contain other source roots for code generated by Open API generator.
I believe that the issue is in [UploadSourceBundleMojo.java](https://github.com/getsentry/sentry-maven-plugin/blob/7798467289097c3882a36c794497311eb61887da/src/main/java/io/sentry/UploadSourceBundleMojo.java#L109C1-L112C10) where the code is always picking the first entry in the list of possible source roots.
If the compileSourceRoots contains multiple entries and the first one actually has code in it (say for a mixed Java/Kotlin project) this works ok. But if the project only has code in src/main/kotlin then source bundling will fail. If the project has additional code in another source root (say from OpenAPI generated clients or services) this code will not be bundled and uploaded.
How is this supposed to work for projects which have multiple source roots, or for projects which do not use the 1st source root as described?
Expected Result
The plugin should support bundling source from multiple roots.
Actual Result
For projects which have multiple compile source roots (like src/main/java and src/main/kotlin) but only have code in the second source root, the build will fail like so:
[INFO] [WARNING] There's more than one source root, using /build/target/checkout/kotlin-only-service/src/main/java
.....
[INFO] DEBUG 2024-04-02 21:30:13.385720499 +00:00 body: {"url":"organizations/omnidian/chunk-upload/","chunkSize":8388608,"chunksPerRequest":64,"maxFileSize":2147483648,"maxRequestSize":33554432,"concurrency":8,"hashAlgorithm":"sha1","compression":["gzip"],"accept":["debug_files","release_files","pdbs","sources","bcsymbolmaps","il2cpp","portablepdbs","artifact_bundles","artifact_bundles_v2"]}
[INFO] error: Given path does not exist: /build/target/checkout/kotlin-only-service/src/main/java
For projects which have multiple compile source roots which have code in the, only the code in the first directory will be bundled.
The text was updated successfully, but these errors were encountered:
Thanks @adinauer. Do you have a link to any more documentation for how source bundling should be done for projects which include multiple modules?
For example, we have a Sentry project service-A which receives error reports from a deployable web service. The maven build for service-A also has dependencies on some common modules, say common-1, common-2, & common-3.
How would we bundle the source for those common modules so that Sentry can use it to figure out relevant stack info for uncaught exceptions / logs?
Not yet, can you try adding the sentry maven plugin to each module? In theory it should just generate a debug-meta.properties file in each module which the Java SDK should be able to detect automatically. I haven't tested this yet.
Maven Version
3.9.6
Version
0.0.7
Sentry SDK Version
7.6.0
Steps to Reproduce
I have a parent POM file which is used in multiple projects, some of which are mixed Java/Kotlin, others which are Kotlin only and others which have multiple root sources. The parent POM uses
org.codehaus.mojo:build-helper-maven-plugin
to add thesrc/main/kotlin
directory to the list of directories which might contain sources which should be compiled. Typically the compile sources roots will contain bothsrc/main/java
andsrc/main/kotlin
, but can contain other source roots for code generated by Open API generator.I believe that the issue is in
[UploadSourceBundleMojo.java](https://github.com/getsentry/sentry-maven-plugin/blob/7798467289097c3882a36c794497311eb61887da/src/main/java/io/sentry/UploadSourceBundleMojo.java#L109C1-L112C10)
where the code is always picking the first entry in the list of possible source roots.If the compileSourceRoots contains multiple entries and the first one actually has code in it (say for a mixed Java/Kotlin project) this works ok. But if the project only has code in
src/main/kotlin
then source bundling will fail. If the project has additional code in another source root (say from OpenAPI generated clients or services) this code will not be bundled and uploaded.How is this supposed to work for projects which have multiple source roots, or for projects which do not use the 1st source root as described?
Expected Result
The plugin should support bundling source from multiple roots.
Actual Result
For projects which have multiple compile source roots (like
src/main/java
andsrc/main/kotlin
) but only have code in the second source root, the build will fail like so:For projects which have multiple compile source roots which have code in the, only the code in the first directory will be bundled.
The text was updated successfully, but these errors were encountered: