How to compile multiple Spring artifacts in one line?

Hi!

I’m presenting here a very specific problem.

I have this:

dependencies {
compile 'org.springframework:spring-aop:4.1.6.RELEASE'
compile 'org.springframework:spring-aspects:4.1.6.RELEASE'
compile 'org.springframework:spring-beans:4.1.6.RELEASE'
compile 'org.springframework:spring-context:4.1.6.RELEASE'
compile 'org.springframework:spring-context-support:4.1.6.RELEASE'
compile 'org.springframework:spring-core:4.1.6.RELEASE'
compile 'org.springframework:spring-expression:4.1.6.RELEASE'
compile 'org.springframework:spring-instrument:4.1.6.RELEASE'
compile 'org.springframework:spring-instrument-tomcat:4.1.6.RELEASE'
compile 'org.springframework:spring-jdbc:4.1.6.RELEASE'
compile 'org.springframework:spring-jms:4.1.6.RELEASE'
compile 'org.springframework:spring-messaging:4.1.6.RELEASE'
compile 'org.springframework:spring-orm:4.1.6.RELEASE'
compile 'org.springframework:spring-oxm:4.1.6.RELEASE'
compile 'org.springframework:spring-test:4.1.6.RELEASE'
compile 'org.springframework:spring-test:4.1.6.RELEASE'
compile 'org.springframework:spring-tx:4.1.6.RELEASE'
compile 'org.springframework:spring-web:4.1.6.RELEASE'
compile 'org.springframework:spring-webmvc:4.1.6.RELEASE'
compile 'org.springframework:spring-webmvc-portlet:4.1.6.RELEASE'
compile 'org.springframework:spring-websocket:4.1.6.RELEASE'
}

Is there a way of doing this in only one line??

You can use a list of the module names, and the groovy each method. It’s gonna be a little cleaner, but still long.

[‘spring-aop’, ‘spring-aspects’,…, ‘the other spring modules’].each{
compile “org.springframework:${it}:4.1.6.RELEASE”
}

Well, that’s awesome enough!!! :smile::thumbsup:

That’s pretty cool, the way it works. I’m not familiarized with groovy, but this is definitely my starting point!

Thanks Francois