Grab and boms

Per Nyfelt <[email protected]> Tue, 22 Apr 2025 20:23:32 +0200
Newsgroups gmane.comp.lang.groovy.user
Organization Alipsa HB
Message-ID <[email protected]>
Hi, is it possible to use boms in @Grab?

I tried the following in a groovy script:

#!/usr/bin/env groovy @Grab(group='se.alipsa.matrix', module='matrix-bom', version='2.2.0', type='pom')
@Grab('se.alipsa.matrix:matrix-core')

import se.alipsa.matrix.core.*
import java.util.time.*

import java.time.LocalDate

Matrix empData =Matrix.builder()
     .columns(
         emp_id:1..5,
         emp_name: ["Rick","Dan","Michelle","Ryan","Gary"],
         salary: [623.3,515.2,611.0,729.0,843.25],
         start_date:ListConverter.toLocalDates("2013-01-01","2012-03-27","2013-09-23","2014-11-15","2014-05-11"))
     .types([int, String, Number, LocalDate])
     .build()
println empData.content()

While it does fetch the bom file and everything "works", it does not 
honor the versions specified in it and instead for the subsequent grab 
(matrix-core), but just fetches the latest one from the .m2 cache

Is there a way to enforce the versions specified in the bom?

Regards,

Per