"Bad type on operand stack" Error for plugin 1.5 and up
In updating a project's build.gradle cyclonedx plugin version from 1.3 to 1.6.1, I got errors and a failed build. Further testing established that 1.4.1 was the last good version. ie, the error first occurs in 1.5.0
The following is from Jenkins, where the build is done using Azul OpenJDK 8.0.322 and Gradle is 6.1.1. This error is from a build using plugin 1.6.1 (hence the reference to schemaVersion 1.4)
> Task :cyclonedxBom FAILED
Caching disabled for task ':cyclonedxBom' because:
Build cache is disabled
Task ':cyclonedxBom' is not up-to-date because:
No history is available.
CycloneDX: Parameters
------------------------------------------------------------------------
schemaVersion : 1.4
includeBomSerialNumber : true
includeConfigs : []
skipConfigs : [integrationTestCompile, integrationTestCompileClasspath, integrationTestRuntime, integrationTestRuntimeClasspath, testcompile, testCompileClasspath, testRuntime, testRuntimeClasspath]
destination : /data/jenkins/workspace/xxxxxx/DS-439/build/reports
outputName : bom
------------------------------------------------------------------------
CycloneDX: Resolving Dependencies
:cyclonedxBom (Thread[Execution worker for ':',5,main]) completed. Took 0.378 secs.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':cyclonedxBom'.
> Bad type on operand stack
Exception Details:
Location:
org/apache/maven/model/validation/DefaultModelValidator.validateEffectiveModel(Lorg/apache/maven/model/Model;Lorg/apache/maven/model/building/ModelBuildingRequest;Lorg/apache/maven/model/building/ModelProblemCollector;)V @901: invokespecial
Reason:
Type 'org/apache/maven/model/DeploymentRepository' (current frame, stack[2]) is not assignable to 'org/apache/maven/model/Repository'
Current Frame:
bci: @901
flags: { }
locals: { 'org/apache/maven/model/validation/DefaultModelValidator', 'org/apache/maven/model/Model', 'org/apache/maven/model/building/ModelBuildingRequest', 'org/apache/maven/model/building/ModelProblemCollector', 'org/apache/maven/model/building/ModelProblem$Severity', 'org/apache/maven/model/DependencyManagement', 'java/util/Set', 'org/apache/maven/model/building/ModelProblem$Severity', 'org/apache/maven/model/Build', 'org/apache/maven/model/Reporting', 'org/apache/maven/model/DistributionManagement' }
stack: { 'org/apache/maven/model/validation/DefaultModelValidator', 'org/apache/maven/model/building/ModelProblemCollector', 'org/apache/maven/model/DeploymentRepository', 'java/lang/String', 'org/apache/maven/model/building/ModelBuildingRequest' }
Bytecode:
0x0000000: 2a12 1d2d b200 1eb2 000a 2bb6 0020 2bb7
0x0000010: 000c 572a 1224 2d2b b600 112b b700 8157
0x0000020: 2a12 262d 2bb6 0013 2bb7 0081 572a 1282
0x0000030: 2db2 001e b200 0a2b b600 832b b700 0c57
0x0000040: 2bb6 0084 b900 8501 009a 0097 1286 2bb6
0x0000050: 0083 b600 879a 002c 2db2 001e b200 0a12
0x0000060: 8201 bb00 4459 b700 4512 88b6 0047 2bb6
0x0000070: 0083 b600 4712 89b6 0047 b600 4a2b b800
0x0000080: 1503 3604 2bb6 0084 b900 8a01 0036 0515
0x0000090: 0415 05a2 004d 2bb6 0084 1504 b900 8b02
0x00000a0: 00c0 0021 3a06 1906 b800 8c99 002f 2db2
0x00000b0: 001e b200 0abb 0044 59b7 0045 128d b600
0x00000c0: 4715 04b6 008e 128f b600 47b6 004a 0112
0x00000d0: 902b 1291 b600 92b8 0015 8404 01a7 ffb2
0x00000e0: 2a12 272d b200 1eb2 000a 2bb6 0028 2bb7
0x00000f0: 000c 572c 101e b800 1c3a 042a 2d2b 2bb6
0x0000100: 002a 032c b700 932b b600 303a 0519 05c6
0x0000110: 0010 2a2d 2b19 05b6 0031 042c b700 932c
0x0000120: b900 1a01 0010 14a1 026e bb00 0359 b700
0x0000130: 043a 0603 3607 2bb6 0084 b900 8a01 0036
0x0000140: 0815 0715 08a2 0063 2bb6 0084 1507 b900
0x0000150: 8b02 00c0 0021 3a09 1906 1909 b900 4b02
0x0000160: 009a 0041 2db2 001e b200 1fbb 0044 59b7
0x0000170: 0045 128d b600 4715 07b6 008e 128f b600
0x0000180: 47b6 004a 01bb 0044 59b7 0045 1294 b600
0x0000190: 4719 09b6 0047 b600 4a2b 1291 b600 92b8
0x00001a0: 0015 8407 01a7 ff9c 2c10 1fb8 001c 3a07
0x00001b0: 2a12 2c12 272d 1907 b200 1f2b b600 2801
0x00001c0: 2b12 95b7 0096 572a 1227 2d19 07b2 001f
0x00001d0: 2bb6 0028 012b b700 9757 2bb6 0038 3a08
0x00001e0: 1908 c600 bf19 08b6 0039 b900 4001 003a
0x00001f0: 0919 09b9 0041 0100 9900 8f19 09b9 0042
0x0000200: 0100 c000 6d3a 0a2a 1298 2db2 001e b200
0x0000210: 1f19 0ab6 0073 190a b700 0c57 2a12 992d
0x0000220: b200 1eb2 001f 190a b600 6e19 0ab7 000c
0x0000230: 572a 129a 2d19 0ab6 0075 190a b600 7719
0x0000240: 0a2c b700 9b57 2a12 9c12 2c2d 1904 b200
0x0000250: 1f19 0ab6 009d 190a b600 7719 0ab7 009e
0x0000260: 572a 129f 122c 2d19 04b2 001f 190a b600
0x0000270: a019 0ab6 0077 190a b700 9e57 2a2d 190a
0x0000280: 2cb7 00a1 a7ff 6d2a 2d19 08b6 00a2 12a3
0x0000290: 2cb7 00a4 2a2d 1908 b600 a512 a62c b700
0x00002a0: a42b b600 a73a 0919 09c6 0052 1909 b600
0x00002b0: a8b9 0040 0100 3a0a 190a b900 4101 0099
0x00002c0: 003c 190a b900 4201 00c0 00a9 3a0b 2a12
0x00002d0: aa2d b200 1eb2 001f 190b b600 ab19 0bb7
0x00002e0: 000c 572a 12ac 2db2 001e b200 1f19 0bb6
0x00002f0: 00ad 190b b700 0c57 a7ff c02b b600 33b9
0x0000300: 0040 0100 3a0a 190a b900 4101 0099 001c
0x0000310: 190a b900 4201 00c0 00ae 3a0b 2a2d 190b
0x0000320: 1234 2cb7 00af a7ff e02b b600 36b9 0040
0x0000330: 0100 3a0a 190a b900 4101 0099 001c 190a
0x0000340: b900 4201 00c0 00ae 3a0b 2a2d 190b 1237
0x0000350: 2cb7 00af a7ff e02b b600 b03a 0a19 0ac6
0x0000360: 0036 190a b600 b1c6 0014 2db2 001e b200
0x0000370: 1f12 b201 12b3 190a b800 152a 2d19 0ab6
0x0000380: 00b4 12b5 2cb7 00af 2a2d 190a b600 b612
0x0000390: b72c b700 afb1
Stackmap Table:
same_frame_extended(@129)
append_frame(@143,Integer,Integer)
same_frame_extended(@218)
chop_frame(@224,2)
append_frame(@287,Object[#396],Object[#457])
append_frame(@321,Object[#398],Integer,Integer)
same_frame_extended(@418)
chop_frame(@424,2)
append_frame(@497,Object[#396],Object[#397],Object[#399])
chop_frame(@647,1)
same_frame(@673)
append_frame(@696,Object[#458],Object[#399])
chop_frame(@763,1)
append_frame(@774,Object[#399])
chop_frame(@809,1)
append_frame(@820,Object[#399])
chop_frame(@855,1)
append_frame(@891,Object[#459])
full_frame(@917,{Object[#402],Object[#403],Object[#404],Object[#405],Object[#396],Object[#457]},{})
* Try:
Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org/
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.1.1/userguide/command_line_interface.html#sec:command_line_warnings
kind of the same error here:
> Task :xxx:cyclonedxBom FAILED
Caching disabled for task ':xxx:cyclonedxBom' because:
Caching has not been enabled for the task
Task ':xxx:cyclonedxBom' is not up-to-date because:
Task has failed previously.
CycloneDX: Parameters
------------------------------------------------------------------------
schemaVersion : 1.4
includeBomSerialNumber : true
includeConfigs : [runtimeClasspath]
skipConfigs : []
destination : /Users/jcgay/dev/xxx/build/reports
outputName : bom
------------------------------------------------------------------------
CycloneDX: Resolving Dependencies
Resolving global dependency management for project 'xxx-integration-testing'
Excluding []
:xxx:cyclonedxBom (Thread[Execution worker Thread 4,5,main]) completed. Took 1.225 secs.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':xxx:cyclonedxBom'.
> Bad type on operand stack
Exception Details:
Location:
org/apache/maven/model/validation/DefaultModelValidator.validateEffectiveModel(Lorg/apache/maven/model/Model;Lorg/apache/maven/model/building/ModelBuildingRequest;Lorg/apache/maven/model/building/ModelProblemCollector;)V @926: invokespecial
Reason:
Type 'org/apache/maven/model/DeploymentRepository' (current frame, stack[2]) is not assignable to 'org/apache/maven/model/Repository'
Current Frame:
bci: @926
flags: { }
locals: { 'org/apache/maven/model/validation/DefaultModelValidator', 'org/apache/maven/model/Model', 'org/apache/maven/model/building/ModelBuildingRequest', 'org/apache/maven/model/building/ModelProblemCollector', 'org/apache/maven/model/building/ModelProblem$Severity', 'org/apache/maven/model/DependencyManagement', 'java/util/Set', 'org/apache/maven/model/building/ModelProblem$Severity', 'org/apache/maven/model/Build', 'org/apache/maven/model/Reporting', 'org/apache/maven/model/DistributionManagement' }
stack: { 'org/apache/maven/model/validation/DefaultModelValidator', 'org/apache/maven/model/building/ModelProblemCollector', 'org/apache/maven/model/DeploymentRepository', 'java/lang/String', 'org/apache/maven/model/building/ModelBuildingRequest' }
Bytecode:
0000000: 2a12 772d b200 7ab2 0042 2bb6 0080 2bb7
0000010: 004c 572a 128a 2d2b b600 572b b701 b157
0000020: 2a12 8f2d 2bb6 005c 2bb7 01b1 572a 1301
0000030: b32d b200 7ab2 0042 2bb6 01b6 2bb7 004c
0000040: 572b b601 b9b9 01ba 0100 9a00 9f13 01bc
0000050: 2bb6 01b6 b601 be9a 002f 2db2 007a b200
0000060: 4213 01b3 01bb 00eb 59b7 00ec 1301 c0b6
0000070: 00f2 2bb6 01b6 b600 f213 01c2 b600 f2b6
0000080: 00fa 2bb8 0062 0336 042b b601 b9b9 01c5
0000090: 0100 3605 1504 1505 a200 512b b601 b915
00000a0: 04b9 01c8 0200 c000 823a 0619 06b8 01cb
00000b0: 9900 332d b200 7ab2 0042 bb00 eb59 b700
00000c0: ec13 01cd b600 f215 04b6 01d0 1301 d2b6
00000d0: 00f2 b600 fa01 1301 d42b 1301 d6b6 01d7
00000e0: b800 6284 0401 a7ff ae2a 1291 2db2 007a
00000f0: b200 422b b600 922b b700 4c57 2c10 1eb8
0000100: 0075 3a04 2a2d 2b2b b600 9903 2cb7 01db
0000110: 2bb6 00a9 3a05 1905 c600 102a 2d2b 1905
0000120: b600 ac04 2cb7 01db 2cb9 0071 0100 1014
0000130: a102 7fbb 0029 59b7 002a 3a06 0336 072b
0000140: b601 b9b9 01c5 0100 3608 1507 1508 a200
0000150: 672b b601 b915 07b9 01c8 0200 c000 823a
0000160: 0919 0619 09b9 00fe 0200 9a00 452d b200
0000170: 7ab2 007d bb00 eb59 b700 ec13 01cd b600
0000180: f215 07b6 01d0 1301 d2b6 00f2 b600 fa01
0000190: bb00 eb59 b700 ec13 01dd b600 f219 09b6
00001a0: 00f2 b600 fa2b 1301 d6b6 01d7 b800 6284
00001b0: 0701 a7ff 982c 101f b800 753a 072a 121c
00001c0: 1291 2d19 07b2 007d 2bb6 0092 012b 1217
00001d0: b701 e157 2a12 912d 1907 b200 7d2b b600
00001e0: 9201 2bb7 01e5 572b b600 bf3a 0819 08c6
00001f0: 00c6 1908 b600 c4b9 00db 0100 3a09 1909
0000200: b900 e301 0099 0094 1909 b900 e701 00c0
0000210: 0173 3a0a 2a13 01e7 2db2 007a b200 7d19
0000220: 0ab6 017f 190a b700 4c57 2a13 01e9 2db2
0000230: 007a b200 7d19 0ab6 0174 190a b700 4c57
0000240: 2a13 01eb 2d19 0ab6 0182 190a b601 8719
0000250: 0a2c b701 ef57 2a13 01f1 121c 2d19 04b2
0000260: 007d 190a b601 f419 0ab6 0187 190a b701
0000270: f857 2a13 01fa 121c 2d19 04b2 007d 190a
0000280: b601 fd19 0ab6 0187 190a b701 f857 2a2d
0000290: 190a 2cb7 0201 a7ff 682a 2d19 08b6 0204
00002a0: 1302 062c b702 0a2a 2d19 08b6 020d 1302
00002b0: 0f2c b702 0a2b b602 133a 0919 09c6 0054
00002c0: 1909 b602 16b9 00db 0100 3a0a 190a b900
00002d0: e301 0099 003e 190a b900 e701 00c0 0218
00002e0: 3a0b 2a13 021a 2db2 007a b200 7d19 0bb6
00002f0: 021b 190b b700 4c57 2a13 021d 2db2 007a
0000300: b200 7d19 0bb6 021e 190b b700 4c57 a7ff
0000310: be2b b600 b1b9 00db 0100 3a0a 190a b900
0000320: e301 0099 001c 190a b900 e701 00c0 0220
0000330: 3a0b 2a2d 190b 12b3 2cb7 0224 a7ff e02b
0000340: b600 b9b9 00db 0100 3a0a 190a b900 e301
0000350: 0099 001c 190a b900 e701 00c0 0220 3a0b
0000360: 2a2d 190b 12bb 2cb7 0224 a7ff e02b b602
0000370: 283a 0a19 0ac6 003a 190a b602 2dc6 0016
0000380: 2db2 007a b200 7d13 022f 0113 0231 190a
0000390: b800 622a 2d19 0ab6 0235 1302 372c b702
00003a0: 242a 2d19 0ab6 023a 1302 3c2c b702 24b1
00003b0:
Stackmap Table:
same_frame_extended(@134)
append_frame(@148,Integer,Integer)
same_frame_extended(@227)
chop_frame(@233,2)
append_frame(@296,Object[#11],Object[#171])
append_frame(@330,Object[#221],Integer,Integer)
same_frame_extended(@431)
chop_frame(@437,2)
append_frame(@510,Object[#11],Object[#193],Object[#223])
chop_frame(@665,1)
same_frame(@693)
append_frame(@716,Object[#533],Object[#223])
chop_frame(@785,1)
append_frame(@796,Object[#223])
chop_frame(@831,1)
append_frame(@842,Object[#223])
chop_frame(@877,1)
append_frame(@915,Object[#554])
full_frame(@943,{Object[#2],Object[#52],Object[#109],Object[#285],Object[#11],Object[#171]},{})
with:
------------------------------------------------------------
Gradle 7.5.1
------------------------------------------------------------
Build time: 2022-08-05 21:17:56 UTC
Revision: d1daa0cbf1a0103000b71484e1dbfe096e095918
Kotlin: 1.6.21
Groovy: 3.0.10
Ant: Apache Ant(TM) version 1.10.11 compiled on July 10 2021
JVM: 11.0.9 (AdoptOpenJDK 11.0.9+11)
OS: Mac OS X 10.15.7 x86_64
Am I missing something ? 😇
I have resolved my issue.
It was due to a custom plugin (in buildSrc) in my project which was using a dependency on maven-model 2.2.1.
Aligning this dependency on the version used by cyclonedx-gradle-plugin solves the problem in my case.