Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I specify a Maven property in a Gradle build script?

Tags:

maven

gradle

I am migrating from Maven3 to Gradle and I have a transitive dependency on Spring in this form:

<dependency>
   <groupId>org.springframework</groupId>
   <artifactId>spring-jdbc</artifactId>
   <version>${supported-spring-version}</version>
</dependency>

I cannot change my dependent's pom.xml, so how can I resolve this transitive dependency? There are two issues here.

  1. How do I declare a property in a manner that Gradle will use it for depencency resolution?
  2. How do I declare a property that is invalid Gradle syntax (e.g., supported-spring-version)?
like image 327
Kevin Avatar asked Sep 17 '12 21:09

Kevin


1 Answers

Ad 1. Setting a Java system property (e.g. System.setProperty("supported-spring-version", "3.0")) in your Gradle build might do the job.

Ad 2. You don't declare this as a Groovy property.

like image 178
Peter Niederwieser Avatar answered Oct 08 '22 05:10

Peter Niederwieser