Open
Description
Presence of a file in META-INF/services/ makes sbt-assembly completely ignore the same file present in dependencies.
To verify this I modified bit tests in src/sbt-test/merging:
-
Add
mustContain(dir / "META-INF" / "services" / "srv", Seq("srv1", "srv2"))
to check rules in build.sbt -
Prepare test data:
mkdir -p src/main/1/META-INF/services echo "srv1" > src/main/1/META-INF/services/srv mkdir -p src/main/2/META-INF/services echo "srv2" > src/main/2/META-INF/services/srv cd src/main; ./mklibs.sh; cd ../../
Now we can verify that tests pass:
$ sbt -Dplugin.version=2.1.4 'assembly; check'
[info] welcome to sbt 1.7.2 (Eclipse Adoptium Java 11.0.20)
...
[info] 5 file(s) merged using strategy 'FilterDistinctLines' (Run the task at debug level to see the details)
...
[success] Total time: 2 s, completed 19 lis 2023, 19:01:56
[success] Total time: 6 s, completed 19 lis 2023, 19:02:02
So far so good, now let's add a file to local project:
mkdir -p src/main/resources/META-INF/services
echo "srv0" > src/main/resources/META-INF/services/srv
And re-run tests with check rule changed to mustContain(dir / "META-INF" / "services" / "srv", Seq("srv0", "srv1", "srv2"))
:
$ rm target/scala-2.12/foo.jar; sbt -Dplugin.version=2.1.4 'assembly; check'
[info] welcome to sbt 1.7.2 (Eclipse Adoptium Java 11.0.20)
...
[success] Total time: 1 s, completed 19 lis 2023, 19:14:12
[error] java.lang.Exception: file ...\Temp\sbt_9ee51824\META-INF\services\srv had wrong content:
[error] srv0
[error] *** instead of ***
[error] srv0
[error] srv1
[error] srv2
This worked correctly in sbt-assembly 1.2.0, and got broken with 2.0.0.
Metadata
Metadata
Assignees
Labels
No labels